#include<bits/stdc++.h>
#define co cout<<
#define ll long long
#define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
//stuff
void solve(){
ll n;
cin>>n;
ll ans=0,x;
map<ll,ll>mp;
for(int i=0;i<n;i++){
cin>>x;
mp[x-1]++;
if(mp[x]<=0) ans++;
else mp[x]--,mp[x-1]++;
}
co ans;
}
int main(){
suiii
int _=1;
//cin>>_;
while(_--) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
524 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
5 |
Incorrect |
207 ms |
4172 KB |
Output isn't correct |
6 |
Incorrect |
170 ms |
3916 KB |
Output isn't correct |
7 |
Incorrect |
127 ms |
3304 KB |
Output isn't correct |
8 |
Incorrect |
134 ms |
3148 KB |
Output isn't correct |
9 |
Incorrect |
170 ms |
3596 KB |
Output isn't correct |
10 |
Incorrect |
149 ms |
3656 KB |
Output isn't correct |