Submission #7476

#TimeUsernameProblemLanguageResultExecution timeMemory
7476gs13105배열 탈출 (GA8_array)C++98
100 / 100
620 ms39660 KiB
#include <stdio.h> int arr[2222][2222]; int mem[2222][2222]; inline int mx(int a,int b) { return a>b?a:b; } inline int mn(int a,int b) { return a<b?a:b; } int main() { int n,i,j; scanf("%d",&n); for(i=0;i<n;i++) for(j=0;j<n;j++) scanf("%d",&arr[i][j]); for(i=n-2;i>=0;i--) { mem[i][n-1]=mx(arr[i+1][n-1]-arr[i][n-1]+1,0)+mem[i+1][n-1]; mem[n-1][i]=mx(arr[n-1][i+1]-arr[n-1][i]+1,0)+mem[n-1][i+1]; } for(i=n-2;i>=0;i--) for(j=n-2;j>=0;j--) mem[i][j]=mn(mx(arr[i+1][j]-arr[i][j]+1,0)+mem[i+1][j],mx(arr[i][j+1]-arr[i][j]+1,0)+mem[i][j+1]); printf("%d",mem[0][0]); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...