제출 #982065

#제출 시각아이디문제언어결과실행 시간메모리
982065vjudge1서열 (APIO23_sequence)C++17
28 / 100
2044 ms51140 KiB
#include <bits/stdc++.h> #define endl '\n' #define mp make_pair #define pb push_back #define f first #define s second #define fo(i,n) for(auto i =0 ; i < n;i++) #define fore(i,l,r) for(auto i = l; i < r;i++) #define forex(i,r,l) for(auto i = r; i >= l; i--) #define ffo(i,n) forex(i,n-1,0) #define all(x) x.begin(),x.end() #define lsb(x) x&(-x) #define sz(x) (int)x.size() #define gcd(a,b) __gcd(a,b) #define vii vector<ii> using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector<int>;using ii = pair<int,int>;using mii = map<int,int>; #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") int sequence(int n, vi a){ int ans = 0; fo(i,n){ multiset<int> st1,st2; map<int,int> cnt; fore(j,i,n){ cnt[a[j]] ++; if(st1.empty())st1.insert(a[j]); else if(st2.empty())st2.insert(a[j]); else{ if(a[j]>*st1.rbegin())st2.insert(a[j]); else st1.insert(a[j]); while(sz(st2)>sz(st1)){ int v = *st2.begin(); st1.insert(v); st2.erase(st2.find(v)); } while(sz(st1)-1>sz(st2)){ st2.insert(*st1.rbegin()); st1.erase(st1.find(*st1.rbegin())); } } ans = max(ans, cnt[*st1.rbegin()]); if((j-i)&1)ans = max({ans, cnt[*st2.begin()]}); // cout << i << " " << j << endl; // for(int v : st1) cout << v << " ";cout << endl; // for(int v : st2)cout << v << " ";cout<<endl; } } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

sequence.cpp:20: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   20 | #pragma GCC optimization ("O3")
      | 
sequence.cpp:21: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   21 | #pragma GCC optimization ("unroll-loops")
      |
#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...