# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1040510 | 2024-08-01T06:38:23 Z | 비요뜨(#11041) | Tricks of the Trade (CEOI23_trade) | C++17 | 215 ms | 404816 KB |
#include <bits/stdc++.h> using namespace std; int n,k; long long c[250005]; long long s[250005]; typedef pair<long long,int> P; int chk[250000]; int save[250000]; long long psum[250005]; long long dp[250005][201]; long long add; const long long INF=1e18; void solve() { long long mx[201]; for(int i=1;i<=k;i++) { mx[i]=-INF; } for(int i=1;i<=n;i++) { dp[i][1]=s[i]-c[i]; for(int j=2;j<=k;j++) { dp[i][j]=mx[j-1]-psum[i]+s[i]; } for(int j=1;j<=k;j++) { mx[j]=max(mx[j],dp[i][j]+psum[i]); } } } int main() { scanf("%d %d",&n,&k); for(int i=1;i<=n;i++) { scanf("%lld",&c[i]); psum[i]=psum[i-1]+c[i]; } for(int i=1;i<=n;i++) { scanf("%lld",&s[i]); } add=0; solve(); long long ret=-INF; for(int i=1;i<=n;i++) { ret=max(ret,dp[i][k]); } printf("%lld\n",ret); for(int i=1;i<=n;i++) { printf("0"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 4440 KB | Partially correct |
2 | Partially correct | 1 ms | 4444 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 4444 KB | Partially correct |
2 | Partially correct | 1 ms | 4444 KB | Partially correct |
3 | Partially correct | 0 ms | 4444 KB | Partially correct |
4 | Partially correct | 1 ms | 6748 KB | Partially correct |
5 | Partially correct | 1 ms | 6748 KB | Partially correct |
6 | Partially correct | 1 ms | 6748 KB | Partially correct |
7 | Partially correct | 1 ms | 6748 KB | Partially correct |
8 | Partially correct | 1 ms | 6748 KB | Partially correct |
9 | Partially correct | 1 ms | 6748 KB | Partially correct |
10 | Partially correct | 1 ms | 6748 KB | Partially correct |
11 | Partially correct | 1 ms | 6744 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 4444 KB | Partially correct |
2 | Partially correct | 1 ms | 4444 KB | Partially correct |
3 | Partially correct | 0 ms | 4444 KB | Partially correct |
4 | Partially correct | 1 ms | 6748 KB | Partially correct |
5 | Partially correct | 1 ms | 6748 KB | Partially correct |
6 | Partially correct | 1 ms | 6748 KB | Partially correct |
7 | Partially correct | 1 ms | 6748 KB | Partially correct |
8 | Partially correct | 1 ms | 6748 KB | Partially correct |
9 | Partially correct | 1 ms | 6748 KB | Partially correct |
10 | Partially correct | 1 ms | 6748 KB | Partially correct |
11 | Partially correct | 1 ms | 6744 KB | Partially correct |
12 | Partially correct | 1 ms | 4444 KB | Partially correct |
13 | Partially correct | 0 ms | 4540 KB | Partially correct |
14 | Partially correct | 1 ms | 4444 KB | Partially correct |
15 | Partially correct | 1 ms | 6748 KB | Partially correct |
16 | Partially correct | 1 ms | 6748 KB | Partially correct |
17 | Partially correct | 1 ms | 6748 KB | Partially correct |
18 | Partially correct | 1 ms | 6748 KB | Partially correct |
19 | Partially correct | 1 ms | 6748 KB | Partially correct |
20 | Partially correct | 1 ms | 6748 KB | Partially correct |
21 | Partially correct | 1 ms | 6748 KB | Partially correct |
22 | Partially correct | 1 ms | 6744 KB | Partially correct |
23 | Runtime error | 8 ms | 9052 KB | Execution killed with signal 11 |
24 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 4444 KB | Partially correct |
2 | Partially correct | 120 ms | 401664 KB | Partially correct |
3 | Partially correct | 132 ms | 404816 KB | Partially correct |
4 | Partially correct | 129 ms | 404660 KB | Partially correct |
5 | Partially correct | 126 ms | 402592 KB | Partially correct |
6 | Partially correct | 122 ms | 404360 KB | Partially correct |
7 | Partially correct | 129 ms | 403840 KB | Partially correct |
8 | Partially correct | 124 ms | 404564 KB | Partially correct |
9 | Partially correct | 126 ms | 403284 KB | Partially correct |
10 | Partially correct | 121 ms | 403824 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 4444 KB | Partially correct |
2 | Partially correct | 120 ms | 401664 KB | Partially correct |
3 | Partially correct | 132 ms | 404816 KB | Partially correct |
4 | Partially correct | 129 ms | 404660 KB | Partially correct |
5 | Partially correct | 126 ms | 402592 KB | Partially correct |
6 | Partially correct | 122 ms | 404360 KB | Partially correct |
7 | Partially correct | 129 ms | 403840 KB | Partially correct |
8 | Partially correct | 124 ms | 404564 KB | Partially correct |
9 | Partially correct | 126 ms | 403284 KB | Partially correct |
10 | Partially correct | 121 ms | 403824 KB | Partially correct |
11 | Partially correct | 1 ms | 4440 KB | Partially correct |
12 | Partially correct | 124 ms | 402412 KB | Partially correct |
13 | Partially correct | 134 ms | 401752 KB | Partially correct |
14 | Partially correct | 126 ms | 401632 KB | Partially correct |
15 | Partially correct | 121 ms | 401912 KB | Partially correct |
16 | Partially correct | 120 ms | 401836 KB | Partially correct |
17 | Partially correct | 123 ms | 401744 KB | Partially correct |
18 | Partially correct | 127 ms | 402052 KB | Partially correct |
19 | Partially correct | 116 ms | 401708 KB | Partially correct |
20 | Partially correct | 120 ms | 401744 KB | Partially correct |
21 | Partially correct | 1 ms | 4440 KB | Partially correct |
22 | Partially correct | 0 ms | 4444 KB | Partially correct |
23 | Partially correct | 1 ms | 6748 KB | Partially correct |
24 | Partially correct | 1 ms | 6748 KB | Partially correct |
25 | Partially correct | 1 ms | 6748 KB | Partially correct |
26 | Partially correct | 1 ms | 6580 KB | Partially correct |
27 | Partially correct | 1 ms | 6748 KB | Partially correct |
28 | Partially correct | 1 ms | 6748 KB | Partially correct |
29 | Partially correct | 1 ms | 6748 KB | Partially correct |
30 | Partially correct | 1 ms | 6748 KB | Partially correct |
31 | Partially correct | 183 ms | 401724 KB | Partially correct |
32 | Partially correct | 141 ms | 401732 KB | Partially correct |
33 | Partially correct | 180 ms | 401744 KB | Partially correct |
34 | Partially correct | 186 ms | 401628 KB | Partially correct |
35 | Partially correct | 172 ms | 403032 KB | Partially correct |
36 | Partially correct | 215 ms | 402772 KB | Partially correct |
37 | Partially correct | 172 ms | 402512 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 4440 KB | Partially correct |
2 | Partially correct | 1 ms | 4444 KB | Partially correct |
3 | Partially correct | 0 ms | 4444 KB | Partially correct |
4 | Partially correct | 1 ms | 4444 KB | Partially correct |
5 | Partially correct | 0 ms | 4444 KB | Partially correct |
6 | Partially correct | 1 ms | 6748 KB | Partially correct |
7 | Partially correct | 1 ms | 6748 KB | Partially correct |
8 | Partially correct | 1 ms | 6748 KB | Partially correct |
9 | Partially correct | 1 ms | 6748 KB | Partially correct |
10 | Partially correct | 1 ms | 6748 KB | Partially correct |
11 | Partially correct | 1 ms | 6748 KB | Partially correct |
12 | Partially correct | 1 ms | 6748 KB | Partially correct |
13 | Partially correct | 1 ms | 6744 KB | Partially correct |
14 | Partially correct | 1 ms | 4444 KB | Partially correct |
15 | Partially correct | 0 ms | 4540 KB | Partially correct |
16 | Partially correct | 1 ms | 4444 KB | Partially correct |
17 | Partially correct | 1 ms | 6748 KB | Partially correct |
18 | Partially correct | 1 ms | 6748 KB | Partially correct |
19 | Partially correct | 1 ms | 6748 KB | Partially correct |
20 | Partially correct | 1 ms | 6748 KB | Partially correct |
21 | Partially correct | 1 ms | 6748 KB | Partially correct |
22 | Partially correct | 1 ms | 6748 KB | Partially correct |
23 | Partially correct | 1 ms | 6748 KB | Partially correct |
24 | Partially correct | 1 ms | 6744 KB | Partially correct |
25 | Runtime error | 8 ms | 9052 KB | Execution killed with signal 11 |
26 | Halted | 0 ms | 0 KB | - |