#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 |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
170 ms |
212 KB |
Output is correct |
6 |
Correct |
171 ms |
284 KB |
Output is correct |
7 |
Correct |
167 ms |
284 KB |
Output is correct |
8 |
Correct |
140 ms |
284 KB |
Output is correct |
9 |
Correct |
149 ms |
304 KB |
Output is correct |
10 |
Correct |
162 ms |
284 KB |
Output is correct |