#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define SI size()
#define pb push_back
using namespace std;
const ll MAX=1000007;
ll i,m,n,sum,a[MAX],ans;
int main(){
cin>>n;
for (i=0;i<n;i++){
ll x;
cin>>x;
if (a[x]==0){
ans++;
a[x-1]++;
}
else {
a[x]--;
a[x-1]--;
}
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
352 KB |
Output isn't correct |
3 |
Incorrect |
3 ms |
424 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
460 KB |
Output isn't correct |
5 |
Incorrect |
220 ms |
588 KB |
Output isn't correct |
6 |
Incorrect |
246 ms |
588 KB |
Output isn't correct |
7 |
Incorrect |
204 ms |
588 KB |
Output isn't correct |
8 |
Incorrect |
173 ms |
660 KB |
Output isn't correct |
9 |
Incorrect |
198 ms |
676 KB |
Output isn't correct |
10 |
Incorrect |
224 ms |
676 KB |
Output isn't correct |