#include "doll.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
const int inf = 1e7;
void create_circuit(int m, vector<int> A){
int n = A.size();
int k = 1;
while(k < n) k*=2;
vector<int> sth(2*k);
vector<pair<int, int>> candidates;
for(int i = k; i < 2*k; i++){
int j = i, pos = 0;
while(j != 1){
if(j&1) pos++;
pos<<=1;
j>>=1;
}
pos>>=1;
if(2*k-i-1 < n) candidates.pb({pos, i});
sth[i] = -inf;
}
sort(candidates.begin(), candidates.end());
for(int i = 1; i < n; i++) sth[candidates[i-1].sc] = A[i];
sth[candidates.back().sc] = 0;
vector<int> C, X, Y;
for(int i = k-1; i >= 1; i--){
if(sth[2*i] < 0 && sth[2*i+1] < 0){
X.pb(-inf);
Y.pb(-inf);
sth[i] = -int(X.size());
}
else{
int a = sth[2*i], b = sth[2*i+1];
if(a >= inf) a = -(a-inf);
if(b >= inf) b = -(b-inf);
X.pb(a);
Y.pb(b);
sth[i] = inf+X.size();
}
}
int st = -int(X.size());
for(int &x: X) if(x == -inf) x = st;
for(int &x: Y) if(x == -inf) x = st;
C.assign(m+1, st);
C[0] = A[0];
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
2 |
Correct |
39 ms |
7680 KB |
Output is correct |
3 |
Partially correct |
58 ms |
11768 KB |
Output is partially correct |
4 |
Partially correct |
87 ms |
13372 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
2 |
Correct |
39 ms |
7680 KB |
Output is correct |
3 |
Partially correct |
58 ms |
11768 KB |
Output is partially correct |
4 |
Partially correct |
87 ms |
13372 KB |
Output is partially correct |
5 |
Partially correct |
77 ms |
13612 KB |
Output is partially correct |
6 |
Partially correct |
74 ms |
13332 KB |
Output is partially correct |
7 |
Partially correct |
76 ms |
13388 KB |
Output is partially correct |
8 |
Partially correct |
75 ms |
13380 KB |
Output is partially correct |
9 |
Partially correct |
66 ms |
11740 KB |
Output is partially correct |
10 |
Partially correct |
74 ms |
13368 KB |
Output is partially correct |
11 |
Partially correct |
71 ms |
13372 KB |
Output is partially correct |
12 |
Partially correct |
64 ms |
11836 KB |
Output is partially correct |
13 |
Correct |
39 ms |
7700 KB |
Output is correct |
14 |
Partially correct |
60 ms |
12080 KB |
Output is partially correct |
15 |
Partially correct |
68 ms |
12208 KB |
Output is partially correct |
16 |
Partially correct |
2 ms |
724 KB |
Output is partially correct |
17 |
Correct |
40 ms |
7648 KB |
Output is correct |
18 |
Correct |
38 ms |
7652 KB |
Output is correct |
19 |
Partially correct |
60 ms |
11768 KB |
Output is partially correct |
20 |
Partially correct |
72 ms |
13340 KB |
Output is partially correct |
21 |
Partially correct |
79 ms |
13324 KB |
Output is partially correct |
22 |
Partially correct |
77 ms |
13340 KB |
Output is partially correct |