답안 #17898

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17898 2016-01-13T06:38:44 Z chrome 금 캐기 (IZhO14_divide) C++
48 / 100
1000 ms 6416 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define foreach(it, S) for (__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define all(x) x.begin(), x.end()
#define endl '\n'
#define _ ios_base :: sync_with_stdio(false); cin.tie(NULL);

#ifdef inputf
	#define fname ""
#else
	#define fname "" // <- Here
#endif

const double eps = 1e-9;
const int MaxN = int(2e5) + 256;
const int MOD = int(1e9) + 7;

template <typename T> inline T gcd(T a, T b) {
	return b ? gcd (b, a % b) : a;
}

inline bool Palindrome(const string& s) {
	return equal(s.begin(), s.end(), s.rbegin());
}

ll x[MaxN], g[MaxN], e[MaxN];

int main() { // _
	#ifdef lcl
		freopen(fname".in", "r", stdin);
		freopen(fname".out", "w", stdout);
	#endif

	int n; scanf("%d", &n);

	for (int i = 1; i <= n; ++i) {
		scanf("%lld%lld%lld", x + i, g + i, e + i);
		e[i] += e[i - 1];
		g[i] += g[i - 1];
	}

	ll res = 0;
	
	for (int i = 1; i <= n; ++i)
		for (int j = i; j <= n; ++j) {
			if (e[j] - e[i - 1] >= x[j] - x[i]) {
				res = max(res, g[j] - g[i - 1]);
			}
		}
	
	printf("%lld", res);
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 6416 KB Output is correct
2 Correct 0 ms 6416 KB Output is correct
3 Correct 0 ms 6416 KB Output is correct
4 Correct 0 ms 6416 KB Output is correct
5 Correct 0 ms 6416 KB Output is correct
6 Correct 0 ms 6416 KB Output is correct
7 Correct 0 ms 6416 KB Output is correct
8 Correct 0 ms 6416 KB Output is correct
9 Correct 0 ms 6416 KB Output is correct
10 Correct 0 ms 6416 KB Output is correct
11 Correct 0 ms 6416 KB Output is correct
12 Correct 0 ms 6416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 6416 KB Output is correct
2 Correct 0 ms 6416 KB Output is correct
3 Correct 0 ms 6416 KB Output is correct
4 Correct 0 ms 6416 KB Output is correct
5 Correct 0 ms 6416 KB Output is correct
6 Correct 0 ms 6416 KB Output is correct
7 Correct 0 ms 6416 KB Output is correct
8 Correct 0 ms 6416 KB Output is correct
9 Correct 3 ms 6416 KB Output is correct
10 Correct 4 ms 6416 KB Output is correct
11 Correct 20 ms 6416 KB Output is correct
12 Correct 20 ms 6416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 6416 KB Output is correct
2 Correct 108 ms 6416 KB Output is correct
3 Correct 109 ms 6416 KB Output is correct
4 Execution timed out 1000 ms 6412 KB Program timed out
5 Halted 0 ms 0 KB -