Submission #213172

# Submission time Handle Problem Language Result Execution time Memory
213172 2020-03-25T06:38:21 Z islingr Divide and conquer (IZhO14_divide) C++14
48 / 100
1000 ms 6392 KB
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define per(i, a, b) for (auto i = (b) - 1; i >= (a); --i)
#define trav(x, v) for (auto &x : v)
#define ff first
#define ss second

using ll = int64_t;

template<class T> bool ckmin(T &a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T &a, const T& b) { return a < b ? a = b, 1 : 0; }

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n; cin >> n;
	vector<ll> x(n), g(n + 1), e(n + 1), diff(n);
	rep(i, 0, n) {
		cin >> x[i] >> g[i + 1] >> e[i + 1];
		g[i + 1] += g[i];
		e[i + 1] += e[i];
		diff[i] = x[i] - e[i];
	}

	ll ans = 0;
	rep(i, 0, n) {
		int j = 0;
		for (; j < i; ++j)
			if (x[i] - e[i + 1] <= diff[j])
				break;
		ckmax(ans, g[i + 1] - g[j]);
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 6 ms 384 KB Output is correct
22 Correct 7 ms 512 KB Output is correct
23 Correct 14 ms 640 KB Output is correct
24 Correct 14 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 6 ms 384 KB Output is correct
22 Correct 7 ms 512 KB Output is correct
23 Correct 14 ms 640 KB Output is correct
24 Correct 14 ms 640 KB Output is correct
25 Correct 6 ms 640 KB Output is correct
26 Correct 8 ms 768 KB Output is correct
27 Correct 8 ms 896 KB Output is correct
28 Correct 25 ms 2944 KB Output is correct
29 Correct 27 ms 3200 KB Output is correct
30 Correct 52 ms 6392 KB Output is correct
31 Correct 40 ms 5240 KB Output is correct
32 Correct 42 ms 5368 KB Output is correct
33 Correct 40 ms 5116 KB Output is correct
34 Execution timed out 1099 ms 5112 KB Time limit exceeded
35 Halted 0 ms 0 KB -