Submission #932042

#TimeUsernameProblemLanguageResultExecution timeMemory
932042Edu175Sequence (APIO23_sequence)C++17
11 / 100
2052 ms12632 KiB
#include "sequence.h" #include <bits/stdc++.h> #define pb push_back #define fst first #define snd second #define fore(i,a,b) for(ll i=a,apio=b;i<apio;i++) #define SZ(x) ((int)x.size()) #define ALL(x) x.begin(),x.end() #define mset(a,v) memset((a),(v),sizeof(a)) #define imp(v) for(auto slkdh:v)cout<<slkdh<<" ";cout<<"\n" using namespace std; typedef long long ll; typedef pair<ll,ll> ii; int sequence(int N, std::vector<int> A) { ll n=N; vector<ll>a(n); fore(i,0,n)a[i]=A[i]-1; ll res=0; fore(l,0,n)fore(r,l+1,n+1){ vector<ll>b,c(n); fore(i,l,r)b.pb(a[i]),c[a[i]]++; sort(ALL(b)); res=max({res,c[b[(SZ(b)-1)/2]],c[b[SZ(b)/2]]}); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...