#ifdef LOCAL
#else
#include "doll.h"
#endif
#include <bits/stdc++.h>
#define fi first
#define se second
#define ssize(x) int(x.size())
#define pn printf("\n")
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int inf = 2e09; ll infll = 2e18;
void create_circuit(int m, vector<int> t){
t.emplace_back(0); int n = ssize(t);
vector<int> c(m+1);
int base = 1, log = 0;
while(base < n) base <<= 1, ++log;
while(ssize(t) != base) t.emplace_back(-1);
vector<int> tmp0, tmp1;
for(int len = base; len > 2; len >>= 1){
for(int p = 0; p < base; p += len){
tmp0 = vector<int>(), tmp1 = vector<int>();
for(int i = p; i < p+len; ++i) if(i&1) tmp1.emplace_back(t[i]);
else tmp0.emplace_back(t[i]);
for(int i = 0; i < len/2; ++i) t[i+p] = tmp0[i];
for(int i = len/2; i < len; ++i) t[i+p] = tmp1[i-len/2];
}
}
for(int i = 0; i < base; ++i) if(t[i] == 0){ swap(t[i], t[base-1]); break; }
vector<int> X, Y;
for(int i = 1; i < base/2; ++i) X.emplace_back(-(i<<1)), Y.emplace_back(-(i<<1|1));
for(int i = base/2; i < base; ++i) X.emplace_back(t[(i<<1)-base]), Y.emplace_back(t[(i<<1|1)-base]);
for(int i = 0; i <= m; ++i) c[i] = -1;
#ifdef LOCAL
for(int i = 0; i < ssize(X); ++i) printf("%d %d\n", X[i], Y[i]);
#else
answer(c, X, Y);
#endif
}
#ifdef LOCAL
int main(){
int T = 1;
for(++T; --T; ){
int m, n; scanf("%d%d", &m, &n);
vector<int> A(n);
for(int i = 0; i < n; ++i) scanf("%d", &A[i]);
create_circuit(m, A);
}
return 0;
}
#endif
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
Output is partially correct |
2 |
Partially correct |
67 ms |
9196 KB |
Output is partially correct |
3 |
Partially correct |
66 ms |
9128 KB |
Output is partially correct |
4 |
Partially correct |
74 ms |
10024 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
Output is partially correct |
2 |
Partially correct |
67 ms |
9196 KB |
Output is partially correct |
3 |
Partially correct |
66 ms |
9128 KB |
Output is partially correct |
4 |
Partially correct |
74 ms |
10024 KB |
Output is partially correct |
5 |
Partially correct |
74 ms |
10308 KB |
Output is partially correct |
6 |
Partially correct |
75 ms |
10284 KB |
Output is partially correct |
7 |
Partially correct |
78 ms |
10312 KB |
Output is partially correct |
8 |
Partially correct |
73 ms |
10244 KB |
Output is partially correct |
9 |
Partially correct |
67 ms |
9184 KB |
Output is partially correct |
10 |
Partially correct |
78 ms |
10228 KB |
Output is partially correct |
11 |
Partially correct |
71 ms |
10048 KB |
Output is partially correct |
12 |
Partially correct |
76 ms |
9148 KB |
Output is partially correct |
13 |
Partially correct |
69 ms |
9128 KB |
Output is partially correct |
14 |
Partially correct |
68 ms |
9128 KB |
Output is partially correct |
15 |
Partially correct |
79 ms |
9296 KB |
Output is partially correct |
16 |
Partially correct |
2 ms |
604 KB |
Output is partially correct |
17 |
Correct |
38 ms |
6732 KB |
Output is correct |
18 |
Partially correct |
67 ms |
9128 KB |
Output is partially correct |
19 |
Partially correct |
73 ms |
9120 KB |
Output is partially correct |
20 |
Partially correct |
77 ms |
10052 KB |
Output is partially correct |
21 |
Partially correct |
72 ms |
10052 KB |
Output is partially correct |
22 |
Partially correct |
71 ms |
10436 KB |
Output is partially correct |