# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
546898 |
2022-04-08T20:02:28 Z |
Ahmed57 |
Baloni (COCI15_baloni) |
C++14 |
|
342 ms |
7320 KB |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for(int i = 0;i<n;i++)cin>>arr[i];
map<int,int> mp;
int ans = 0;
for(int i = 0;i<n;i++){
if(mp[arr[i]]){
mp[arr[i]]--;
mp[arr[i]-1]++;
}else{
mp[arr[i]-1]++;
ans++;
}
}
cout<<ans<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
330 ms |
7196 KB |
Output is correct |
6 |
Correct |
342 ms |
7320 KB |
Output is correct |
7 |
Correct |
250 ms |
6032 KB |
Output is correct |
8 |
Correct |
278 ms |
5920 KB |
Output is correct |
9 |
Correct |
292 ms |
6664 KB |
Output is correct |
10 |
Correct |
329 ms |
6568 KB |
Output is correct |