Submission #837910

#TimeUsernameProblemLanguageResultExecution timeMemory
837910beaconmcSequence (APIO23_sequence)C++17
28 / 100
2071 ms70060 KiB
#include "sequence.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> typedef long long ll; using namespace std; using namespace __gnu_pbds; #define FOR(i, x, y) for(int i=x; i<y; i++) #define FORNEG(i, x, y) for(int i=x; i>y; i--) #define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> #define fast() ios_base::sync_with_stdio(false);cin.tie(NULL) int sequence(int N, vector<int> A) { ll ans = 0; FOR(i,0,N){ map<ll, ll> idk; ordered_set sus; FOR(j, i, N){ idk[A[j]]++; sus.insert(A[j]); ll pos1 = (sus.size()-1)/2; ll pos2 = ((ll)sus.size()-2)/2+1; ll temp = 0; temp = idk[*sus.find_by_order(pos1)]; temp = max(temp, idk[*sus.find_by_order(pos2)]); ans = max(ans, temp); } } 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...