제출 #1048947

#제출 시각아이디문제언어결과실행 시간메모리
1048947matereGlobal Warming (CEOI18_glo)C++14
10 / 100
51 ms9812 KiB
#include<bits/stdc++.h> using namespace std; pair<long long,long long>step[200005]; long long a[200005],d[200005],dc[200005],ls; int main(){ long long n,x; cin>>n>>x; d[0]=-2e9-1; for(long long i=1;i<=n;i++) d[i]=2e9+1; for(long long i=1;i<=n;i++){ cin>>a[i]; long long l=0,r=n+1; while(l+1<r){ long long mid=(l+r)/2; if(d[mid]<a[i]) l=mid; else r=mid; } l++; if(d[l]>a[i]){ step[i]={l,d[l]}; d[l]=a[i]; ls=max(ls,l); } } d[n+1]=2e9+1; int ans=ls; // dc[0]=2e9+1; // for(long long i=1;i<=n;i++) dc[i]=-2e9-1; // for(long long i=n;i>=1;i--){ // d[step[i].first]=step[i].second; // if(d[step[i].first]==2e9+1) ls--; // a[i]++; // long long l=0,r=n+1; // while(l+1<r){ // long long mid=(l+r)/2; // if(dc[mid]<a[i]) l=mid; // else r=mid; // } // l++; // if(d[l]>a[i]){ // d[l]=a[i]; // ls=max(ls,l); // } // } cout<<ls<<endl; }

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

glo.cpp: In function 'int main()':
glo.cpp:26:9: warning: unused variable 'ans' [-Wunused-variable]
   26 |     int ans=ls;
      |         ^~~
#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...