#include <iostream>
using namespace std;
int n,i,x,f[1000005];
int main()
{
cin >> n; int sol = 0;
for (i=1; i<=n; i++)
{
cin >> x;
if (f[x+1] == 0)
sol++;
else
f[x+1]--;
f[x]++;
}
cout << sol;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
256 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
376 KB |
Output is correct |
5 |
Correct |
330 ms |
3960 KB |
Output is correct |
6 |
Correct |
337 ms |
3820 KB |
Output is correct |
7 |
Correct |
267 ms |
3192 KB |
Output is correct |
8 |
Correct |
266 ms |
3160 KB |
Output is correct |
9 |
Correct |
296 ms |
3536 KB |
Output is correct |
10 |
Correct |
295 ms |
3448 KB |
Output is correct |