Submission #824370

# Submission time Handle Problem Language Result Execution time Memory
824370 2023-08-14T04:46:46 Z 반딧불(#10358) Robogolf (ROI19_golf) C++17
0 / 100
31 ms 5136 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) % MOD;
        }
    }
    printf("%lld", ans);
}

Compilation message

golf.cpp: In function 'int main()':
golf.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d %d %d", &n, &m, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
golf.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%d %d %lld", &px[i], &py[i], &pc[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Incorrect 5 ms 1236 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 5136 KB Output isn't correct
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 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 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 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 468 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 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -