# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
292871 | 2020-09-07T14:27:45 Z | 문홍윤(#5817) | Robogolf (ROI19_golf) | C++17 | 96 ms | 29944 KB |
#include <bits/stdc++.h> #define mp make_pair #define eb emplace_back #define F first #define S second #define all(x) x.begin(), x.end() #define svec(x) sort(all(x)) #define press(x) x.erase(unique(all(x)), x.end()); using namespace std; typedef long long LL; typedef pair<int, int> pii; typedef pair<int, LL> pil; typedef pair<LL, int> pli; typedef pair<LL, LL> pll; const int INF=1e9; const LL LLINF=1e18; const LL mod=998244353; int n, m, k; LL dp[2010][2010][2], val[1010][1010], ans; bool ch[2010][2010]; int main(){ scanf("%d %d %d", &n, &m, &k); for(int i=1; i<=k; i++){ int a, b; scanf("%d %d", &a, &b); ch[a][b]=true; scanf("%lld", &val[a][b]); } for(int i=n; i>=1; i--){ for(int j=m; j>=1; j--){ if(ch[i][j]){ dp[i][j][1]=dp[i][j][2]=val[i][j]; continue; } dp[i][j][1]=min(dp[i+1][j][2], dp[i][j+1][2]); dp[i][j][2]=max(dp[i+1][j][1], dp[i][j+1][1]); } } for(int i=1; i<=n; i++){ for(int j=1; j<=m; j++){ ans+=dp[i][j][1]+2*mod; ans%=mod; } } printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 22 ms | 20096 KB | Output is correct |
10 | Correct | 86 ms | 29944 KB | Output is correct |
11 | Correct | 88 ms | 29944 KB | Output is correct |
12 | Correct | 90 ms | 29824 KB | Output is correct |
13 | Correct | 96 ms | 29844 KB | Output is correct |
14 | Correct | 71 ms | 15172 KB | Output is correct |
15 | Correct | 76 ms | 22008 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 8320 KB | Output is correct |
18 | Correct | 4 ms | 640 KB | Output is correct |
19 | Correct | 9 ms | 10624 KB | Output is correct |
20 | Correct | 1 ms | 640 KB | Output is correct |
21 | Correct | 6 ms | 8960 KB | Output is correct |
22 | Correct | 84 ms | 29944 KB | Output is correct |
23 | Correct | 87 ms | 29688 KB | Output is correct |
24 | Correct | 81 ms | 29304 KB | Output is correct |
25 | Correct | 96 ms | 29828 KB | Output is correct |
26 | Correct | 88 ms | 29836 KB | Output is correct |
27 | Correct | 88 ms | 29944 KB | Output is correct |
28 | Correct | 1 ms | 512 KB | Output is correct |
29 | Correct | 1 ms | 384 KB | Output is correct |
30 | Correct | 1 ms | 512 KB | Output is correct |
31 | Correct | 5 ms | 5888 KB | Output is correct |
32 | Correct | 55 ms | 16632 KB | Output is correct |
33 | Correct | 62 ms | 25208 KB | Output is correct |
34 | Correct | 40 ms | 10360 KB | Output is correct |
35 | Correct | 41 ms | 9720 KB | Output is correct |
36 | Correct | 40 ms | 9088 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Incorrect | 10 ms | 768 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 2792 KB | Output is correct |
2 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 22 ms | 20096 KB | Output is correct |
10 | Correct | 86 ms | 29944 KB | Output is correct |
11 | Correct | 88 ms | 29944 KB | Output is correct |
12 | Correct | 90 ms | 29824 KB | Output is correct |
13 | Correct | 96 ms | 29844 KB | Output is correct |
14 | Correct | 71 ms | 15172 KB | Output is correct |
15 | Correct | 76 ms | 22008 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 8320 KB | Output is correct |
18 | Correct | 4 ms | 640 KB | Output is correct |
19 | Correct | 9 ms | 10624 KB | Output is correct |
20 | Correct | 1 ms | 640 KB | Output is correct |
21 | Correct | 6 ms | 8960 KB | Output is correct |
22 | Correct | 84 ms | 29944 KB | Output is correct |
23 | Correct | 87 ms | 29688 KB | Output is correct |
24 | Correct | 81 ms | 29304 KB | Output is correct |
25 | Correct | 96 ms | 29828 KB | Output is correct |
26 | Correct | 88 ms | 29836 KB | Output is correct |
27 | Correct | 88 ms | 29944 KB | Output is correct |
28 | Correct | 1 ms | 512 KB | Output is correct |
29 | Correct | 1 ms | 384 KB | Output is correct |
30 | Correct | 1 ms | 512 KB | Output is correct |
31 | Correct | 5 ms | 5888 KB | Output is correct |
32 | Correct | 55 ms | 16632 KB | Output is correct |
33 | Correct | 62 ms | 25208 KB | Output is correct |
34 | Correct | 40 ms | 10360 KB | Output is correct |
35 | Correct | 41 ms | 9720 KB | Output is correct |
36 | Correct | 40 ms | 9088 KB | Output is correct |
37 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 |
38 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 22 ms | 20096 KB | Output is correct |
10 | Correct | 86 ms | 29944 KB | Output is correct |
11 | Correct | 88 ms | 29944 KB | Output is correct |
12 | Correct | 90 ms | 29824 KB | Output is correct |
13 | Correct | 96 ms | 29844 KB | Output is correct |
14 | Correct | 71 ms | 15172 KB | Output is correct |
15 | Correct | 76 ms | 22008 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 8320 KB | Output is correct |
18 | Correct | 4 ms | 640 KB | Output is correct |
19 | Correct | 9 ms | 10624 KB | Output is correct |
20 | Correct | 1 ms | 640 KB | Output is correct |
21 | Correct | 6 ms | 8960 KB | Output is correct |
22 | Correct | 84 ms | 29944 KB | Output is correct |
23 | Correct | 87 ms | 29688 KB | Output is correct |
24 | Correct | 81 ms | 29304 KB | Output is correct |
25 | Correct | 96 ms | 29828 KB | Output is correct |
26 | Correct | 88 ms | 29836 KB | Output is correct |
27 | Correct | 88 ms | 29944 KB | Output is correct |
28 | Correct | 1 ms | 512 KB | Output is correct |
29 | Correct | 1 ms | 384 KB | Output is correct |
30 | Correct | 1 ms | 512 KB | Output is correct |
31 | Correct | 5 ms | 5888 KB | Output is correct |
32 | Correct | 55 ms | 16632 KB | Output is correct |
33 | Correct | 62 ms | 25208 KB | Output is correct |
34 | Correct | 40 ms | 10360 KB | Output is correct |
35 | Correct | 41 ms | 9720 KB | Output is correct |
36 | Correct | 40 ms | 9088 KB | Output is correct |
37 | Correct | 50 ms | 2792 KB | Output is correct |
38 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 |
39 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 22 ms | 20096 KB | Output is correct |
10 | Correct | 86 ms | 29944 KB | Output is correct |
11 | Correct | 88 ms | 29944 KB | Output is correct |
12 | Correct | 90 ms | 29824 KB | Output is correct |
13 | Correct | 96 ms | 29844 KB | Output is correct |
14 | Correct | 71 ms | 15172 KB | Output is correct |
15 | Correct | 76 ms | 22008 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 8320 KB | Output is correct |
18 | Correct | 4 ms | 640 KB | Output is correct |
19 | Correct | 9 ms | 10624 KB | Output is correct |
20 | Correct | 1 ms | 640 KB | Output is correct |
21 | Correct | 6 ms | 8960 KB | Output is correct |
22 | Correct | 84 ms | 29944 KB | Output is correct |
23 | Correct | 87 ms | 29688 KB | Output is correct |
24 | Correct | 81 ms | 29304 KB | Output is correct |
25 | Correct | 96 ms | 29828 KB | Output is correct |
26 | Correct | 88 ms | 29836 KB | Output is correct |
27 | Correct | 88 ms | 29944 KB | Output is correct |
28 | Correct | 1 ms | 512 KB | Output is correct |
29 | Correct | 1 ms | 384 KB | Output is correct |
30 | Correct | 1 ms | 512 KB | Output is correct |
31 | Correct | 5 ms | 5888 KB | Output is correct |
32 | Correct | 55 ms | 16632 KB | Output is correct |
33 | Correct | 62 ms | 25208 KB | Output is correct |
34 | Correct | 40 ms | 10360 KB | Output is correct |
35 | Correct | 41 ms | 9720 KB | Output is correct |
36 | Correct | 40 ms | 9088 KB | Output is correct |
37 | Correct | 50 ms | 2792 KB | Output is correct |
38 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 |
39 | Halted | 0 ms | 0 KB | - |