#include <iostream>
using namespace std;
int n,m,f[1000001],i,j,cnt;
int main(){
cin>>n;
for(i=1;i<=n;i++){
cin>>j;
if(f[j]>0){
f[j]--;
f[j-1]++;
}else{
cnt++;
f[j-1]++;
}
}
cout<<cnt;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
248 KB |
Output is correct |
3 |
Correct |
4 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
376 KB |
Output is correct |
5 |
Correct |
338 ms |
3940 KB |
Output is correct |
6 |
Correct |
332 ms |
3832 KB |
Output is correct |
7 |
Correct |
269 ms |
3192 KB |
Output is correct |
8 |
Correct |
271 ms |
3192 KB |
Output is correct |
9 |
Correct |
298 ms |
3576 KB |
Output is correct |
10 |
Correct |
306 ms |
3420 KB |
Output is correct |