Submission #991689

#TimeUsernameProblemLanguageResultExecution timeMemory
991689VMaksimoski008Divide and conquer (IZhO14_divide)C++17
48 / 100
1054 ms1884 KiB
#include <bits/stdc++.h> #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() //#define int long long using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; const int mod = 1e9 + 7; const int LOG = 20; const int maxn = 1e5 + 5; const double eps = 1e-9; int32_t main() { ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0); int n; cin >> n; vector<array<int, 3> > v(n); for(auto &[a, b, c] : v) cin >> a >> b >> c; ll ans = 0; for(int i=0; i<n; i++) { ll sum = 0, eng = 0; for(int j=i; j<n; j++) { sum += v[j][1]; eng += v[j][2]; if(eng >= v[j][0] - v[i][0] + 1) ans = max(ans, sum); } } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...