Submission #1112463

#TimeUsernameProblemLanguageResultExecution timeMemory
1112463vjudge1Baloni (COCI15_baloni)C++17
0 / 100
70 ms14160 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; vector<pair<int,bool>> v(n); for(int i=0;i<n;i++){ cin >> v[i].first; v[i].second=false; } int ans=1; int res,resi; for(int i=0;i<n;i++){ for(int j=i;j<n;j++){ if(v[j].second==false){ res=v[j].first-1; v[j].second=true; resi=j; break; } cout << ans << endl; return 0; } for(int j=resi+1;j<n;j++){ if(v[j].first==res && v[j].second==false){ res--; v[j].second=true; } } ans++; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...