# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
165396 | 2019-11-26T19:51:10 Z | Lawliet | Cloud Computing (CEOI18_clo) | C++14 | 520 ms | 2040 KB |
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; typedef long long int lli; const int MAXS = 50*2000 + 10; const lli INF = 1000000000000000000LL; int n, m; lli dp[MAXS][2]; int main() { scanf("%d",&n); for(int i = 1 ; i < MAXS ; i++) { dp[i][0] = INF; dp[i][1] = -INF; } for(int i = 1 ; i <= n ; i++) { int c, f, v; scanf("%d %d %d",&c,&f,&v); for(int j = MAXS - 1 ; j >= c ; j--) dp[ j ][0] = min( dp[ j - c ][0] + v , dp[ j ][0] ); } scanf("%d",&m); for(int i = 1 ; i <= m ; i++) { int c, f, v; scanf("%d %d %d",&c,&f,&v); for(int j = MAXS - 1 ; j >= c ; j--) dp[ j ][1] = max( dp[ j - c ][1] + v , dp[ j ][1] ); } lli ans = 0; lli mn = INF; for(int i = MAXS - 1 ; i >= 0 ; i--) { mn = min( mn , dp[i][0] ); ans = max( ans , dp[i][1] - mn ); } printf("%lld\n",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1912 KB | Output is correct |
2 | Correct | 3 ms | 1912 KB | Output is correct |
3 | Correct | 17 ms | 1912 KB | Output is correct |
4 | Correct | 31 ms | 1912 KB | Output is correct |
5 | Incorrect | 246 ms | 2012 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1912 KB | Output is correct |
2 | Incorrect | 5 ms | 1932 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 1964 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1912 KB | Output is correct |
2 | Correct | 6 ms | 1912 KB | Output is correct |
3 | Correct | 197 ms | 1936 KB | Output is correct |
4 | Correct | 235 ms | 1940 KB | Output is correct |
5 | Correct | 488 ms | 1976 KB | Output is correct |
6 | Correct | 520 ms | 2036 KB | Output is correct |
7 | Correct | 514 ms | 2040 KB | Output is correct |
8 | Correct | 507 ms | 2040 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1912 KB | Output is correct |
2 | Incorrect | 25 ms | 1912 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1912 KB | Output is correct |
2 | Correct | 3 ms | 1912 KB | Output is correct |
3 | Correct | 17 ms | 1912 KB | Output is correct |
4 | Correct | 31 ms | 1912 KB | Output is correct |
5 | Incorrect | 246 ms | 2012 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |