# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91084 | 2018-12-26T07:38:55 Z | Hideo | Divide and conquer (IZhO14_divide) | C++14 | 1000 ms | 2916 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 1e5 + 7; const int INF = 1e9 + 7; ll x[N], g[N], d[N]; int n; ll mx, pre[N], prg[N]; main(){ cin >> n; for (int i = 1; i <= n; i++){ scanf("%lld%lld%lld", &x[i], &g[i], &d[i]); mx = max(g[i], mx); prg[i] = prg[i - 1] + g[i]; pre[i] = pre[i - 1] + d[i]; } for (int i = 1; i <= n; i++){ for (int j = i + 1; j <= n; j++){ if (pre[j] - pre[i - 1] >= x[j] - x[i]){ mx = max (prg[j] - prg[i - 1], mx); } } } cout << mx; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 464 KB | Output is correct |
3 | Correct | 2 ms | 464 KB | Output is correct |
4 | Correct | 2 ms | 464 KB | Output is correct |
5 | Correct | 2 ms | 556 KB | Output is correct |
6 | Correct | 2 ms | 556 KB | Output is correct |
7 | Correct | 2 ms | 556 KB | Output is correct |
8 | Correct | 2 ms | 556 KB | Output is correct |
9 | Correct | 2 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 620 KB | Output is correct |
11 | Correct | 2 ms | 620 KB | Output is correct |
12 | Correct | 2 ms | 620 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 620 KB | Output is correct |
2 | Correct | 2 ms | 620 KB | Output is correct |
3 | Correct | 2 ms | 636 KB | Output is correct |
4 | Correct | 3 ms | 636 KB | Output is correct |
5 | Correct | 2 ms | 636 KB | Output is correct |
6 | Correct | 3 ms | 716 KB | Output is correct |
7 | Correct | 3 ms | 716 KB | Output is correct |
8 | Correct | 3 ms | 716 KB | Output is correct |
9 | Correct | 3 ms | 716 KB | Output is correct |
10 | Correct | 4 ms | 868 KB | Output is correct |
11 | Correct | 13 ms | 1032 KB | Output is correct |
12 | Correct | 14 ms | 1084 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 1124 KB | Output is correct |
2 | Correct | 71 ms | 1380 KB | Output is correct |
3 | Correct | 70 ms | 1400 KB | Output is correct |
4 | Execution timed out | 1076 ms | 2916 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |