Submission #127898

# Submission time Handle Problem Language Result Execution time Memory
127898 2019-07-10T08:17:18 Z 김세빈(#3108) JOI15_aaqqz (JOI15_aaqqz) C++14
10 / 100
4000 ms 380 KB
#include <bits/stdc++.h>

using namespace std;

int D[55], E[55];
int n, m, ans;

int check()
{
	int i, j, ret;
	
	ret = 0;
	
	for(i=1; i<=n; i++){
		for(j=0; i-j>=1 && i+j<=n; j++){
			if(D[i - j] != D[i + j]) break;
		}
		ret = max(ret, j + j - 1);
	}
	
	for(i=1; i<n; i++){
		for(j=0; i-j>=1 && i+j+1<=n; j++){
			if(D[i - j] != D[i + j + 1]) break;
		}
		ret = max(ret, j + j);
	}
	
	return ret;
}

int main()
{
	int i, j, k;
	
	scanf("%d%d", &n, &m);
	
	for(i=1; i<=n; i++){
		scanf("%d", D + i);
	}
	
	for(i=1; i<=n; i++){
		for(j=i; j<=n; j++){
			for(k=1; k<=n; k++) E[k] = D[k];
			sort(D + i, D + j + 1);
			ans = max(ans, check());
			for(k=1; k<=n; k++) D[k] = E[k];
		}
	}
	
	printf("%d\n", ans);
	
	return 0;
}

Compilation message

aaqqz.cpp: In function 'int main()':
aaqqz.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~
aaqqz.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", D + i);
   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 3 ms 380 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 256 KB Output is correct
9 Correct 3 ms 276 KB Output is correct
10 Correct 3 ms 256 KB Output is correct
11 Correct 3 ms 256 KB Output is correct
12 Correct 3 ms 256 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 3 ms 256 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 3 ms 256 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
26 Correct 3 ms 256 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 3 ms 256 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 3 ms 256 KB Output is correct
31 Correct 3 ms 376 KB Output is correct
32 Correct 3 ms 344 KB Output is correct
33 Correct 3 ms 256 KB Output is correct
34 Correct 3 ms 376 KB Output is correct
35 Correct 3 ms 256 KB Output is correct
36 Correct 3 ms 256 KB Output is correct
37 Correct 3 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 3 ms 380 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 256 KB Output is correct
9 Correct 3 ms 276 KB Output is correct
10 Correct 3 ms 256 KB Output is correct
11 Correct 3 ms 256 KB Output is correct
12 Correct 3 ms 256 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 3 ms 256 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 3 ms 256 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
26 Correct 3 ms 256 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 3 ms 256 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 3 ms 256 KB Output is correct
31 Correct 3 ms 376 KB Output is correct
32 Correct 3 ms 344 KB Output is correct
33 Correct 3 ms 256 KB Output is correct
34 Correct 3 ms 376 KB Output is correct
35 Correct 3 ms 256 KB Output is correct
36 Correct 3 ms 256 KB Output is correct
37 Correct 3 ms 256 KB Output is correct
38 Execution timed out 4056 ms 256 KB Time limit exceeded
39 Halted 0 ms 0 KB -