Submission #824514

# Submission time Handle Problem Language Result Execution time Memory
824514 2023-08-14T07:16:42 Z 이성호(#10360) Robogolf (ROI19_golf) C++17
20 / 100
85 ms 13400 KB
#include <iostream>
using namespace std;
const int mod = 998'244'353;
const int inf = 2e9;
int N, M, K, a[1005][1005], dp[1005][1005][2];
bool in[1005][1005];
int main()
{
    cin >> N >> M >> K;
    for (int i = 0; i < K; i++) {
        int r, c, v; cin >> r >> c >> v;
        in[r][c] = true; a[r][c] = v;
    }
    for (int i = N; i >= 1; i--) {
        for (int j = M; j >= 1; j--) {
            if (in[i][j]) dp[i][j][0] = dp[i][j][1] = a[i][j];
            else {
                dp[i][j][1] = max(dp[i+1][j][0], dp[i][j+1][0]);
                dp[i][j][0] = min(dp[i+1][j][1], dp[i][j+1][1]);
            }
        }
    }
    long long ans = 0;
    for (int i = 1; i <= N; i++) for (int j = 1; j <= M; j++) ans += dp[i][j][0];
    cout << (ans % mod + mod) % mod << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 7 ms 8148 KB Output is correct
10 Correct 72 ms 13336 KB Output is correct
11 Correct 72 ms 13304 KB Output is correct
12 Correct 76 ms 13400 KB Output is correct
13 Correct 85 ms 13260 KB Output is correct
14 Correct 67 ms 6876 KB Output is correct
15 Correct 73 ms 13360 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 3 ms 7508 KB Output is correct
18 Correct 4 ms 368 KB Output is correct
19 Correct 7 ms 9172 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 4 ms 7892 KB Output is correct
22 Correct 71 ms 13300 KB Output is correct
23 Correct 70 ms 13288 KB Output is correct
24 Correct 72 ms 13260 KB Output is correct
25 Correct 79 ms 13276 KB Output is correct
26 Correct 69 ms 13316 KB Output is correct
27 Correct 71 ms 13320 KB Output is correct
28 Correct 0 ms 340 KB Output is correct
29 Correct 1 ms 428 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 3 ms 5588 KB Output is correct
32 Correct 63 ms 9044 KB Output is correct
33 Correct 83 ms 11952 KB Output is correct
34 Correct 56 ms 6432 KB Output is correct
35 Correct 46 ms 5976 KB Output is correct
36 Correct 47 ms 5620 KB Output is correct
# 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 12 ms 468 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 63 ms 1552 KB Output is correct
2 Runtime error 1 ms 340 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 7 ms 8148 KB Output is correct
10 Correct 72 ms 13336 KB Output is correct
11 Correct 72 ms 13304 KB Output is correct
12 Correct 76 ms 13400 KB Output is correct
13 Correct 85 ms 13260 KB Output is correct
14 Correct 67 ms 6876 KB Output is correct
15 Correct 73 ms 13360 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 3 ms 7508 KB Output is correct
18 Correct 4 ms 368 KB Output is correct
19 Correct 7 ms 9172 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 4 ms 7892 KB Output is correct
22 Correct 71 ms 13300 KB Output is correct
23 Correct 70 ms 13288 KB Output is correct
24 Correct 72 ms 13260 KB Output is correct
25 Correct 79 ms 13276 KB Output is correct
26 Correct 69 ms 13316 KB Output is correct
27 Correct 71 ms 13320 KB Output is correct
28 Correct 0 ms 340 KB Output is correct
29 Correct 1 ms 428 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 3 ms 5588 KB Output is correct
32 Correct 63 ms 9044 KB Output is correct
33 Correct 83 ms 11952 KB Output is correct
34 Correct 56 ms 6432 KB Output is correct
35 Correct 46 ms 5976 KB Output is correct
36 Correct 47 ms 5620 KB Output is correct
37 Runtime error 1 ms 340 KB Execution killed with signal 11
38 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 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 0 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 0 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 7 ms 8148 KB Output is correct
10 Correct 72 ms 13336 KB Output is correct
11 Correct 72 ms 13304 KB Output is correct
12 Correct 76 ms 13400 KB Output is correct
13 Correct 85 ms 13260 KB Output is correct
14 Correct 67 ms 6876 KB Output is correct
15 Correct 73 ms 13360 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 3 ms 7508 KB Output is correct
18 Correct 4 ms 368 KB Output is correct
19 Correct 7 ms 9172 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 4 ms 7892 KB Output is correct
22 Correct 71 ms 13300 KB Output is correct
23 Correct 70 ms 13288 KB Output is correct
24 Correct 72 ms 13260 KB Output is correct
25 Correct 79 ms 13276 KB Output is correct
26 Correct 69 ms 13316 KB Output is correct
27 Correct 71 ms 13320 KB Output is correct
28 Correct 0 ms 340 KB Output is correct
29 Correct 1 ms 428 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 3 ms 5588 KB Output is correct
32 Correct 63 ms 9044 KB Output is correct
33 Correct 83 ms 11952 KB Output is correct
34 Correct 56 ms 6432 KB Output is correct
35 Correct 46 ms 5976 KB Output is correct
36 Correct 47 ms 5620 KB Output is correct
37 Correct 63 ms 1552 KB Output is correct
38 Runtime error 1 ms 340 KB Execution killed with signal 11
39 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 0 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 0 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 7 ms 8148 KB Output is correct
10 Correct 72 ms 13336 KB Output is correct
11 Correct 72 ms 13304 KB Output is correct
12 Correct 76 ms 13400 KB Output is correct
13 Correct 85 ms 13260 KB Output is correct
14 Correct 67 ms 6876 KB Output is correct
15 Correct 73 ms 13360 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 3 ms 7508 KB Output is correct
18 Correct 4 ms 368 KB Output is correct
19 Correct 7 ms 9172 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 4 ms 7892 KB Output is correct
22 Correct 71 ms 13300 KB Output is correct
23 Correct 70 ms 13288 KB Output is correct
24 Correct 72 ms 13260 KB Output is correct
25 Correct 79 ms 13276 KB Output is correct
26 Correct 69 ms 13316 KB Output is correct
27 Correct 71 ms 13320 KB Output is correct
28 Correct 0 ms 340 KB Output is correct
29 Correct 1 ms 428 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 3 ms 5588 KB Output is correct
32 Correct 63 ms 9044 KB Output is correct
33 Correct 83 ms 11952 KB Output is correct
34 Correct 56 ms 6432 KB Output is correct
35 Correct 46 ms 5976 KB Output is correct
36 Correct 47 ms 5620 KB Output is correct
37 Correct 63 ms 1552 KB Output is correct
38 Runtime error 1 ms 340 KB Execution killed with signal 11
39 Halted 0 ms 0 KB -