#include <iostream>
using namespace std;
const int N=1e6;
int v[N+5];
int main(){
int n; cin>>n;
int nr=0;
for(int i=1;i<=n;i++){
int x;cin>>x;
if(v[x+1]){
v[x+1]--;
}
else nr++;
v[x]++;
}
cout<<nr;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
126 ms |
348 KB |
Output is correct |
6 |
Correct |
129 ms |
432 KB |
Output is correct |
7 |
Correct |
109 ms |
432 KB |
Output is correct |
8 |
Correct |
102 ms |
420 KB |
Output is correct |
9 |
Correct |
114 ms |
348 KB |
Output is correct |
10 |
Correct |
111 ms |
348 KB |
Output is correct |