답안 #1088656

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1088656 2024-09-14T18:09:12 Z xnqs 금 캐기 (IZhO14_divide) C++17
48 / 100
1000 ms 2392 KB
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <cstring>

int x;
int diff_coords[100005];
int coords[100005];
int arr1[100005];
int arr2[100005];

int main() {
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);

	std::cin >> x;
	for (int i = 1; i <= x; i++) {
		int a, b, c;
		std::cin >> a >> b >> c;
		coords[i] = a;
		diff_coords[i] = a - diff_coords[i-1];
		arr1[i] = c;
		arr2[i] = b;
	}

	int64_t ans = 0;
	for (int i = 1; i <= x; i++) {
		int64_t gold = arr2[i];
		int64_t diff = arr1[i];
		ans = std::max(ans,gold);
		for (int j = i-1; j >= 1; j--) {
			gold += arr2[j];
			diff += arr1[j];
			diff -= coords[j+1] - coords[j];
			if (diff>=0) {
				ans = std::max(ans,gold);
			}
		}
	}

	std::cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 472 KB Output is correct
18 Correct 2 ms 512 KB Output is correct
19 Correct 1 ms 508 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 3 ms 348 KB Output is correct
23 Correct 13 ms 656 KB Output is correct
24 Correct 14 ms 668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 472 KB Output is correct
18 Correct 2 ms 512 KB Output is correct
19 Correct 1 ms 508 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 3 ms 348 KB Output is correct
23 Correct 13 ms 656 KB Output is correct
24 Correct 14 ms 668 KB Output is correct
25 Correct 27 ms 604 KB Output is correct
26 Correct 54 ms 604 KB Output is correct
27 Correct 51 ms 604 KB Output is correct
28 Execution timed out 1024 ms 2392 KB Time limit exceeded
29 Halted 0 ms 0 KB -