| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 731794 | beaboss | Global Warming (CEOI18_glo) | C++14 | 108 ms | 4304 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
#define s second
#define f first
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
// const int INF = 1e17;
const int N = 2*1e5 + 10;
int main() {
int n, x;
cin >> n >> x;
vi vals(n);
vi dp(n);
vi cur;
for (int i = 0; i < n; i++) {
cin >> vals[i];
auto ind = lower_bound(cur.begin(), cur.end(), vals[i]) - cur.begin();
if (ind == cur.size()) cur.pb(vals[i]);
else cur[ind] = vals[i];
// cout << i << ind << endl;
dp[i]=ind+1;
}
cur.erase(cur.begin(), cur.end());
int ans = 0;
for (int i = n-1; i >= 0; i--) {
int possible = lower_bound(cur.begin(), cur.end(), -vals[i] + x) - cur.begin();
// cout << i << possible << dp[i] << endl;
ans = max(ans, dp[i] + possible);
int ind = lower_bound(cur.begin(), cur.end(), -vals[i]) - cur.begin();
if (ind == cur.size()) cur.pb(-vals[i]);
else cur[ind]=-vals[i];
}
// cout << cur.size() << endl;
// assert(dp[n-1] == cur.size());
cout << ans << endl;
}컴파일 시 표준 에러 (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... | ||||
