답안 #169118

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169118 2019-12-18T12:49:19 Z LinusTorvaldsFan 금 캐기 (IZhO14_divide) C++14
17 / 100
67 ms 632 KB
#include <iostream>
#include <algorithm>

using namespace std;

const int maxn = 100000 + 7;

typedef long long ll;

int x[maxn];
int g[maxn];
int d[maxn];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> g[i] >> d[i];
	}
	ll gold = 0;
	for (int i = 0; i < n; i++) {
		int supply = 0;
		ll cur = 0;
		for (int j = i; j < n; j++) {
			supply += d[j];
			cur += g[j];
			if (x[j] - x[i] <= supply) {
				gold = max(gold, cur);
			}
		}
	}
	cout << gold;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 380 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 432 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Incorrect 5 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 504 KB Output is correct
2 Correct 67 ms 628 KB Output is correct
3 Incorrect 62 ms 632 KB Output isn't correct
4 Halted 0 ms 0 KB -