Submission #1130410

#TimeUsernameProblemLanguageResultExecution timeMemory
1130410AndrijaMBaloni (COCI15_baloni)C++20
100 / 100
273 ms7504 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' const int maxn=1e5+10; const int mod=1e9+7; multiset<int>s; signed main() { ios::sync_with_stdio(false); ///freopen("dulciuri.in","r",stdin); ///freopen("dulciuri.out","w",stdout); int n; cin>>n; int a[n]; int ans=0; for(int i=0;i<n;i++) { cin>>a[i]; if(s.count(a[i]+1)==0) { ans++; s.insert(a[i]); } else { s.erase(s.find(a[i]+1)); s.insert(a[i]); } } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...