답안 #127752

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
127752 2019-07-10T05:23:12 Z 이온조(#3109) AAQQZ (JOI15_aaqqz) C++14
10 / 100
644 ms 9384 KB
#include <bits/stdc++.h>
using namespace std;

int A[3009], B[3009];
bool D[3009][3009];

int main() {
	int ans = 0;
	int N, C; scanf("%d%d",&N,&C);
	if(N > 50) return 0;
	for(int i=1; i<=N; i++) scanf("%d",&A[i]);
	for(int i=1; i<=N; i++) {
		for(int j=i; j<=N; j++) {
			for(int k=1; k<=N; k++) B[k] = A[k];
			sort(B+i, B+j+1);
			memset(D, 0, sizeof(D));
			for(int k=N; k>=1; k--) {
				for(int l=k; l<=N; l++) {
					if(k == l) D[k][l] = 1;
					else if(k+1 == l && B[k] == B[l]) D[k][l] = 1;
					else if(D[k+1][l-1] && B[k] == B[l]) D[k][l] = 1;
					if(D[k][l]) ans = max(ans, l-k+1);
				}
			}
		}
	}
	printf("%d", ans);
	return 0;
}

Compilation message

aaqqz.cpp: In function 'int main()':
aaqqz.cpp:9:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int N, C; scanf("%d%d",&N,&C);
            ~~~~~^~~~~~~~~~~~~~
aaqqz.cpp:11:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=N; i++) scanf("%d",&A[i]);
                          ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 634 ms 9228 KB Output is correct
2 Correct 623 ms 9228 KB Output is correct
3 Correct 619 ms 9208 KB Output is correct
4 Correct 623 ms 9336 KB Output is correct
5 Correct 621 ms 9336 KB Output is correct
6 Correct 644 ms 9336 KB Output is correct
7 Correct 621 ms 9336 KB Output is correct
8 Correct 605 ms 9208 KB Output is correct
9 Correct 619 ms 9336 KB Output is correct
10 Correct 610 ms 9224 KB Output is correct
11 Correct 616 ms 9224 KB Output is correct
12 Correct 604 ms 9208 KB Output is correct
13 Correct 620 ms 9224 KB Output is correct
14 Correct 615 ms 9224 KB Output is correct
15 Correct 629 ms 9228 KB Output is correct
16 Correct 618 ms 9224 KB Output is correct
17 Correct 609 ms 9232 KB Output is correct
18 Correct 627 ms 9208 KB Output is correct
19 Correct 633 ms 9336 KB Output is correct
20 Correct 611 ms 9268 KB Output is correct
21 Correct 610 ms 9228 KB Output is correct
22 Correct 624 ms 9228 KB Output is correct
23 Correct 617 ms 9260 KB Output is correct
24 Correct 607 ms 9384 KB Output is correct
25 Correct 621 ms 9260 KB Output is correct
26 Correct 633 ms 9268 KB Output is correct
27 Correct 10 ms 9228 KB Output is correct
28 Correct 621 ms 9336 KB Output is correct
29 Correct 608 ms 9212 KB Output is correct
30 Correct 633 ms 9240 KB Output is correct
31 Correct 620 ms 9268 KB Output is correct
32 Correct 632 ms 9336 KB Output is correct
33 Correct 611 ms 9308 KB Output is correct
34 Correct 607 ms 9228 KB Output is correct
35 Correct 621 ms 9312 KB Output is correct
36 Correct 616 ms 9224 KB Output is correct
37 Correct 604 ms 9208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 634 ms 9228 KB Output is correct
2 Correct 623 ms 9228 KB Output is correct
3 Correct 619 ms 9208 KB Output is correct
4 Correct 623 ms 9336 KB Output is correct
5 Correct 621 ms 9336 KB Output is correct
6 Correct 644 ms 9336 KB Output is correct
7 Correct 621 ms 9336 KB Output is correct
8 Correct 605 ms 9208 KB Output is correct
9 Correct 619 ms 9336 KB Output is correct
10 Correct 610 ms 9224 KB Output is correct
11 Correct 616 ms 9224 KB Output is correct
12 Correct 604 ms 9208 KB Output is correct
13 Correct 620 ms 9224 KB Output is correct
14 Correct 615 ms 9224 KB Output is correct
15 Correct 629 ms 9228 KB Output is correct
16 Correct 618 ms 9224 KB Output is correct
17 Correct 609 ms 9232 KB Output is correct
18 Correct 627 ms 9208 KB Output is correct
19 Correct 633 ms 9336 KB Output is correct
20 Correct 611 ms 9268 KB Output is correct
21 Correct 610 ms 9228 KB Output is correct
22 Correct 624 ms 9228 KB Output is correct
23 Correct 617 ms 9260 KB Output is correct
24 Correct 607 ms 9384 KB Output is correct
25 Correct 621 ms 9260 KB Output is correct
26 Correct 633 ms 9268 KB Output is correct
27 Correct 10 ms 9228 KB Output is correct
28 Correct 621 ms 9336 KB Output is correct
29 Correct 608 ms 9212 KB Output is correct
30 Correct 633 ms 9240 KB Output is correct
31 Correct 620 ms 9268 KB Output is correct
32 Correct 632 ms 9336 KB Output is correct
33 Correct 611 ms 9308 KB Output is correct
34 Correct 607 ms 9228 KB Output is correct
35 Correct 621 ms 9312 KB Output is correct
36 Correct 616 ms 9224 KB Output is correct
37 Correct 604 ms 9208 KB Output is correct
38 Incorrect 3 ms 504 KB Output isn't correct
39 Halted 0 ms 0 KB -