제출 #1178881

#제출 시각아이디문제언어결과실행 시간메모리
1178881JelalTkmSequence (APIO23_sequence)C++20
11 / 100
2096 ms5592 KiB
#include <bits/stdc++.h> #include "sequence.h" #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; // #define int long long int // const int N = 2e5 + 10; // const int md = 1e9 + 7; // const int INF = 1e18; 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++) { mp[a[j]]++; b.push_back(a[j]); sort(b.begin(), b.end()); int sz = (int) b.size(); sz--; ans = max({ans, mp[b[(sz >> 1)]], mp[b[(sz + 1) >> 1]]}); } } return ans; } // int32_t main(int32_t argc, char *argv[]) { // ios::sync_with_stdio(false); // cin.tie(nullptr); // int T = 1; // // cin >> T; // while (T--) { // cout << sequence(14, {2, 6, 2, 5, 3, 4, 2, 1, 4, 3, 5, 6, 3, 2}) << '\n'; // } // 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...