제출 #756837

#제출 시각아이디문제언어결과실행 시간메모리
756837doowey서열 (APIO23_sequence)C++17
11 / 100
2083 ms5896 KiB
#include "sequence.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair const int N = (int)5e5 + 10; int cnt[N]; int sequence(int n, vector<int> a) { int ans = 0; for(int i = 0 ; i < n; i ++) { vector<int> me; for(int j = i ; j < n; j ++) { cnt[a[j]] ++ ; me.push_back(a[j]); sort(me.begin(), me.end()); if(me.size() % 2 == 0){ ans = max(ans, cnt[me[me.size() / 2]]); ans = max(ans, cnt[me[me.size() / 2 - 1]]); } else{ ans = max(ans, cnt[me[me.size() / 2]]); } } for(auto x : me) cnt[x] = 0; } 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...