Submission #218991

# Submission time Handle Problem Language Result Execution time Memory
218991 2020-04-03T10:52:59 Z pavement Cloud Computing (CEOI18_clo) C++17
54 / 100
650 ms 2332 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][100005];
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 <= 100000; j++)
			if (0 <= j + get<1>(V[i - 1]) && j + get<1>(V[i - 1]) <= 100000) 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() {
      ^
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1920 KB Output is correct
2 Correct 6 ms 1920 KB Output is correct
3 Correct 21 ms 1792 KB Output is correct
4 Correct 36 ms 1920 KB Output is correct
5 Correct 306 ms 2092 KB Output is correct
6 Correct 301 ms 2048 KB Output is correct
7 Correct 312 ms 2168 KB Output is correct
8 Correct 308 ms 2124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1920 KB Output is correct
2 Correct 7 ms 1920 KB Output is correct
3 Correct 21 ms 1920 KB Output is correct
4 Correct 23 ms 1920 KB Output is correct
5 Correct 157 ms 2040 KB Output is correct
6 Correct 143 ms 1920 KB Output is correct
7 Correct 318 ms 2116 KB Output is correct
8 Correct 324 ms 2048 KB Output is correct
9 Incorrect 317 ms 2112 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1920 KB Output is correct
2 Correct 10 ms 1920 KB Output is correct
3 Correct 43 ms 1920 KB Output is correct
4 Correct 32 ms 1920 KB Output is correct
5 Correct 67 ms 1920 KB Output is correct
6 Correct 60 ms 1920 KB Output is correct
7 Correct 80 ms 1920 KB Output is correct
8 Correct 89 ms 2040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 1920 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1920 KB Output is correct
2 Correct 29 ms 1968 KB Output is correct
3 Correct 144 ms 2028 KB Output is correct
4 Correct 312 ms 2120 KB Output is correct
5 Correct 650 ms 2332 KB Output is correct
6 Correct 612 ms 2292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1920 KB Output is correct
2 Correct 6 ms 1920 KB Output is correct
3 Correct 21 ms 1792 KB Output is correct
4 Correct 36 ms 1920 KB Output is correct
5 Correct 306 ms 2092 KB Output is correct
6 Correct 301 ms 2048 KB Output is correct
7 Correct 312 ms 2168 KB Output is correct
8 Correct 308 ms 2124 KB Output is correct
9 Correct 6 ms 1920 KB Output is correct
10 Correct 7 ms 1920 KB Output is correct
11 Correct 21 ms 1920 KB Output is correct
12 Correct 23 ms 1920 KB Output is correct
13 Correct 157 ms 2040 KB Output is correct
14 Correct 143 ms 1920 KB Output is correct
15 Correct 318 ms 2116 KB Output is correct
16 Correct 324 ms 2048 KB Output is correct
17 Incorrect 317 ms 2112 KB Output isn't correct