| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 999072 | mnbvcxz123 | Global Warming (CEOI18_glo) | C++17 | 44 ms | 5468 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int n,x;
int a[200005];
int pref[200005];
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin>>n>>x;
for(int i=0;i<n;++i)cin>>a[i];
vector<int>dp(n,INT_MAX);
int longest=0;
for(int i=0;i<n;++i){
int j=lower_bound(dp.begin(),dp.end(),a[i])-dp.begin();
dp[j]=a[i];
pref[i]=j+1;
longest=max(longest,pref[i]);
}
dp=vector<int>(n,INT_MAX);
for(int i=n-1;i>=0;--i){
int pos=lower_bound(dp.begin(),dp.end(),-a[i]+x)-dp.begin();
longest=max(longest,pref[i]+pos);
int ins=lower_bound(dp.begin(),dp.end(),-a[i])-dp.begin();
dp[ins]=-a[i];
}
cout<<longest<<'\n';
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
