Submission #901345

#TimeUsernameProblemLanguageResultExecution timeMemory
901345tkm_algorithmsSequence (APIO23_sequence)C++17
11 / 100
2084 ms5196 KiB
#include <bits/stdc++.h> using namespace std; int sequence(int n, vector<int> a) { int ans = 0; for (int i = 0; i < n; ++i) { vector<int> b; map<int, int> mp; for (int j = i; j < n; ++j) { b.push_back(a[j]); mp[a[j]]++; sort(b.begin(), b.end()); int d = b[(b.size() - 1) / 2], d2 = b[b.size() / 2]; ans = max({ans, mp[d], mp[d2]}); } } return ans; } //int main() { // int n; // cin >> n; // vector<int> a(n); // for (int i = 0; i < n; ++i) // cin >> a[i]; // cout << sequence(n, a); // return 0; //}
#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...