| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 853345 | vjudge1 | Art Collections (BOI22_art) | C++17 | 610 ms | 1316 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "art.h"
#include <bits/stdc++.h>
using namespace std;
int N, original;
vector<int> order;
bool smaller(int a, int b){
swap(order[a-1], order[b-1]);
int nw = publish(order);
swap(order[a-1], order[b-1]);
if(a < b){
if(nw < original) {
return false; //B is smaller.
} else {
return true; //A is smaller.
}
} else {
if(nw < original) {
return true; //A is smaller
} else {
return false; //B is smaller.
}
}
}
vector<int> merge_sort(int l, int r){
if(l == r){
if(l > N) return {};
else return {l};
}
int m = (l + r) / 2;
vector<int> left = merge_sort(l, m);
vector<int> right = merge_sort(m + 1, r);
vector<int> nw;
int i = 0;
int j = 0;
while(i < (int)left.size() || j < (int)right.size()){
if(i >= (int)left.size()){
nw.push_back(right[j]); j++;
}else if(j >= (int)right.size()){
nw.push_back(left[i]); i++;
}else{
if(smaller(left[i], right[j])){
nw.push_back(left[i]); i++;
}else{
nw.push_back(right[j]); j++;
}
}
}
return nw;
}
void solve(int n) {
N = n;
order.resize(N);
for(int i = 0; i < N; i++) order[i] = i + 1;
original = publish(order);
int pw = 1;
while(pw < N) pw *= 2;
vector<int> ans = merge_sort(1, pw);
answer(ans);
}
컴파일 시 표준 에러 (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... | ||||
