Submission #56506

# Submission time Handle Problem Language Result Execution time Memory
56506 2018-07-11T14:12:20 Z leejseo 배열 탈출 (GA8_array) C++17
49 / 100
740 ms 66560 KB
#include <stdio.h>
#include <algorithm>
#define INF 1000000000
using namespace std;
int C[2223], B[2223], CUR[2223], BF[2223], N;
 
void input(){
	scanf("%d", &N);
}
 
void DP(){
	for (int i=0; i<=N; i++){
		BF[i] = INF;
	}	
	for (int i=1; i<=N; i++){
		CUR[0] = INF;
		for (int j=1; j<=N; j++){
			B[j] = C[j];
			scanf("%d", &C[j]);
			if (i + j == 2){
				CUR[1] = 0;
				BF[1] = 0;
				continue;
			}
			CUR[j] = min(BF[j] + (B[j] > C[j]? 0 : C[j] - B[j] + 1), CUR[j-1] + (C[j-1]  > C[j]? 0 : C[j] - C[j-1] + 1));		
			BF[j] = CUR[j];
		}
	}
}
 
int main(void){
	input();
	DP();
	printf("%d\n", CUR[N]);
}

Compilation message

array.cpp: In function 'void input()':
array.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
array.cpp: In function 'void DP()':
array.cpp:19:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &C[j]);
    ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 496 KB Output is correct
3 Correct 2 ms 496 KB Output is correct
4 Correct 2 ms 496 KB Output is correct
5 Correct 2 ms 548 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 3 ms 588 KB Output is correct
10 Correct 2 ms 588 KB Output is correct
11 Correct 3 ms 620 KB Output is correct
12 Correct 2 ms 620 KB Output is correct
13 Correct 2 ms 620 KB Output is correct
14 Correct 3 ms 620 KB Output is correct
15 Correct 2 ms 620 KB Output is correct
16 Correct 3 ms 620 KB Output is correct
17 Correct 3 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 620 KB Output is correct
2 Correct 3 ms 740 KB Output is correct
3 Correct 2 ms 740 KB Output is correct
4 Correct 2 ms 740 KB Output is correct
5 Correct 2 ms 740 KB Output is correct
6 Correct 2 ms 740 KB Output is correct
7 Correct 2 ms 740 KB Output is correct
8 Correct 2 ms 740 KB Output is correct
9 Correct 2 ms 748 KB Output is correct
10 Correct 3 ms 748 KB Output is correct
11 Correct 2 ms 748 KB Output is correct
12 Correct 2 ms 748 KB Output is correct
13 Correct 3 ms 748 KB Output is correct
14 Correct 3 ms 748 KB Output is correct
15 Correct 2 ms 748 KB Output is correct
16 Correct 2 ms 748 KB Output is correct
17 Correct 2 ms 748 KB Output is correct
18 Correct 2 ms 748 KB Output is correct
19 Correct 2 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 956 KB Output is correct
2 Correct 13 ms 1124 KB Output is correct
3 Correct 13 ms 1440 KB Output is correct
4 Correct 11 ms 1444 KB Output is correct
5 Correct 12 ms 1672 KB Output is correct
6 Correct 8 ms 1844 KB Output is correct
7 Correct 9 ms 2020 KB Output is correct
8 Correct 7 ms 2192 KB Output is correct
9 Correct 9 ms 2336 KB Output is correct
10 Correct 9 ms 2512 KB Output is correct
11 Correct 12 ms 2660 KB Output is correct
12 Correct 9 ms 2808 KB Output is correct
13 Correct 8 ms 2972 KB Output is correct
14 Correct 9 ms 3236 KB Output is correct
15 Correct 13 ms 3504 KB Output is correct
16 Correct 11 ms 3504 KB Output is correct
17 Correct 14 ms 3652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 737 ms 20592 KB Output is correct
2 Correct 606 ms 37676 KB Output is correct
3 Correct 733 ms 54536 KB Output is correct
4 Runtime error 740 ms 66560 KB Memory limit exceeded 66560 {'time-wall': '0.804', 'max-rss': '1212', 'csw-forced': '243', 'cg-mem': '66560', 'time': '0.740', 'csw-voluntary': '6'} 65536
5 Halted 0 ms 0 KB -