답안 #70487

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70487 2018-08-23T04:35:44 Z leehosu01 On grid (kriii2_O) C++17
0 / 4
129 ms 4732 KB
#include<bits/stdc++.h>
using namespace std;
long long MP[301][301],CR[301][301],BF[301][301],CG[302],BG[302],to;
int N,M;
int main()
{
    scanf("%d%d",&N,&M);
    int i,j,k;
    for(i=1;i<=N;i++)
        for(j=1;j<=M;j++)
            BF[i][j]=-(1ll<<30),scanf("%lld",&MP[i][j]);
    CG[M+1]=BG[M+1]=-(1ll<<30);
    for(to=0,j=M;j;j--)BG[j]=BF[j][M]=to+=MP[N][j];
    for(i=N-1;i;i--,swap(CG,BG),swap(CR,BF))
        for(j=1;j<=M;j++)
            for(to=0,CG[k=j]=-(1ll<<30);k<=M;k++)
                CG[j]=max(CG[j],CR[j][k]=max(BF[j][k],BG[k+1])+(to+=MP[i][k]));
    printf("%lld",BG[1]);
}

Compilation message

O.cpp: In function 'int main()':
O.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&N,&M);
     ~~~~~^~~~~~~~~~~~~~
O.cpp:11:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             BF[i][j]=-(1ll<<30),scanf("%lld",&MP[i][j]);
             ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 5 ms 1924 KB Output is correct
3 Correct 5 ms 1932 KB Output is correct
4 Correct 10 ms 1932 KB Output is correct
5 Correct 8 ms 1932 KB Output is correct
6 Correct 7 ms 2044 KB Output is correct
7 Correct 9 ms 2044 KB Output is correct
8 Correct 9 ms 2044 KB Output is correct
9 Correct 7 ms 2044 KB Output is correct
10 Correct 6 ms 2044 KB Output is correct
11 Incorrect 5 ms 2044 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 2352 KB Output is correct
2 Correct 30 ms 2532 KB Output is correct
3 Correct 58 ms 2948 KB Output is correct
4 Correct 52 ms 3140 KB Output is correct
5 Correct 26 ms 3140 KB Output is correct
6 Correct 45 ms 3268 KB Output is correct
7 Correct 41 ms 3516 KB Output is correct
8 Correct 75 ms 3848 KB Output is correct
9 Correct 89 ms 4380 KB Output is correct
10 Correct 129 ms 4732 KB Output is correct
11 Incorrect 36 ms 4732 KB Output isn't correct
12 Halted 0 ms 0 KB -