Submission #37762

#TimeUsernameProblemLanguageResultExecution timeMemory
37762mirbek01Divide and conquer (IZhO14_divide)C++14
48 / 100
1000 ms21548 KiB
# include <bits/stdc++.h> # define pb push_back # define fr first # define sc second # define mk make_pair using namespace std; const int inf = 1e9 + 7; const int N = 1e6 + 5; typedef long long ll; int n, a[N]; ll ans, b[N], c[N]; int main() { cin >> n; for(int i = 1; i <= n; i ++) { cin >> a[i] >> b[i] >> c[i]; b[i] += b[i - 1]; c[i] += c[i - 1]; } for(int i = 1; i <= n; i ++) { for(int j = i; j <= n; j ++) { ll res = b[j] - b[i - 1], sum = c[j] - c[i - 1]; if(sum < (a[j] - a[i])) continue; ans = max(ans, res); } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...