Submission #777387

#TimeUsernameProblemLanguageResultExecution timeMemory
777387JhoZzelBaloni (COCI15_baloni)C++14
100 / 100
963 ms3868 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); vector<bool> b(n,0); for (int i = 0; i < n; i++) cin >> a[i]; int ans = 0; for (int i = 0; i < n; i++) { if (b[i]) continue; b[i] = 1; int h = a[i] - 1; for (int j = i + 1; j < n; j++) { if (a[j] == h && !b[j]) { b[j] = 1; h--; } } ans++; } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...