제출 #756888

#제출 시각아이디문제언어결과실행 시간메모리
756888Valters07서열 (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...