Submission #8022

#TimeUsernameProblemLanguageResultExecution timeMemory
8022lingxiang배열 탈출 (GA8_array)C++98
100 / 100
612 ms49916 KiB
#include<stdio.h> int N; int D[2500][2500], T[2500][2500]; int fn(int x){return x<0? 0:x;} int min(int a,int b){return a<b? a:b;} int input(){ scanf("%d",&N); for(int i=1;i<=N;i++){ for(int j=1;j<=N;j++){ scanf("%d",&T[i][j]); } } for(int i=0;i<2500;i++)for(int j=0;j<2500;j++)D[i][j]=0x6fffffff; return 0; } int solve(){ for(int i=1;i<=N;i++) for(int j=1;j<=N;j++){ if(i==1&&j==1){ D[i][j]=0; continue; } D[i][j]=min(D[i-1][j]+fn(T[i][j]-T[i-1][j]+1),D[i][j-1]+fn(T[i][j]-T[i][j-1]+1)); } return 0; } int output(){ printf("%d",D[N][N]); return 0; } int main(){ input(); solve(); output(); 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...