답안 #218989

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
218989 2020-04-03T10:51:24 Z pavement Cloud Computing (CEOI18_clo) C++17
54 / 100
1176 ms 3840 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define ppb pop_back
#define eb emplace_back
typedef long double ld;

int N, M, f, c, v, dp[2][200005];
vector<tuple<int, int, int> > F, S, V;

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N;
	for (int i = 1, c, f, v; i <= N; i++) {
		cin >> c >> f >> v;
		F.eb(-f, c, -v);
	}
	cin >> M;
	for (int i = 1; i <= M; i++) {
		cin >> c >> f >> v;
		S.eb(-f, -c, v);
	}
	sort(F.begin(), F.end());
	sort(S.begin(), S.end());
	merge(F.begin(), F.end(), S.begin(), S.end(), back_inserter(V));
	for (int i = N + M; i >= 1; i--)
		for (int j = 0; j <= 200000; j++)
			if (j + get<1>(V[i - 1]) >= 0) dp[i & 1][j] = max(dp[1 - (i & 1)][j + get<1>(V[i - 1])] + get<2>(V[i - 1]), dp[1 - (i & 1)][j]);
			else dp[i & 1][j] = dp[1 - (i & 1)][j];
	cout << dp[1][0] << '\n';
}

Compilation message

clo.cpp:14:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 3456 KB Output is correct
2 Correct 7 ms 3456 KB Output is correct
3 Correct 38 ms 3456 KB Output is correct
4 Correct 67 ms 3456 KB Output is correct
5 Correct 587 ms 3584 KB Output is correct
6 Correct 581 ms 3836 KB Output is correct
7 Correct 610 ms 3704 KB Output is correct
8 Correct 595 ms 3712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 3456 KB Output is correct
2 Correct 11 ms 3456 KB Output is correct
3 Correct 38 ms 3456 KB Output is correct
4 Correct 37 ms 3456 KB Output is correct
5 Correct 279 ms 3584 KB Output is correct
6 Correct 290 ms 3704 KB Output is correct
7 Correct 600 ms 3712 KB Output is correct
8 Correct 609 ms 3832 KB Output is correct
9 Incorrect 597 ms 3704 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 3456 KB Output is correct
2 Correct 15 ms 3456 KB Output is correct
3 Correct 59 ms 3456 KB Output is correct
4 Correct 59 ms 3456 KB Output is correct
5 Correct 116 ms 3456 KB Output is correct
6 Correct 112 ms 3456 KB Output is correct
7 Correct 151 ms 3456 KB Output is correct
8 Correct 153 ms 3456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 3432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3456 KB Output is correct
2 Correct 54 ms 3456 KB Output is correct
3 Correct 247 ms 3600 KB Output is correct
4 Correct 598 ms 3704 KB Output is correct
5 Correct 1176 ms 3840 KB Output is correct
6 Correct 1176 ms 3712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 3456 KB Output is correct
2 Correct 7 ms 3456 KB Output is correct
3 Correct 38 ms 3456 KB Output is correct
4 Correct 67 ms 3456 KB Output is correct
5 Correct 587 ms 3584 KB Output is correct
6 Correct 581 ms 3836 KB Output is correct
7 Correct 610 ms 3704 KB Output is correct
8 Correct 595 ms 3712 KB Output is correct
9 Correct 7 ms 3456 KB Output is correct
10 Correct 11 ms 3456 KB Output is correct
11 Correct 38 ms 3456 KB Output is correct
12 Correct 37 ms 3456 KB Output is correct
13 Correct 279 ms 3584 KB Output is correct
14 Correct 290 ms 3704 KB Output is correct
15 Correct 600 ms 3712 KB Output is correct
16 Correct 609 ms 3832 KB Output is correct
17 Incorrect 597 ms 3704 KB Output isn't correct