| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 4 초 (추가 시간 없음) | 2048 MB | 53 | 24 | 21 | 42.857% |
You are editing a list of spreadsheet cells. Initially all cells are empty. You can perform two types of operations:
Given the final cell values that you would like to have in the spreadsheet, calculate the minimum number of editing operations required to obtain those values.
The first line of input contains a single integer $n$ (1ドル \leq n \leq 800$), which is the number of cells you are editing. The cells are number from 1ドル$ to $n$.
Each of the next $n$ lines contains a single integer between 0ドル$ and 10ドル^9$ inclusive. The integer on the $i^{\text{th}}$ line is 0ドル$ if cell $i$ should be empty after all operations. Otherwise, it is a positive integer that is the final value of cell $i$.
Output a single integer, which the minimum number of editing operations required.
10 0 1 2 3 4 2 1 0 0 1
5
ICPC > Regionals > North America > Pacific Northwest Regional > 2023 ICPC Pacific Northwest Region > Division 1 I번
ICPC > Regionals > North America > Mid-Central Regional > 2023 Mid-Central USA Programming Contest B번
ICPC > Regionals > North America > South Central USA Regional > 2023 South Central USA Regional Contest > Division 1 H번
ICPC > Regionals > North America > Mid-Atlantic Regional > 2023 Mid-Atlantic USA Regional Contest > Division 1 H번
ICPC > Regionals > North America > Southeast USA Regional > 2023 Southeast USA Regional Programming Contest > Division 1 H번