Submission #584905

# Submission time Handle Problem Language Result Execution time Memory
584905 2022-06-28T06:34:40 Z 조영욱(#8382) JOI15_aaqqz (JOI15_aaqqz) C++14
0 / 100
5 ms 340 KB
#include <bits/stdc++.h>
using namespace std;

int arr[3001];
int save[3001];

int main(void){
    int n,c;
    scanf("%d %d",&n,&c);
    for(int i=1;i<=n;i++) {
        scanf("%d",&arr[i]);
        save[i]=arr[i];
    }
    int ret=0;
    for(int l=1;l<=n;l++){
        for(int r=l;r<=n;r++) {
            sort(arr+l,arr+r+1);
            for(int ll=1;ll<=n;ll++){
                for(int rr=ll;rr<=n;rr++) {
                    int val=rr-ll+1;
                    bool flag=true;
                    while (ll<rr) {
                        if (arr[ll]!=arr[rr]) {
                            flag=false;
                            break;
                        }
                        ll++;
                        rr--;
                    }
                    if (flag) {
                        ret=max(ret,val);
                    }
                }
            }
            for(int i=1;i<=n;i++){
                arr[i]=save[i];
            }
        }
    }
    printf("%d",ret);
}

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]
    9 |     scanf("%d %d",&n,&c);
      |     ~~~~~^~~~~~~~~~~~~~~
aaqqz.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d",&arr[i]);
      |         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 212 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Incorrect 2 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 212 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Incorrect 2 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -