제출 #1179219

#제출 시각아이디문제언어결과실행 시간메모리
1179219KasymKSequence (APIO23_sequence)C++17
28 / 100
2096 ms4976 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int INF = 1e9; const int N = 2e3+5; int cnt[N]; int sequence(int n, vector<int> v){ int answer=1; vector<int> A; for(int i = 0; i < n; ++i){ A.clear(); for(int j = i; j < n; ++j){ A.pb(v[j]), cnt[v[j]]++; // A is sorted in history, so we do sorting on it int ind=(int)A.size()-1; while(ind>0 and A[ind-1]>A[ind]) swap(A[ind-1], A[ind]), ind--; int sz=(int)A.size(); umax(answer, cnt[A[sz/2]]); if(sz%2==0) umax(answer, cnt[A[(sz-1)/2]]); } for(int j = i; j < n; ++j) cnt[v[j]]--; } return answer; }
#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...