제출 #56364

#제출 시각아이디문제언어결과실행 시간메모리
56364leejseo배열 탈출 (GA8_array)C++98
49 / 100
890 ms66560 KiB
#include <stdio.h> #include <algorithm> #include <vector> using namespace std; int N; vector<int> A[2222]; vector<int> D[2222]; inline bool valid(int i, int j) { return 0<=i && i<N && 0<=j && j<N; } void DP(){ for (int i=0; i<N; i++){ if (i >= 2){ D[i-2].clear(); A[i-2].clear(); } A[i].resize(N); D[i].resize(N); for (int j=0; j<N; j++){ scanf("%d", &A[i][j]); if (i == 0 && j == 0){ D[0][0] = 0; continue; } D[i][j] = (int)1e9; if (valid(i-1, j)) D[i][j] = min(D[i][j], D[i-1][j] + max(0, A[i][j] - A[i-1][j] + 1)); if (valid(i, j-1)) D[i][j] = min(D[i][j], D[i][j-1] + max(0, A[i][j] - A[i][j-1] + 1)); } } } int main(void){ scanf("%d", &N); DP(); printf("%d\n", D[N-1][N-1]); }

컴파일 시 표준 에러 (stderr) 메시지

array.cpp: In function 'void DP()':
array.cpp:23:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &A[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~
array.cpp: In function 'int main()':
array.cpp:36:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &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...