| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 538268 | DJ035 | Global Warming (CEOI18_glo) | C++17 | 55 ms | 5840 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#include <bits/stdc++.h>
#define MEM 1111111
#define sanic ios_base::sync_with_stdio(0)
#define x first
#define y second
#define pf push_front
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz size()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
const ll INF = 1e17+7;
const ll MOD = 998244353;
ll gcd(ll a, ll b){
if(a%b) return gcd(b, a%b);
return b;
}
ll t,n,m,a,b,x;
signed main(){
sanic; cin.tie(0);
cin >> n >> x;
vector<ll> l;
for(int i=0; i<n; i++){
ll q;
cin >> q;
l.pb(q);
}
vector<int> lis,dp(n);
lis.pb(-INF);
for(int i=0; i<n; i++){
if(lis.back()<l[i]){
lis.pb(l[i]);
dp[i] = lis.sz-1;
}
else{
int idx=lower_bound(lis.begin(), lis.end(), l[i])-lis.begin();
lis[idx] = l[i];
dp[i] = idx;
}
}
vector<int> p;
p.pb(-INF);
int ans=0;
for(int i=n-1; i>=0; i--){
int id=lower_bound(p.begin(), p.end(), -l[i]+x)-p.begin();
//cout << dp[i] << ' ' << id-1 << '\n';
ans = max(dp[i]+id-1, ans);
if(p.back()<-l[i])
p.pb(-l[i]);
else{
int idx=lower_bound(p.begin(), p.end(), -l[i])-p.begin();
p[idx] = -l[i];
}
}
cout << ans;
}
컴파일 시 표준 에러 (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... | ||||
