제출 #776972

#제출 시각아이디문제언어결과실행 시간메모리
776972Dan4Life서열 (APIO23_sequence)C++17
28 / 100
2079 ms58884 KiB
#include "sequence.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; template<class T> using Tree = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; #define sz(a) (int)a.size() #define fi first #define se second Tree<pair<int,int>> S; map<int,int> tot; int n; int sequence(int N, vector<int> a) { n = N; int ans = 1; for(int i = 0; i < n; i++){ S.clear(); tot.clear(); for(int j = i; j < n; j++){ S.insert({a[j],j}); tot[a[j]]++; if(j==i)continue; int m1 = S.find_by_order((sz(S)-1)/2)->fi; int m2 = S.find_by_order(sz(S)/2)->fi; ans = max({ans,tot[m1], tot[m2]}); } //if(!i) break; } return ans; }
#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...