# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
282763 | doowey | Global Warming (CEOI18_glo) | C++14 | 42 ms | 8048 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll inf = (ll)1e10;
int main(){
fastIO;
int n;
ll x;
cin >> n >> x;
vector<ll> v(n);
for(int i = 0 ; i < n; i ++ ){
cin >> v[i];
}
vector<int> g;
vector<pii> nx;
int res = 1;
int mid, l, r;
int sh;
for(int i = n-1; i >= 0 ; i -- ){
sh = v[i];
l = 0, r = (int)g.size();
while(l < r){
mid = (l + r) / 2;
if(g[mid] <= sh)
r = mid;
else
l = mid + 1;
}
if(l == g.size()){
nx.push_back(mp(sh, -1));
g.push_back(sh);
}
else{
nx.push_back(mp(g[l], l));
g[l]=sh;
}
}
vector<int> cc;
int nl, nr;
int id;
for(int i = 0 ; i < 4; i ++ ){
if(nx.back().se == -1){
g.pop_back();
}
else{
g[nx.back().se] = nx.back().fi;
}
nx.pop_back();
sh = v[i]-x;
l=0,r=cc.size();
while(l < r){
mid = (l + r) / 2;
if(cc[mid] < sh)
l = mid + 1;
else
r = mid;
}
id = l;
if(id == cc.size()){
cc.push_back(sh);
}
else{
cc[id] = sh;
}
l = 0, r = g.size();
while(l + 1 < r){
mid = (l + r) / 2;
if(g[mid] > sh)
l = mid;
else
r = mid;
}
res = max(res, (id+1)+l+(g[l]>sh));
}
cout << res << "\n";
return 0;
}
컴파일 시 표준 에러 (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... |