| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 234094 | super_j6 | Exhibition (JOI19_ho_t2) | C++14 | 5 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second
const int maxn = 100000;
int n, m;
pi a[maxn];
int b[maxn], p[maxn];
vector<pi> v;
bool works(int x){
for(int i = v[x].s, j = m - 1; ~i; i = p[i], j--){
if(b[j] < a[i].s) return 0;
}
return 1;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for(int i = 0; i < n; i++) cin >> a[i].s >> a[i].f;
for(int i = 0; i < m; i++) cin >> b[i];
sort(a, a + n);
sort(b, b + m);
for(int i = 0; i < n; i++){
int it = lower_bound(v.begin(), v.end(), (pi){a[i].s, n}) - v.begin();
if(it < v.size()) v[it] = {a[i].s, i};
else v.push_back({a[i].s, i});
p[i] = it ? v[it - 1].s : -1;
}
int l = -1, r = min(m, (int)v.size());
while(r - l > 1){
int mid = (l + r) / 2;
if(works(mid)) l = mid;
else r = mid;
}
cout << (l + 1) << endl;
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... | ||||
