#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
int m;
vector<int> eil;
const int dydis = 800000 + 1100;
int state[dydis] = {};
int X[dydis];
int Y[dydis];
int n;
int dbInd = 0;
int closestPower(int a){
for(int i = a+1; i <= a * 3 + 2; i++){
if(__builtin_popcount(i) == 1) return i;
}
return -1;
}
int dfs(int v){
if(v >= n){
int ret = 0;
if(dbInd == (int)eil.size()) {
ret = -1;
}else{
ret = eil[dbInd++];
}
//cout << "dabar " << ret << "\n";
return ret;
}else{
int sk = dfs(v*2 + state[v]);
if(state[v] == 0) X[v-1] = sk;
else Y[v-1] = sk;
state[v] = !state[v];
return -v;
}
}
void create_circuit(int M, vector<int> A) {
eil = A;
vector<int> C(M+1, -1); C[0] = -1;
n = closestPower(A.size());
//cout << "n = " << n << endl;
for(int i = 0; i < n; i++) dfs(1);
vector<int> XX;
for(int i = 0; i < n-1; i++){
XX.push_back(X[i]);
//cout << -(i+1) << " x-as yra " << X[i] << endl;
}
vector<int> YY;
for(int i = 0; i < n-1; i++) {
YY.push_back(Y[i]);
//cout << -i - 1 << " y-as yra " << Y[i] << endl;
}
YY[YY.size()-1] = 0;
// cout << "arciausias " << A.size() << " laipsnis yra " << n << endl;
answer(C, XX, YY);
return ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
2 |
Partially correct |
145 ms |
11324 KB |
Output is partially correct |
3 |
Partially correct |
146 ms |
11192 KB |
Output is partially correct |
4 |
Partially correct |
155 ms |
12008 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
2 |
Partially correct |
145 ms |
11324 KB |
Output is partially correct |
3 |
Partially correct |
146 ms |
11192 KB |
Output is partially correct |
4 |
Partially correct |
155 ms |
12008 KB |
Output is partially correct |
5 |
Partially correct |
158 ms |
12336 KB |
Output is partially correct |
6 |
Partially correct |
174 ms |
12088 KB |
Output is partially correct |
7 |
Partially correct |
160 ms |
12180 KB |
Output is partially correct |
8 |
Partially correct |
158 ms |
12048 KB |
Output is partially correct |
9 |
Partially correct |
146 ms |
11200 KB |
Output is partially correct |
10 |
Partially correct |
178 ms |
12088 KB |
Output is partially correct |
11 |
Partially correct |
155 ms |
11952 KB |
Output is partially correct |
12 |
Partially correct |
145 ms |
11216 KB |
Output is partially correct |
13 |
Partially correct |
152 ms |
11232 KB |
Output is partially correct |
14 |
Partially correct |
149 ms |
11308 KB |
Output is partially correct |
15 |
Partially correct |
165 ms |
11300 KB |
Output is partially correct |
16 |
Partially correct |
4 ms |
716 KB |
Output is partially correct |
17 |
Correct |
77 ms |
6600 KB |
Output is correct |
18 |
Partially correct |
162 ms |
11200 KB |
Output is partially correct |
19 |
Partially correct |
142 ms |
11196 KB |
Output is partially correct |
20 |
Partially correct |
165 ms |
12084 KB |
Output is partially correct |
21 |
Partially correct |
157 ms |
12004 KB |
Output is partially correct |
22 |
Partially correct |
188 ms |
12080 KB |
Output is partially correct |