#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void create_circuit(int M, std::vector<int> A) {
int N = A.size();
vector<int> res(M+1,-1), x, y;
res[0] = A[0];
int logn = 1, size = 1;
while(size<N){
size*=2;
logn++;
}
int size2 = size/2;
bool womp[(int)1e6] = {0};
function<void(int,int,int,int)> push = [&](int pos,int parent, int lx, int rx) {
if(rx-lx==1) return;
if(rx<size-N) {
womp[parent] = true;
return;
}
int m = (lx+rx)/2;
push(2*pos,pos, lx,m); push(2*pos+1,pos,m,rx);
};
push(1,1,0,size);
int cnt = 0;
for(int i = 1; i<size2; i++) {
cnt++;
if(womp[i]) {
x.pb(-1);
y.pb(-cnt-1);
continue;
}
cnt++;
x.pb(-cnt);y.pb(-cnt-1);
}
vector<int> list = {1};
while(size2>0){
int pp = list.size();
for(int i = 0; i<pp; i++) list.pb(list[i]+size2);
size2>>=1;
}
vector<int> compress;
for(int i = size-N; i<size; i++) compress.pb(list[i]);
sort(compress.begin(),compress.end());
for(int& xx : list) xx = lower_bound(compress.begin(),compress.end(),xx)-compress.begin()+1;
A.pb(0);
if(N&1)x.pb(-1);
for(int i = size-N; i<size; i++){
if(i&1) y.pb(A[list[i]]);
else x.pb(A[list[i]]);
}
answer(res,x,y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
1368 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
1368 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
1368 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1372 KB |
Output is correct |
2 |
Correct |
1 ms |
1372 KB |
Output is correct |
3 |
Correct |
0 ms |
1372 KB |
Output is correct |
4 |
Correct |
0 ms |
1372 KB |
Output is correct |
5 |
Correct |
1 ms |
1372 KB |
Output is correct |
6 |
Correct |
0 ms |
1372 KB |
Output is correct |
7 |
Correct |
0 ms |
1372 KB |
Output is correct |
8 |
Correct |
0 ms |
1372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
1372 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
1372 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |