| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1291896 | lmquan | Global Warming (CEOI18_glo) | C++20 | 43 ms | 4296 KiB |
#define taskname ""
#include <bits/stdc++.h>
using namespace std;
const int kInf = 2000000000;
int main() {
if (fopen(taskname".inp", "r")) {
freopen(taskname".inp", "r", stdin);
freopen(taskname".out", "w", stdout);
}
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, x;
cin >> n >> x;
vector<int> t(n + 1);
for (int i = 1; i <= n; i++) {
cin >> t[i];
}
vector<int> a(n + 1), e(n, kInf);
for (int i = 1; i <= n; i++) {
int u = lower_bound(e.begin(), e.end(), t[i]) - e.begin();
a[i] = u + 1, e[u] = t[i];
}
vector<int> b(n + 1), f(n, kInf);
for (int i = n; i >= 1; i--) {
int u = lower_bound(f.begin(), f.end(), x - t[i]) - f.begin();
int v = lower_bound(f.begin(), f.end(), -t[i]) - f.begin();
b[i] = u + 1, f[v] = -t[i];
}
int result = 0;
for (int i = 1; i <= n; i++) {
result = max(result, a[i] + b[i] - 1);
}
cout << result;
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... | ||||
