Submission #887234

#TimeUsernameProblemLanguageResultExecution timeMemory
887234vjudge1Baloni (COCI15_baloni)C++17
100 / 100
266 ms10832 KiB
#ifndef Local #pragma GCC optimize("O3,unroll-loops") const int lim=1e6+100; #else const int lim=2e3+100; #endif #include "bits/stdc++.h" using namespace std; #define int int64_t #define pb push_back const int mod=1e9+7; using pii=pair<int,int>; inline void solve(){ int n; cin>>n; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } multiset<int>all; for(int i=n-1;0<=i;i--){ if(all.count(a[i]-1)){ all.erase(all.find(a[i]-1)); } all.insert(a[i]); } cout<<all.size()<<"\n"; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); #ifdef Local freopen(".in","r",stdin); freopen(".out","w",stdout); #else //freopen("grass.in","r",stdin); //freopen("grass.out","w",stdout); #endif int t=1; //cin>>t; while (t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...