Submission #56367

# Submission time Handle Problem Language Result Execution time Memory
56367 2018-07-11T07:27:53 Z leejseo 배열 탈출 (GA8_array) C++11
0 / 100
770 ms 39116 KB
#include <stdio.h>
#include <algorithm>
using namespace std;
int A[2223][2223], D[2223][2223], N;

void input(){
	scanf("%d", &N);
	for (int i=1; i<=N; i++){
		for (int j=1; j<=N; j++){
			scanf("%d", &A[i][j]);
		}
	}
}

void DP(){
	D[1][1] = 0;
	for (int i=0; i<=N; i++){
		D[0][i] = (int)1e9;
		D[i][0] = (int)1e9;
	}
	for (int i=1; i<=N; i++){
		for (int j=1; j<=N; j++){
			if (i == 1 && j == 1) continue;
			D[i][j] = min(D[i-1][j] + (A[i-1][j] > A[i][j]? 0 : A[i][j] - A[i-1][j] + 1), A[i][j-1] + (A[i][j-1]  > A[i][j]? 0 : A[i][j] - A[i][j-1] + 1));		
		}
	}
}

int main(void){
	input();
	DP();
	printf("%d\n", D[N][N]);
}

Compilation message

array.cpp: In function 'void input()':
array.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
array.cpp:10:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &A[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 2592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 770 ms 39116 KB Output isn't correct
2 Halted 0 ms 0 KB -