Submission #1130408

#TimeUsernameProblemLanguageResultExecution timeMemory
1130408AndrijaMBaloni (COCI15_baloni)C++20
0 / 100
135 ms196608 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' const int maxn=1e6+10; const int mod=1e9+7; stack<int>s[maxn]; 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[a[i]+1].size()==0) { ans++; s[a[i]].push(i); } else { s[a[i]+1].pop(); s[a[i]].push(i); } } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...