Submission #971258

#TimeUsernameProblemLanguageResultExecution timeMemory
971258saidponDivide and conquer (IZhO14_divide)C++14
17 / 100
1047 ms4700 KiB
#include <bits/stdc++.h> #define ordered_set tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> #define nemeshay ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define allr(pon) pon.rbegin(), pon.rend() #include <ext/pb_ds/assoc_container.hpp> #define all(pon) pon.begin(), pon.end() #include <ext/pb_ds/tree_policy.hpp> #define pii pair <int, int> #define nosolve puts("-1") #define YES puts("YES") #define pf push_front #define int long long #define OK puts("OK") #define NO puts("NO") #define pb push_back #define sigma signed #define sc second #define fr first using namespace __gnu_pbds; using namespace std; const int N = 1e6 + 20, INF = 2e9 + 7; int a[N], b[N], c[N]; sigma main(){ nemeshay map <int, int> pon; int n, ans = 0; cin >> n; for (int i = 0; i < n; i++){ cin >> a[i] >> b[i] >> c[i]; } for (int i = 0; i < n; i++){ for (int j = i; j < n; j++){ int e = 0, g = 0, l = a[j] - a[i]; for (int k = i; k <= j; k++){ g += b[k]; e += c[k]; } if (e >= l) ans = max(g, ans); } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...