답안 #17927

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17927 2016-01-13T08:36:54 Z Adilkhan 금 캐기 (IZhO14_divide) C++
48 / 100
1000 ms 13448 KB
#include <bits/stdc++.h>

#define pb push_back
#define endl "\n"
#define mp make_pair 
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fname ""
#define sz(x) (int)(x.size())

typedef long long ll;

using namespace std;

const ll N = (ll)(5e5) + 322;
const ll INF = (ll)(1e9);
const ll mod = (ll)(1e9) + 7;
const double eps = 1e-9;

ll n, x[N], g[N], e[N], mx, gsum;

int main () {
	//ios_base :: sync_with_stdio (false); cin.tie(0);
	//freopen(fname".in", "r", stdin);
	//freopen(fname".out", "w", stdout);
	scanf("%lld", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld%lld%lld", &x[i], &g[i], &e[i]);	
	}	
	for (int i = 1; i <= n; ++i) {
		ll sum = 0, gsum = 0;
		for (int j = i; j <= n; ++j) {
			sum += e[j];
			gsum += g[j];
			if (sum >= (x[j] - x[i])) {
				mx = max(mx, gsum);
			}		
		}
	}
	cout << mx;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 13448 KB Output is correct
2 Correct 0 ms 13448 KB Output is correct
3 Correct 0 ms 13448 KB Output is correct
4 Correct 0 ms 13448 KB Output is correct
5 Correct 0 ms 13448 KB Output is correct
6 Correct 0 ms 13448 KB Output is correct
7 Correct 0 ms 13448 KB Output is correct
8 Correct 0 ms 13448 KB Output is correct
9 Correct 0 ms 13448 KB Output is correct
10 Correct 0 ms 13448 KB Output is correct
11 Correct 0 ms 13448 KB Output is correct
12 Correct 0 ms 13448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 13448 KB Output is correct
2 Correct 0 ms 13448 KB Output is correct
3 Correct 0 ms 13448 KB Output is correct
4 Correct 0 ms 13448 KB Output is correct
5 Correct 0 ms 13448 KB Output is correct
6 Correct 0 ms 13448 KB Output is correct
7 Correct 0 ms 13448 KB Output is correct
8 Correct 0 ms 13448 KB Output is correct
9 Correct 0 ms 13448 KB Output is correct
10 Correct 5 ms 13448 KB Output is correct
11 Correct 20 ms 13448 KB Output is correct
12 Correct 22 ms 13448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 13448 KB Output is correct
2 Correct 114 ms 13448 KB Output is correct
3 Correct 116 ms 13448 KB Output is correct
4 Execution timed out 1000 ms 13444 KB Program timed out
5 Halted 0 ms 0 KB -