| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 470289 | mychecksedad | Global Warming (CEOI18_glo) | C++17 | 64 ms | 5848 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
typedef long long int ll;
#define pb push_back
int n, ans = 0;
ll arr[N], x, dp[N];
int main(){
cin.tie(0); ios::sync_with_stdio(0);
cin >> n >> x;
for(int i = 1; i <= n; i++) cin >> arr[i];
vector<int> lis(1, 0);
for(int j = 1; j <= n; j++){
int pos = lower_bound(lis.begin(), lis.end(), arr[j]) - lis.begin();
if(pos == int(lis.size())) lis.pb(arr[j]);
else lis[pos] = arr[j];
dp[j] = pos;
}
lis.clear();
lis.pb(-1e9);
for(int i = n; i >= 1; i--){
int new_pos = lower_bound(lis.begin(), lis.end(), -(arr[i] - x)) - lis.begin();
ans = max(ll(dp[i] + new_pos)-1, ll(ans));
int pos = lower_bound(lis.begin(), lis.end(), -arr[i]) - lis.begin();
if(pos == lis.size()) lis.pb(-arr[i]);
else lis[pos] = -arr[i];
}
cout << ans;
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... | ||||
