| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1096682 | nguyenvu | Global Warming (CEOI18_glo) | C++14 | 2067 ms | 5516 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
#define FILE "DAYDEP"
using namespace std;
int n,x;
ll a[200005],dp[200005];
void sub2()
{
for(int i=1;i<=n;i++) dp[i]=10000000000;
int ans=0;
for(int i=1;i<=n;i++){
int k=lower_bound(dp+1,dp+n+1,a[i])-dp;
dp[k]=a[i];
ans=max(ans,k);
}
cout<<ans;
}
void solve()
{
int ans=0;
for(int i=1;i<n;i++){
int cnt=1;
ll mx=-1e9;
int d=0;
for(int j=i+1;j<=n;j++){
if(a[j]>a[i]){
cnt++;
mx=max(mx,a[i]);
}
else{
int dem=0;
if(a[j]+x<=mx) continue;
for(int k=j+1;k<=n;k++){
if(a[k]+x>mx) mx=a[k],dem++;
}
mx=a[j];
d=max(d,dem);
}
}
cnt+=d;
ans=max(d,ans);
}
cout<<ans;
}
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//freopen(FILE".inp","r",stdin);
//freopen(FILE".out","w",stdout);
cin>>n>>x;
for(int i=1;i<=n;i++) cin>>a[i];
if(x==0) sub2();
else solve();
}
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
