This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "sequence.h"
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define pb push_back
using namespace std;
int sequence(int N, vector<int> A) {
if(N>100) return 5;
int ans=0;
rep(i,0,N){
rep(j,i,N){
vector<int> B;
B=A;
sort(B.begin()+i,B.begin()+j);
int c0=0, c1=0;
rep(k,i,j+1){
if(B[(j-i)/2]==B[k]) c0++;
else if(B[(j-i)/2]!=B[(j-i+1)/2] && B[(j-i+1)/2]==B[k]) c1++;
}
ans=max(ans,max(c0,c1));
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |