| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 926298 | VMaksimoski008 | Global Warming (CEOI18_glo) | C++14 | 2031 ms | 14672 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
//#define int long long
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;
const double eps = 1e-9;
struct BIT {
int n;
vector<int> tree;
void config(int _n) {
n = _n + 10;
tree.resize(_n+60);
}
void update(int p, int v) {
for(p++; p<n; p+=p&-p) tree[p] = max(tree[p], v);
}
int query(int p) {
int ans = 0;
for(p++; p>0; p-=p&-p) ans = max(ans, tree[p]);
return ans;
}
void clear() { for(int i=0; i<tree.size(); i++) tree[i] = 0; }
};
int32_t main() {
int n, X, ans = 0;
cin >> n >> X;
set<int> s;
vector<int> v(n+1);
for(int i=1; i<=n; i++) {
cin >> v[i];
s.insert(v[i]); s.insert(v[i] - X);
}
vector<int> comp(all(s));
BIT bit;
bit.config(2*n);
for(int i=0; i<=n; i++) {
v[i] -= X;
for(int i=1; i<=n; i++) {
int p = lower_bound(all(comp), v[i]) - comp.begin();
bit.update(p, bit.query(p-1) + 1);
}
ans = max(ans, bit.query(2*n));
bit.clear();
}
cout << ans << '\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... | ||||
