# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
656439 | ono_de206 | Global Warming (CEOI18_glo) | C++14 | 120 ms | 6248 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
typedef long long ll;
#define int long long
template<typename T>
void mxx(T &a, T b){if(b>a) a=b;}
template<typename T>
void mnn(T &a, T b){if(b<a) a=b;}
const int mxn=2e5+10;
const int inf=1e18+10;
int pre[mxn];
int a[mxn];
signed main(){
int n,x;
cin>>n>>x;
for(int i=1; i<=n; i++){
cin>>a[i];
}
vector<int> g;
int ans=0;
for(int i=1; i<=n; i++){
int gg=lower_bound(all(g),a[i])-g.begin();
if(gg==g.size()) g.pb(a[i]);
else g[gg]=a[i];
pre[i]=gg+1;
}
g.clear();
for(int i=n; i>=1; i--){
int gg=lower_bound(all(g),-(a[i]-x))-g.begin();
mxx(ans,pre[i]+gg);
gg=lower_bound(all(g),-a[i])-g.begin();
if(gg==g.size()) g.pb(-a[i]);
else g[gg]=-a[i];
}
cout<<ans<<'\n';
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |