Submission #7841

#TimeUsernameProblemLanguageResultExecution timeMemory
7841whiteout배열 탈출 (GA8_array)C++98
100 / 100
636 ms39696 KiB
#include <stdio.h> int a[2223][2223],n,i,j,b[2223][2223]; int am(int a,int b){return a>b?a:b;} int bm(int a,int b){return a>b?b:a;} int main() { scanf("%d",&n); for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { scanf("%d",&a[i][j]); } } for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { if(i==1) { if(j==1) { continue; } b[1][j]=am(0,a[1][j]-a[1][j-1]+1)+b[1][j-1]; } else if(j==1) { b[i][1]=am(0,a[i][1]-a[i-1][1]+1)+b[i-1][1]; } else { b[i][j]=bm(am(0,a[i][j]-a[i][j-1]+1)+b[i][j-1],am(0,a[i][j]-a[i-1][j]+1)+b[i-1][j]); } } } printf("%d",b[n][n]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...