Submission #104971

#TimeUsernameProblemLanguageResultExecution timeMemory
104971Aydarov03금 캐기 (IZhO14_divide)C++14
48 / 100
1065 ms2552 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int x[100005]; int g[100005]; int e[100005]; main() { int n , ans = 0; cin >> n; for(int i = 1; i <= n; i++) { cin >> x[i] >> g[i] >> e[i]; } int gold = 0 , energy = 0; for(int i = 1; i <= n; i++) { gold = 0 , energy = 0; for(int j = i; j <= n; j++) { gold += g[j]; energy += e[j]; if(x[j] - x[i] <= energy) { ans = max(ans , gold); } } } cout << ans << endl; }

Compilation message (stderr)

divide.cpp:10: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...