답안 #127764

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
127764 2019-07-10T05:44:44 Z 송준혁(#3112) AAQQZ (JOI15_aaqqz) C++14
0 / 100
3 ms 380 KB
#include <bits/stdc++.h>
using namespace std;

int N;
int ans;
int A[110], B[110];

int main(){
    scanf("%d %*d", &N);
    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+1, B+j+1);
        for (int k=1; k<=N; k++) {
            for (int l=0; 0<k-l && k+l<=N; l++){
                if (B[k-l] != B[k+l]) break;
                ans = max(ans, 2*l+1);
            }
            for (int l=1; 0<k-l+1 && k+l<=N; l++){
                if (B[k-l+1] != B[k+l]) break;
                ans = max(ans, 2*l);
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

Compilation message

aaqqz.cpp: In function 'int main()':
aaqqz.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %*d", &N);
     ~~~~~^~~~~~~~~~~~~~
aaqqz.cpp:10:35: 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 3 ms 256 KB Output is correct
2 Correct 3 ms 380 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Incorrect 3 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 3 ms 380 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Incorrect 3 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -