답안 #308184

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
308184 2020-09-30T08:39:38 Z shrek12357 금 캐기 (IZhO14_divide) C++14
48 / 100
1000 ms 5740 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include <stack>
using namespace std;
#define ll long long
 
const int MAXN = 1e5+5;
#define INF 100000000
 
int main() {
	int n;
	cin >> n;
	ll best = 0;
	vector<ll> pos;
	ll gold[MAXN];
	gold[0] = 0;
	ll energy[MAXN];
	energy[0] = 0;
	for (int i = 0; i < n; i++) {
		ll x, g, d;
		cin >> x >> g >> d;
		pos.push_back(x);
		gold[i + 1] = gold[i] + g;
		energy[i + 1] = energy[i] + d;
		best = max(best, g);
	}
	for (int i = 1; i <= n; i++) {
		for (int j = n; j >= i + 1; j--) {
			if (pos[j - 1] - pos[i - 1] <= energy[j] - energy[i - 1]) {
				best = max(best, gold[j] - gold[i - 1]);
              	break;
			}
		}
	}
	cout << best << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 4 ms 384 KB Output is correct
22 Correct 6 ms 384 KB Output is correct
23 Correct 24 ms 512 KB Output is correct
24 Correct 24 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 4 ms 384 KB Output is correct
22 Correct 6 ms 384 KB Output is correct
23 Correct 24 ms 512 KB Output is correct
24 Correct 24 ms 512 KB Output is correct
25 Correct 7 ms 512 KB Output is correct
26 Correct 13 ms 640 KB Output is correct
27 Correct 18 ms 640 KB Output is correct
28 Correct 99 ms 1648 KB Output is correct
29 Correct 115 ms 2928 KB Output is correct
30 Correct 252 ms 5740 KB Output is correct
31 Correct 173 ms 4456 KB Output is correct
32 Correct 177 ms 4584 KB Output is correct
33 Correct 165 ms 4460 KB Output is correct
34 Execution timed out 1082 ms 4424 KB Time limit exceeded
35 Halted 0 ms 0 KB -