답안 #292643

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
292643 2020-09-07T11:21:33 Z 반딧불(#5810) 로봇 골프 (ROI19_golf) C++17
20 / 100
101 ms 16384 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll MOD = 998244353;

int n, m, k;
int MIN[1002][1002];
int MAX[1002][1002];
bool chk[1002][1002];
ll ans;

int main(){
    scanf("%d %d %d", &n, &m, &k);
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            MIN[i][j] = INT_MAX;
            MAX[i][j] = INT_MIN;
        }
    }
    for(int i=1; i<=k; i++){
        int x, y, z;
        scanf("%d %d %d", &x, &y, &z);
        MIN[x][y] = MAX[x][y] = z;
        chk[x][y] = 1;
    }
    for(int i=n; i>=1; i--){
        for(int j=m; j>=1; j--){
            if(!chk[i][j]){
                MIN[i][j] = min(MAX[i+1][j], MAX[i][j+1]);
                MAX[i][j] = max(MIN[i+1][j], MIN[i][j+1]);
            }
            ans += MIN[i][j];
            while(ans < 0) ans += MOD;
        }
    }

    ans %= MOD;
    printf("%lld", ans);
}

Compilation message

golf.cpp: In function 'int main()':
golf.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |     scanf("%d %d %d", &n, &m, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
golf.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   24 |         scanf("%d %d %d", &x, &y, &z);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 288 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 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 9 ms 8192 KB Output is correct
10 Correct 61 ms 9088 KB Output is correct
11 Correct 61 ms 9088 KB Output is correct
12 Correct 64 ms 9240 KB Output is correct
13 Correct 63 ms 9088 KB Output is correct
14 Correct 55 ms 4832 KB Output is correct
15 Correct 58 ms 9088 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 5 ms 9088 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 7 ms 9088 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 5 ms 9088 KB Output is correct
22 Correct 60 ms 9088 KB Output is correct
23 Correct 58 ms 9208 KB Output is correct
24 Correct 57 ms 9088 KB Output is correct
25 Correct 61 ms 9200 KB Output is correct
26 Correct 61 ms 9208 KB Output is correct
27 Correct 62 ms 9208 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 5 ms 8704 KB Output is correct
32 Correct 45 ms 6264 KB Output is correct
33 Correct 47 ms 8184 KB Output is correct
34 Correct 33 ms 4472 KB Output is correct
35 Correct 33 ms 4344 KB Output is correct
36 Correct 47 ms 4216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Incorrect 9 ms 512 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 1152 KB Output is correct
2 Runtime error 15 ms 16384 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 288 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 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 9 ms 8192 KB Output is correct
10 Correct 61 ms 9088 KB Output is correct
11 Correct 61 ms 9088 KB Output is correct
12 Correct 64 ms 9240 KB Output is correct
13 Correct 63 ms 9088 KB Output is correct
14 Correct 55 ms 4832 KB Output is correct
15 Correct 58 ms 9088 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 5 ms 9088 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 7 ms 9088 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 5 ms 9088 KB Output is correct
22 Correct 60 ms 9088 KB Output is correct
23 Correct 58 ms 9208 KB Output is correct
24 Correct 57 ms 9088 KB Output is correct
25 Correct 61 ms 9200 KB Output is correct
26 Correct 61 ms 9208 KB Output is correct
27 Correct 62 ms 9208 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 5 ms 8704 KB Output is correct
32 Correct 45 ms 6264 KB Output is correct
33 Correct 47 ms 8184 KB Output is correct
34 Correct 33 ms 4472 KB Output is correct
35 Correct 33 ms 4344 KB Output is correct
36 Correct 47 ms 4216 KB Output is correct
37 Runtime error 18 ms 16384 KB Execution killed with signal 11
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 101 ms 16376 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 101 ms 16376 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 288 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 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 9 ms 8192 KB Output is correct
10 Correct 61 ms 9088 KB Output is correct
11 Correct 61 ms 9088 KB Output is correct
12 Correct 64 ms 9240 KB Output is correct
13 Correct 63 ms 9088 KB Output is correct
14 Correct 55 ms 4832 KB Output is correct
15 Correct 58 ms 9088 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 5 ms 9088 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 7 ms 9088 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 5 ms 9088 KB Output is correct
22 Correct 60 ms 9088 KB Output is correct
23 Correct 58 ms 9208 KB Output is correct
24 Correct 57 ms 9088 KB Output is correct
25 Correct 61 ms 9200 KB Output is correct
26 Correct 61 ms 9208 KB Output is correct
27 Correct 62 ms 9208 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 5 ms 8704 KB Output is correct
32 Correct 45 ms 6264 KB Output is correct
33 Correct 47 ms 8184 KB Output is correct
34 Correct 33 ms 4472 KB Output is correct
35 Correct 33 ms 4344 KB Output is correct
36 Correct 47 ms 4216 KB Output is correct
37 Correct 43 ms 1152 KB Output is correct
38 Runtime error 15 ms 16384 KB Execution killed with signal 11
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 15 ms 16384 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 288 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 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 9 ms 8192 KB Output is correct
10 Correct 61 ms 9088 KB Output is correct
11 Correct 61 ms 9088 KB Output is correct
12 Correct 64 ms 9240 KB Output is correct
13 Correct 63 ms 9088 KB Output is correct
14 Correct 55 ms 4832 KB Output is correct
15 Correct 58 ms 9088 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 5 ms 9088 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 7 ms 9088 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 5 ms 9088 KB Output is correct
22 Correct 60 ms 9088 KB Output is correct
23 Correct 58 ms 9208 KB Output is correct
24 Correct 57 ms 9088 KB Output is correct
25 Correct 61 ms 9200 KB Output is correct
26 Correct 61 ms 9208 KB Output is correct
27 Correct 62 ms 9208 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 0 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 5 ms 8704 KB Output is correct
32 Correct 45 ms 6264 KB Output is correct
33 Correct 47 ms 8184 KB Output is correct
34 Correct 33 ms 4472 KB Output is correct
35 Correct 33 ms 4344 KB Output is correct
36 Correct 47 ms 4216 KB Output is correct
37 Correct 43 ms 1152 KB Output is correct
38 Runtime error 15 ms 16384 KB Execution killed with signal 11
39 Halted 0 ms 0 KB -