제출 #1019088

#제출 시각아이디문제언어결과실행 시간메모리
1019088ivazivaGlobal Warming (CEOI18_glo)C++14
0 / 100
61 ms6992 KiB
#include <bits/stdc++.h> using namespace std; #define MAXN 200010 long long n,x; long long a[MAXN],b[MAXN]; long long lis1[MAXN],lis2[MAXN]; vector<long long> dp; int main() { cin>>n>>x; for (long long i=1;i<=n;i++) cin>>a[i]; for (long long i=1;i<=n;i++) { long long pos=lower_bound(dp.begin(),dp.end(),a[i])-dp.begin(); if (pos==dp.size()) dp.push_back(a[i]); else dp[pos]=a[i]; lis1[i]=dp.size(); } dp.clear(); for (long long i=n;i>=1;i--) { long long pos1=lower_bound(dp.begin(),dp.end(),x-a[i])-dp.begin();lis2[i]=pos1+1; long long pos2=lower_bound(dp.begin(),dp.end(),a[i]*(-1))-dp.begin(); if (pos2==dp.size()) dp.push_back(a[i]*(-1)); else dp[pos2]=a[i]; } long long ans=lis1[n]; for (long long i=1;i<n;i++) { long long lis=lis1[i]+lis2[i]-1; ans=max(ans,lis); } cout<<ans<<endl; }

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

glo.cpp: In function 'int main()':
glo.cpp:19:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         if (pos==dp.size()) dp.push_back(a[i]);
      |             ~~~^~~~~~~~~~~
glo.cpp:28:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         if (pos2==dp.size()) dp.push_back(a[i]*(-1));
      |             ~~~~^~~~~~~~~~~
#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...