#include <iostream>
#include <bitset>
using namespace std;
int n,i,x,f[1000010],sol;
int main(){
cin>>n;
for(i=1;i<=n;i++){
cin>>x;
if(f[x+1]){
f[x+1]--;
}
else
sol++;
f[x]++;
}
cout<<sol;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
330 ms |
3940 KB |
Output is correct |
6 |
Correct |
334 ms |
3832 KB |
Output is correct |
7 |
Correct |
274 ms |
3192 KB |
Output is correct |
8 |
Correct |
282 ms |
3160 KB |
Output is correct |
9 |
Correct |
302 ms |
3548 KB |
Output is correct |
10 |
Correct |
296 ms |
3420 KB |
Output is correct |