# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
170384 | arnold518 | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 4 ms | 632 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "messy.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int N, W, R;
vector<int> ans;
void put(int s, int e)
{
if(s+1==e) return;
int i, j;
int mid=s+e>>1;
string S(N, '0');
for(i=0; i<N; i++) if(!(s<=i && i<e)) S[i]='1';
for(i=s; i<mid; i++)
{
S[i]='1';
add_element(S);
S[i]='0';
}
put(s, mid);
put(mid, e);
}
void get(int s, int e, vector<int> cand)
{
if(s+1==e)
{
ans[s]=cand[0];
return;
}
int i, j;
int mid=s+e>>1;
string S(N, '0');
for(i=0; i<N; i++) if(!binary_search(cand.begin(), cand.end(), i)) S[i]='1';
vector<int> L, R;
for(auto it : cand)
{
S[it]='1';
if(check_element(S)) L.push_back(it);
else R.push_back(it);
S[it]='0';
}
get(s, mid, L);
get(mid, e, R);
}
vector<int> restore_permutation(int _N, int _W, int _R)
{
int i, j;
N=_N; W=_W; R=_R;
ans.resize(N);
vector<int> V;
for(i=0; i<N; i++) V.push_back(i);
put(0, N);
compile_set();
get(0, N, V);
return 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... |