#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]++;
}
if (a[x]==1){
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 |
368 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
424 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
460 KB |
Output isn't correct |
5 |
Incorrect |
224 ms |
604 KB |
Output isn't correct |
6 |
Incorrect |
237 ms |
604 KB |
Output isn't correct |
7 |
Incorrect |
181 ms |
604 KB |
Output isn't correct |
8 |
Incorrect |
181 ms |
604 KB |
Output isn't correct |
9 |
Incorrect |
226 ms |
604 KB |
Output isn't correct |
10 |
Incorrect |
226 ms |
604 KB |
Output isn't correct |