제출 #1061424

#제출 시각아이디문제언어결과실행 시간메모리
1061424KasymK서열 (APIO23_sequence)C++17
11 / 100
2058 ms7752 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} int sequence(int n, vector<int> v){ vector<int> A; int answer = 0; for(int i = 0; i < n; ++i){ for(int j = i; j < n; ++j){ A.pb(v[j]); vector<int> same = A; sort(all(same)); int N = (int)same.size(); set<int> s; s.insert(same[(N-1)>>1]); s.insert(same[N>>1]); for(int x : s) umax(answer, (int)count(all(same), x)); } A.clear(); } return answer; } // int main(){ // printf("%d\n", sequence(7, {1, 2, 3, 1, 2, 1, 3})); // 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...