답안 #292959

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
292959 2020-09-07T15:01:54 Z 문홍윤(#5817) 로봇 골프 (ROI19_golf) C++17
0 / 100
55 ms 2040 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], 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]=val[i][j];
                continue;
            }
            dp[i][j]=max(dp[i+1][j+1], min(dp[i+2][j], dp[i][j+2]));
        }
    }
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            ans+=dp[i][j]+2*mod;
            ans%=mod;
        }
    }
    printf("%lld", ans);
}

Compilation message

golf.cpp: In function 'int main()':
golf.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   24 |     scanf("%d %d %d", &n, &m, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
golf.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   27 |         scanf("%d %d", &a, &b);
      |         ~~~~~^~~~~~~~~~~~~~~~~
golf.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   29 |         scanf("%lld", &val[a][b]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 2040 KB Output is correct
2 Runtime error 3 ms 384 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 384 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 384 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 384 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -