# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1089852 | 2024-09-17T10:04:52 Z | KALARRY | Tricks of the Trade (CEOI23_trade) | C++14 | 42 ms | 11348 KB |
//chockolateman #include<bits/stdc++.h> using namespace std; long long N,K,a[250005],b[250005],dp[250005][2]; int main() { scanf("%lld%lld",&N,&K); for(long long i = 1 ; i <= N ; i++) scanf("%lld",&a[i]); for(long long i = 1 ; i <= N ; i++) scanf("%lld",&b[i]); for(long long j = 1 ; j <= K ; j++) dp[0][j%2] = -1e9; for(long long j = 1 ; j <= K ; j++) { for(long long i = 1 ; i <= N ; i++) dp[i][j%2] = max(dp[i-1][j%2] - a[i],dp[i-1][(j-1)%2] + b[i] - a[i]); } long long ans = -1e9; for(long long i = 1 ; i <= N ; i++) ans = max(ans,dp[i][K%2]); printf("%lld\n",ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 348 KB | Partially correct |
2 | Partially correct | 0 ms | 348 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 348 KB | Partially correct |
2 | Partially correct | 0 ms | 348 KB | Partially correct |
3 | Partially correct | 1 ms | 348 KB | Partially correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 348 KB | Partially correct |
2 | Partially correct | 0 ms | 348 KB | Partially correct |
3 | Partially correct | 1 ms | 348 KB | Partially correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 344 KB | Partially correct |
2 | Partially correct | 26 ms | 9076 KB | Partially correct |
3 | Partially correct | 34 ms | 11092 KB | Partially correct |
4 | Partially correct | 42 ms | 11344 KB | Partially correct |
5 | Partially correct | 35 ms | 11176 KB | Partially correct |
6 | Partially correct | 32 ms | 10832 KB | Partially correct |
7 | Partially correct | 33 ms | 10204 KB | Partially correct |
8 | Partially correct | 35 ms | 11148 KB | Partially correct |
9 | Partially correct | 28 ms | 9564 KB | Partially correct |
10 | Partially correct | 30 ms | 10276 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 344 KB | Partially correct |
2 | Partially correct | 26 ms | 9076 KB | Partially correct |
3 | Partially correct | 34 ms | 11092 KB | Partially correct |
4 | Partially correct | 42 ms | 11344 KB | Partially correct |
5 | Partially correct | 35 ms | 11176 KB | Partially correct |
6 | Partially correct | 32 ms | 10832 KB | Partially correct |
7 | Partially correct | 33 ms | 10204 KB | Partially correct |
8 | Partially correct | 35 ms | 11148 KB | Partially correct |
9 | Partially correct | 28 ms | 9564 KB | Partially correct |
10 | Partially correct | 30 ms | 10276 KB | Partially correct |
11 | Partially correct | 0 ms | 348 KB | Partially correct |
12 | Partially correct | 25 ms | 9108 KB | Partially correct |
13 | Partially correct | 35 ms | 11096 KB | Partially correct |
14 | Partially correct | 34 ms | 11348 KB | Partially correct |
15 | Partially correct | 34 ms | 11092 KB | Partially correct |
16 | Partially correct | 32 ms | 10836 KB | Partially correct |
17 | Partially correct | 32 ms | 10320 KB | Partially correct |
18 | Partially correct | 34 ms | 11092 KB | Partially correct |
19 | Partially correct | 28 ms | 9576 KB | Partially correct |
20 | Partially correct | 31 ms | 10324 KB | Partially correct |
21 | Partially correct | 1 ms | 348 KB | Partially correct |
22 | Partially correct | 0 ms | 348 KB | Partially correct |
23 | Incorrect | 0 ms | 348 KB | Output isn't correct |
24 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 348 KB | Partially correct |
2 | Partially correct | 0 ms | 348 KB | Partially correct |
3 | Partially correct | 0 ms | 348 KB | Partially correct |
4 | Partially correct | 0 ms | 348 KB | Partially correct |
5 | Partially correct | 1 ms | 348 KB | Partially correct |
6 | Incorrect | 0 ms | 348 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |