| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 97414 | silxikys | Exhibition (JOI19_ho_t2) | C++14 | 3 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 20;
int N, M;
int frames[maxn];
int main()
{
cin >> N >> M;
vector<pair<int,int>> pictures;
for (int i = 0; i < N; i++) {
int a, b; cin >> a >> b;
pictures.push_back({a,b});
}
//coordinate compress values
sort(pictures.begin(),pictures.end(),[](auto a, auto b) {
return a.second < b.second;
});
map<int,int> comp;
int c = 1;
for (auto& p: pictures) {
if (comp.count(p.second)) p.second = comp[p.second];
else p.second = comp[p.second] = c++;
}
sort(pictures.begin(),pictures.end());
for (int i = 1; i <= M; i++) cin >> frames[i];
sort(frames+1,frames+M+1);
int ans = 0;
for (int mask = 1; mask < (1<<N); mask++) {
vector<pair<int,int>> vs;
bool poss = true;
for (int i = 0; i < N; i++) {
if (mask & (1<<i)) {
vs.push_back(pictures[i]);
if (vs.size() > 1 && vs[vs.size()-1].second < vs[vs.size()-2].second) {
poss = false;
break;
}
}
}
if (vs.size() > M) continue;
if (poss) {
int curr = M;
for (int i = vs.size() - 1; i >= 0; i--) {
if (vs[i].first > frames[curr]) {
poss = false;
break;
}
curr--;
}
}
if (poss) {
ans = min(max(ans,(int)vs.size()),M);
}
}
cout << ans << '\n';
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
