답안 #824373

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
824373 2023-08-14T04:49:43 Z 반딧불(#10358) 로봇 골프 (ROI19_golf) C++17
20 / 100
51 ms 23528 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];
bool hole[2002][2002];

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];
        hole[px[i]][py[i]] = 1;
    }

    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(hole[i][j]) 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

golf.cpp: In function 'int main()':
golf.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d %d %d", &n, &m, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
golf.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d %d %lld", &px[i], &py[i], &pc[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 15 ms 20040 KB Output is correct
10 Correct 45 ms 23500 KB Output is correct
11 Correct 51 ms 23480 KB Output is correct
12 Correct 49 ms 23516 KB Output is correct
13 Correct 47 ms 23524 KB Output is correct
14 Correct 36 ms 12640 KB Output is correct
15 Correct 47 ms 15636 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 2 ms 5972 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 4 ms 6484 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 3 ms 6228 KB Output is correct
22 Correct 43 ms 23500 KB Output is correct
23 Correct 42 ms 23528 KB Output is correct
24 Correct 42 ms 23448 KB Output is correct
25 Correct 47 ms 23500 KB Output is correct
26 Correct 44 ms 23436 KB Output is correct
27 Correct 45 ms 23528 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 2 ms 5076 KB Output is correct
32 Correct 35 ms 12824 KB Output is correct
33 Correct 35 ms 19668 KB Output is correct
34 Correct 23 ms 8232 KB Output is correct
35 Correct 24 ms 8944 KB Output is correct
36 Correct 25 ms 8488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 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 -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 3456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 15 ms 20040 KB Output is correct
10 Correct 45 ms 23500 KB Output is correct
11 Correct 51 ms 23480 KB Output is correct
12 Correct 49 ms 23516 KB Output is correct
13 Correct 47 ms 23524 KB Output is correct
14 Correct 36 ms 12640 KB Output is correct
15 Correct 47 ms 15636 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 2 ms 5972 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 4 ms 6484 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 3 ms 6228 KB Output is correct
22 Correct 43 ms 23500 KB Output is correct
23 Correct 42 ms 23528 KB Output is correct
24 Correct 42 ms 23448 KB Output is correct
25 Correct 47 ms 23500 KB Output is correct
26 Correct 44 ms 23436 KB Output is correct
27 Correct 45 ms 23528 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 2 ms 5076 KB Output is correct
32 Correct 35 ms 12824 KB Output is correct
33 Correct 35 ms 19668 KB Output is correct
34 Correct 23 ms 8232 KB Output is correct
35 Correct 24 ms 8944 KB Output is correct
36 Correct 25 ms 8488 KB Output is correct
37 Runtime error 2 ms 436 KB Execution killed with signal 11
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 15 ms 20040 KB Output is correct
10 Correct 45 ms 23500 KB Output is correct
11 Correct 51 ms 23480 KB Output is correct
12 Correct 49 ms 23516 KB Output is correct
13 Correct 47 ms 23524 KB Output is correct
14 Correct 36 ms 12640 KB Output is correct
15 Correct 47 ms 15636 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 2 ms 5972 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 4 ms 6484 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 3 ms 6228 KB Output is correct
22 Correct 43 ms 23500 KB Output is correct
23 Correct 42 ms 23528 KB Output is correct
24 Correct 42 ms 23448 KB Output is correct
25 Correct 47 ms 23500 KB Output is correct
26 Correct 44 ms 23436 KB Output is correct
27 Correct 45 ms 23528 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 2 ms 5076 KB Output is correct
32 Correct 35 ms 12824 KB Output is correct
33 Correct 35 ms 19668 KB Output is correct
34 Correct 23 ms 8232 KB Output is correct
35 Correct 24 ms 8944 KB Output is correct
36 Correct 25 ms 8488 KB Output is correct
37 Incorrect 30 ms 3456 KB Output isn't correct
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 15 ms 20040 KB Output is correct
10 Correct 45 ms 23500 KB Output is correct
11 Correct 51 ms 23480 KB Output is correct
12 Correct 49 ms 23516 KB Output is correct
13 Correct 47 ms 23524 KB Output is correct
14 Correct 36 ms 12640 KB Output is correct
15 Correct 47 ms 15636 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 2 ms 5972 KB Output is correct
18 Correct 2 ms 596 KB Output is correct
19 Correct 4 ms 6484 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 3 ms 6228 KB Output is correct
22 Correct 43 ms 23500 KB Output is correct
23 Correct 42 ms 23528 KB Output is correct
24 Correct 42 ms 23448 KB Output is correct
25 Correct 47 ms 23500 KB Output is correct
26 Correct 44 ms 23436 KB Output is correct
27 Correct 45 ms 23528 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 2 ms 5076 KB Output is correct
32 Correct 35 ms 12824 KB Output is correct
33 Correct 35 ms 19668 KB Output is correct
34 Correct 23 ms 8232 KB Output is correct
35 Correct 24 ms 8944 KB Output is correct
36 Correct 25 ms 8488 KB Output is correct
37 Incorrect 30 ms 3456 KB Output isn't correct
38 Halted 0 ms 0 KB -