#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
int liscie[1000010];
map<int, int>mapa;
bool czy[1000010];
void create_circuit(int m, std::vector<int> A) {
A.push_back(0);
int n = A.size(), i;
int base = 1;
int log = 1;
while(base<n){
base*=2;
log++;
}
vector<int>pozycje;
for(i=0;i<base;i++){
int x = i;
int res = 0;
int pom = base/2;
while(x>0){
if(x%2)res+=pom;
pom/=2;
x/=2;
}
if(res>=base-n)
pozycje.push_back(res);
}
for(i=0;i<base;i++)liscie[i] = -1;
for(i=0;i<n;i++){
liscie[pozycje[i]] = A[i];
}
//for(auto j: pozycje)printf("%d ", j);printf("\n");
vector<int>C(m+1, -1);
vector<int>X,Y;
for(i=1;i<base;i++){
mapa[i] = i;
if(i*2<base){
X.push_back(-(i*2));
Y.push_back(-(i*2+1));
}
else{
X.push_back(liscie[i*2-base]);
Y.push_back(liscie[i*2+1-base]);
}
}
answer(C, X, Y);return;
for(i=0;i<base;i++)printf("%d ", liscie[i]);
for(i=base-1;i>=1;i--){
if(i*2>=base)
czy[i] = (liscie[i*2+1-base]!=-1);
else
czy[i] = czy[i*2]|czy[i*2+1];
if(!czy[i]){
mapa.erase(i);
}
}
for(i=1;i<base;i++)printf("%d\n", czy[i]);
int it=1;
for(auto &j: mapa){
j.second = it++;
}
vector<int>X1, Y1;
for(int i=1;i<(int)X.size();i++){
if(mapa.find(i)!=mapa.end()){
if(Y[i-1]>-1){
X1.push_back(X[i-1]);
Y1.push_back(Y[i-1]);
}
else{
X1.push_back(-mapa[-X[i-1]]);
Y1.push_back(-mapa[-Y[i-1]]);
}
}
}
answer(C, X1, Y1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
2396 KB |
Output is partially correct |
2 |
Partially correct |
91 ms |
22444 KB |
Output is partially correct |
3 |
Partially correct |
87 ms |
22480 KB |
Output is partially correct |
4 |
Partially correct |
95 ms |
23096 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
2396 KB |
Output is partially correct |
2 |
Partially correct |
91 ms |
22444 KB |
Output is partially correct |
3 |
Partially correct |
87 ms |
22480 KB |
Output is partially correct |
4 |
Partially correct |
95 ms |
23096 KB |
Output is partially correct |
5 |
Partially correct |
99 ms |
23620 KB |
Output is partially correct |
6 |
Partially correct |
96 ms |
23364 KB |
Output is partially correct |
7 |
Partially correct |
94 ms |
23620 KB |
Output is partially correct |
8 |
Partially correct |
95 ms |
23380 KB |
Output is partially correct |
9 |
Partially correct |
87 ms |
22480 KB |
Output is partially correct |
10 |
Partially correct |
93 ms |
23188 KB |
Output is partially correct |
11 |
Partially correct |
95 ms |
23112 KB |
Output is partially correct |
12 |
Partially correct |
87 ms |
22484 KB |
Output is partially correct |
13 |
Partially correct |
88 ms |
22472 KB |
Output is partially correct |
14 |
Partially correct |
91 ms |
22588 KB |
Output is partially correct |
15 |
Partially correct |
100 ms |
22740 KB |
Output is partially correct |
16 |
Partially correct |
3 ms |
3164 KB |
Output is partially correct |
17 |
Correct |
46 ms |
14204 KB |
Output is correct |
18 |
Partially correct |
90 ms |
22484 KB |
Output is partially correct |
19 |
Partially correct |
85 ms |
22476 KB |
Output is partially correct |
20 |
Partially correct |
94 ms |
23284 KB |
Output is partially correct |
21 |
Partially correct |
94 ms |
23156 KB |
Output is partially correct |
22 |
Partially correct |
95 ms |
23344 KB |
Output is partially correct |