Submission #7886

#TimeUsernameProblemLanguageResultExecution timeMemory
7886qja0950배열 탈출 (GA8_array)C++98
100 / 100
644 ms43572 KiB
#include <stdio.h> #define MAXN 2332 #define INF 2100000000 int N; int Number[MAXN][MAXN]; int Dy[MAXN][MAXN]; int MIN(int x, int y) { if(x>y) return y; else return x; } int Money(int now, int next) { if(now>next) return 0; return next-now+1; } int main() { scanf("%d", &N); for(int i=0; i<=N; i++) Dy[0][i] = Dy[i][0] = INF; for(int i=1; i<=N; i++) { for(int j=1; j<=N; j++) { scanf("%d", &Number[i][j]); if(i==1 && j==1) continue; Dy[i][j] = MIN(Dy[i-1][j] + Money(Number[i-1][j], Number[i][j]) , Dy[i][j-1] + Money(Number[i][j-1], Number[i][j])); } } printf("%d", Dy[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...