답안 #169119

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169119 2019-12-18T12:50:13 Z LinusTorvaldsFan 금 캐기 (IZhO14_divide) C++14
48 / 100
1000 ms 1912 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++) {
		ll 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 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 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 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 380 KB Output is correct
9 Correct 4 ms 404 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 21 ms 504 KB Output is correct
12 Correct 21 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 376 KB Output is correct
2 Correct 73 ms 548 KB Output is correct
3 Correct 73 ms 548 KB Output is correct
4 Execution timed out 1077 ms 1912 KB Time limit exceeded
5 Halted 0 ms 0 KB -