Submission #833864

#TimeUsernameProblemLanguageResultExecution timeMemory
833864baqqon_Divide and conquer (IZhO14_divide)C++17
0 / 100
0 ms212 KiB
#include<bits/stdc++.h> using namespace std; int main() { //freopen("divide.in", "r", stdin); //freopen("divide.out", "w", stdout); int n; cin >> n; int x[n] , g[n] , e[n] ; for(int i=1; i<=n; i++){ cin >> x[i] >> g[i] >> e[i]; } int rud = g[1]; int gold = g[1], energy = e[1]; for(int i=2; i<=n; i++){ int len = x[i] - x[i-1]; if(len <= energy + e[i]){ gold += g[i]; energy += e[i] - len; } else{ gold = g[i]; energy = e[i]; } rud = max(rud, gold); } cout << gold+1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...