# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
824371 | 2023-08-14T04:47:50 Z | 반딧불(#10358) | Robogolf (ROI19_golf) | C++17 | 54 ms | 23352 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 998244353; int n, m, k; int px[100002], py[100002]; ll pc[100002]; ll DP[2002][2002][2]; int main(){ scanf("%d %d %d", &n, &m, &k); for(int i=1; i<=k; i++){ scanf("%d %d %lld", &px[i], &py[i], &pc[i]); DP[px[i]][py[i]][0] = DP[px[i]][py[i]][1] = pc[i]; } for(int i=n+1; i>=1; i--){ for(int j=m+1; j>=1; j--){ if(i==n+1 || j==m+1){ DP[i][j][0] = DP[i][j][1] = 0; continue; } if(DP[i][j][0]) continue; DP[i][j][0] = min(DP[i+1][j][1], DP[i][j+1][1]); DP[i][j][1] = max(DP[i+1][j][0], DP[i][j+1][0]); //printf("%d %d: %lld %lld\n", i, j, DP[i][j][0], DP[i][j][1]); } } ll ans = 0; for(int i=1; i<=n; i++){ for(int j=1; j<=m; j++){ ans = (ans + DP[i][j][0] + MOD*2) % MOD; } } printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 17 ms | 19920 KB | Output is correct |
10 | Correct | 46 ms | 23244 KB | Output is correct |
11 | Correct | 45 ms | 23280 KB | Output is correct |
12 | Correct | 46 ms | 23352 KB | Output is correct |
13 | Correct | 45 ms | 23332 KB | Output is correct |
14 | Correct | 36 ms | 13396 KB | Output is correct |
15 | Correct | 44 ms | 15396 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 2 ms | 4436 KB | Output is correct |
18 | Correct | 2 ms | 628 KB | Output is correct |
19 | Correct | 3 ms | 4688 KB | Output is correct |
20 | Correct | 1 ms | 440 KB | Output is correct |
21 | Correct | 3 ms | 4548 KB | Output is correct |
22 | Correct | 48 ms | 23244 KB | Output is correct |
23 | Correct | 44 ms | 23288 KB | Output is correct |
24 | Correct | 54 ms | 23308 KB | Output is correct |
25 | Correct | 50 ms | 23300 KB | Output is correct |
26 | Correct | 44 ms | 23312 KB | Output is correct |
27 | Correct | 43 ms | 23292 KB | Output is correct |
28 | Correct | 0 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 2 ms | 4436 KB | Output is correct |
32 | Correct | 35 ms | 13268 KB | Output is correct |
33 | Correct | 35 ms | 19620 KB | Output is correct |
34 | Incorrect | 24 ms | 8320 KB | Output isn't correct |
35 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Incorrect | 5 ms | 852 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 28 ms | 3396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 17 ms | 19920 KB | Output is correct |
10 | Correct | 46 ms | 23244 KB | Output is correct |
11 | Correct | 45 ms | 23280 KB | Output is correct |
12 | Correct | 46 ms | 23352 KB | Output is correct |
13 | Correct | 45 ms | 23332 KB | Output is correct |
14 | Correct | 36 ms | 13396 KB | Output is correct |
15 | Correct | 44 ms | 15396 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 2 ms | 4436 KB | Output is correct |
18 | Correct | 2 ms | 628 KB | Output is correct |
19 | Correct | 3 ms | 4688 KB | Output is correct |
20 | Correct | 1 ms | 440 KB | Output is correct |
21 | Correct | 3 ms | 4548 KB | Output is correct |
22 | Correct | 48 ms | 23244 KB | Output is correct |
23 | Correct | 44 ms | 23288 KB | Output is correct |
24 | Correct | 54 ms | 23308 KB | Output is correct |
25 | Correct | 50 ms | 23300 KB | Output is correct |
26 | Correct | 44 ms | 23312 KB | Output is correct |
27 | Correct | 43 ms | 23292 KB | Output is correct |
28 | Correct | 0 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 2 ms | 4436 KB | Output is correct |
32 | Correct | 35 ms | 13268 KB | Output is correct |
33 | Correct | 35 ms | 19620 KB | Output is correct |
34 | Incorrect | 24 ms | 8320 KB | Output isn't correct |
35 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 340 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 340 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 17 ms | 19920 KB | Output is correct |
10 | Correct | 46 ms | 23244 KB | Output is correct |
11 | Correct | 45 ms | 23280 KB | Output is correct |
12 | Correct | 46 ms | 23352 KB | Output is correct |
13 | Correct | 45 ms | 23332 KB | Output is correct |
14 | Correct | 36 ms | 13396 KB | Output is correct |
15 | Correct | 44 ms | 15396 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 2 ms | 4436 KB | Output is correct |
18 | Correct | 2 ms | 628 KB | Output is correct |
19 | Correct | 3 ms | 4688 KB | Output is correct |
20 | Correct | 1 ms | 440 KB | Output is correct |
21 | Correct | 3 ms | 4548 KB | Output is correct |
22 | Correct | 48 ms | 23244 KB | Output is correct |
23 | Correct | 44 ms | 23288 KB | Output is correct |
24 | Correct | 54 ms | 23308 KB | Output is correct |
25 | Correct | 50 ms | 23300 KB | Output is correct |
26 | Correct | 44 ms | 23312 KB | Output is correct |
27 | Correct | 43 ms | 23292 KB | Output is correct |
28 | Correct | 0 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 2 ms | 4436 KB | Output is correct |
32 | Correct | 35 ms | 13268 KB | Output is correct |
33 | Correct | 35 ms | 19620 KB | Output is correct |
34 | Incorrect | 24 ms | 8320 KB | Output isn't correct |
35 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 340 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 17 ms | 19920 KB | Output is correct |
10 | Correct | 46 ms | 23244 KB | Output is correct |
11 | Correct | 45 ms | 23280 KB | Output is correct |
12 | Correct | 46 ms | 23352 KB | Output is correct |
13 | Correct | 45 ms | 23332 KB | Output is correct |
14 | Correct | 36 ms | 13396 KB | Output is correct |
15 | Correct | 44 ms | 15396 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 2 ms | 4436 KB | Output is correct |
18 | Correct | 2 ms | 628 KB | Output is correct |
19 | Correct | 3 ms | 4688 KB | Output is correct |
20 | Correct | 1 ms | 440 KB | Output is correct |
21 | Correct | 3 ms | 4548 KB | Output is correct |
22 | Correct | 48 ms | 23244 KB | Output is correct |
23 | Correct | 44 ms | 23288 KB | Output is correct |
24 | Correct | 54 ms | 23308 KB | Output is correct |
25 | Correct | 50 ms | 23300 KB | Output is correct |
26 | Correct | 44 ms | 23312 KB | Output is correct |
27 | Correct | 43 ms | 23292 KB | Output is correct |
28 | Correct | 0 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 2 ms | 4436 KB | Output is correct |
32 | Correct | 35 ms | 13268 KB | Output is correct |
33 | Correct | 35 ms | 19620 KB | Output is correct |
34 | Incorrect | 24 ms | 8320 KB | Output isn't correct |
35 | Halted | 0 ms | 0 KB | - |