Submission #756888

#TimeUsernameProblemLanguageResultExecution timeMemory
756888Valters07Sequence (APIO23_sequence)C++17
11 / 100
2041 ms8280 KiB
#include <bits/stdc++.h> #include "sequence.h" #define ll long long #define pb push_back #define fi first #define se second using namespace std; const int N = 2e3+5; int cnt[N]; int sequence(int n, vector<int> a) { int res = 1; for(int i = 0;i<n;i++) { vector<int> ve; for(int j = 1;j<=n;j++) cnt[j]=0; for(int j = i;j<n;j++) { ve.pb(a[j]); sort(ve.begin(),ve.end()); cnt[a[j]]++; int hlf = (ve.size()-1)/2; res=max(res,cnt[ve[hlf]]); if(ve.size()%2==0) res=max(res,cnt[ve[hlf+1]]); } } 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...