Submission #546898

#TimeUsernameProblemLanguageResultExecution timeMemory
546898Ahmed57Baloni (COCI15_baloni)C++14
100 / 100
342 ms7320 KiB
#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 timeMemoryGrader output
Fetching results...