Submission #101033

#TimeUsernameProblemLanguageResultExecution timeMemory
101033a1_NDivide and conquer (IZhO14_divide)C++14
48 / 100
1054 ms1984 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int N = (int)1e5 + 55; int n,a[N],g[N],e[N],ans; main(){ cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i] >> g[i] >> e[i]; } for(int i = 1; i <= n; i++){ int gold = 0,energy = 0; for(int j = i; j <= n; j++){ gold += g[j]; energy += e[j]; if(a[j] - a[i] <= energy){ ans = max(ans, gold); } } } cout << ans; return 0; }

Compilation message (stderr)

divide.cpp:11:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...