Submission #981930

#TimeUsernameProblemLanguageResultExecution timeMemory
981930MaaxleSequence (APIO23_sequence)C++17
0 / 100
2036 ms6072 KiB
#include "sequence.h" #include <bits/stdc++.h> #define range(it, a, b) for (ll it = a; it < b; it++) #define all(x) begin(x), end(x) #define ll long long #define ull unsigned long long #define INF64 ((ll) 1 << 62) #define INF32 (1 << 30) #define mset multiset #define uset unordered_set #define umap unordered_map #define pqueue priority_queue #define ptr(A) shared_ptr<A> using namespace std; int sequence(int N, vector<int> A) { int maxi = 0; map<int, int> freq; range(l, 0, N) { freq.clear(); range(r, l, N) { freq[A[r]]++; int sz = r-l+1; int a = sz/2, b = a+(sz&1); int pos = -1; for (auto& it : freq) { pos += it.second; if (pos >= a) { // cout << it.first << ' '<<it.second<<'\n'; maxi = max(maxi, it.second); } if (pos >= b) { // cout << it.first << ' '<<it.second<<'\n'; maxi = max(maxi, it.second); break; } } } } return maxi; }
#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...