제출 #218991

#제출 시각아이디문제언어결과실행 시간메모리
218991pavementCloud Computing (CEOI18_clo)C++17
54 / 100
650 ms2332 KiB
#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';
}

컴파일 시 표준 에러 (stderr) 메시지

clo.cpp:14:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...