Submission #1312812

#TimeUsernameProblemLanguageResultExecution timeMemory
1312812aaaaaaaaPo (COCI21_po)C++20
20 / 70
1096 ms1080 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); int n, ans = 0; cin >> n; vector<int> a(n + 1, 0); for(int i = 1; i <= n; ++i) cin >> a[i]; for(int i = 1; i <= n; ++i){ if(a[i] == 0) continue; int end_point = i; for(int j = i; j <= n; ++j){ if(a[j] < a[i]) break; end_point = j; } for(int j = i + 1; j <= end_point; ++j){ a[j] -= a[i]; } ans += 1; } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...