제출 #965395

#제출 시각아이디문제언어결과실행 시간메모리
965395Batorgil952서열 (APIO23_sequence)C++17
0 / 100
2043 ms15700 KiB
#include "sequence.h" #include<bits/stdc++.h> #include <vector> using namespace std; const int N=5e5+5; int T[N]; int sequence(int N, std::vector<int> A) { int sn, pn, ans; if(N<=2000){ for(int i=0; i<=N; i++){ T[i]=0; } ans=1; for(int i=0; i<N; i++){ multiset< int > S, P; multiset< int > :: iterator it, ip; sn=1; pn=0; S.insert(A[i]); T[A[i]]++; for(int j=i+1; j<N; j++){ T[A[j]]++; if(pn==0){ P.insert(A[j]); pn++; it=S.begin(); ans=max(ans, max(T[A[j]], T[*it])); } else{ it=S.end(); it--; if((*it)>=A[j]){ S.insert(A[j]); sn++; } else{ P.insert(A[j]); pn++; } if(sn>=pn+2){ it=S.begin(); P.insert(*it); S.erase(it); } if(pn>=sn+2){ it=P.begin(); S.insert(*it); P.erase(it); } it=S.end(); it--; ip=P.begin(); if((sn+pn)%2==0){ ans=max(ans, max(T[*it], T[*ip])); } else{ ans=max(ans, T[*it]); } } } for(int j=i; j<N; j++){ T[A[j]]=0; } } return ans; } }

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

sequence.cpp: In function 'int sequence(int, std::vector<int>)':
sequence.cpp:72:1: warning: control reaches end of non-void function [-Wreturn-type]
   72 | }
      | ^
#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...