#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*/
vector<int> c(m+1), X, Y;
c[0] = t[0];
for(int i = 0; i < ssize(t)-1; ++i) c[t[i]] = t[i+1];
c[t[ssize(t)-1]] = 0;
answer(c, X, Y);
}
#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 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
14 ms |
1980 KB |
Output is correct |
3 |
Correct |
9 ms |
1628 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
7 ms |
1372 KB |
Output is correct |
6 |
Correct |
14 ms |
2392 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
14 ms |
1980 KB |
Output is correct |
3 |
Correct |
9 ms |
1628 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
7 ms |
1372 KB |
Output is correct |
6 |
Correct |
14 ms |
2392 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Incorrect |
15 ms |
2240 KB |
wrong motion |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
14 ms |
1980 KB |
Output is correct |
3 |
Correct |
9 ms |
1628 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
7 ms |
1372 KB |
Output is correct |
6 |
Correct |
14 ms |
2392 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Incorrect |
15 ms |
2240 KB |
wrong motion |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |