Submission #31640

#TimeUsernameProblemLanguageResultExecution timeMemory
31640long10024070Baloni (COCI15_baloni)C++11
100 / 100
73 ms9988 KiB
#include <iostream> #include <cstdio> using namespace std; const string TASK = "Baloni"; int n,h[(int)1e6+1],c[(int)1e6+1],res; void Enter() { cin >> n; for (int i=1;i<=n;++i) cin >> h[i]; } void Init() { } void Solve() { res = 0; for (int i=1;i<=n;++i) if (c[h[i]] == 0) { ++res; ++c[h[i]-1]; } else { --c[h[i]]; ++c[h[i]-1]; } cout << res; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen((TASK+".INP").c_str(),"r",stdin); //freopen((TASK+".OUT").c_str(),"w",stdout); Enter(); Init(); Solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...