#include <bits/stdc++.h>
#define pb push_back
#include "doll.h"
using namespace std;
#ifdef DEBUGGING
#include "../debug.h"
#else
#define debug(x...) void(42)
#endif
vector<int> a;
vector<int> x, y;
int n, m;
void create_circuit(int M, vector<int> A)
{
a = A;
if (a.size() == (a.size()&(-a.size())))
a.pb(0);
n = a.size();
int step_count = (a.size()+1)>>1;
int i;
for (i = 0; i+step_count < a.size(); i++)
{
x.pb(a[i]);
y.pb(a[i+step_count]);
}
if (i < step_count)
{
x.pb(a[i]);
y.pb(0);
}
int l = 0, r = x.size();
debug(x, y);
int depth = 0;
while ((r-l) > 1)
{
depth++;
step_count = (r+1 - l)/2;
debug(step_count);
debug(l, r);
for (i = l; i+step_count < r; i++)
{
x.pb(-i-1);
y.pb(-i-step_count-1);
}
if (1&(r-l))
{
x.pb(-i-1);
y.pb(0);
}
l = r;
r = x.size();
}
debug(x, y, depth);
int oooo = -x.size();
for (int i = 0; i < x.size(); i++)
{
if (x[i] == 0)
x[i] = -x.size();
if (y[i] == 0)
y[i] = -y.size();
}
int last = -x.size();
i = x.size()-1;
int d = 0;
while (y[i] != -x.size())
{
d++;
i = -y[i]-1;
}
debug(i);
y[i] = -x.size()-1;
int lss = i;
while (d < depth)
{
int ss = x.size();
d++;
x.pb(last);
y.pb(-ss-2);
lss = y.size()-1;
}
y[lss] = 0;
vector<int> c(M+1, oooo);
debug(x, y);
debug(c, x, y);
answer(c, x, y);
}
Compilation message
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:26:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
26 | for (i = 0; i+step_count < a.size(); i++)
| ~~~~~~~~~~~~~^~~~~~~~~~
doll.cpp:60:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
60 | for (int i = 0; i < x.size(); i++)
| ~~^~~~~~~~~~
doll.cpp:70:14: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
70 | while (y[i] != -x.size())
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
2 |
Partially correct |
29 ms |
6464 KB |
Output is partially correct |
3 |
Partially correct |
29 ms |
6460 KB |
Output is partially correct |
4 |
Partially correct |
47 ms |
9016 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
2 |
Partially correct |
29 ms |
6464 KB |
Output is partially correct |
3 |
Partially correct |
29 ms |
6460 KB |
Output is partially correct |
4 |
Partially correct |
47 ms |
9016 KB |
Output is partially correct |
5 |
Partially correct |
50 ms |
9828 KB |
Output is partially correct |
6 |
Partially correct |
48 ms |
9452 KB |
Output is partially correct |
7 |
Partially correct |
48 ms |
9580 KB |
Output is partially correct |
8 |
Partially correct |
47 ms |
9196 KB |
Output is partially correct |
9 |
Partially correct |
31 ms |
6512 KB |
Output is partially correct |
10 |
Partially correct |
47 ms |
9224 KB |
Output is partially correct |
11 |
Partially correct |
46 ms |
9024 KB |
Output is partially correct |
12 |
Partially correct |
29 ms |
6676 KB |
Output is partially correct |
13 |
Partially correct |
32 ms |
7164 KB |
Output is partially correct |
14 |
Partially correct |
38 ms |
7272 KB |
Output is partially correct |
15 |
Partially correct |
32 ms |
7476 KB |
Output is partially correct |
16 |
Partially correct |
1 ms |
468 KB |
Output is partially correct |
17 |
Correct |
30 ms |
6088 KB |
Output is correct |
18 |
Partially correct |
37 ms |
6768 KB |
Output is partially correct |
19 |
Partially correct |
34 ms |
6664 KB |
Output is partially correct |
20 |
Partially correct |
46 ms |
9144 KB |
Output is partially correct |
21 |
Partially correct |
45 ms |
8936 KB |
Output is partially correct |
22 |
Partially correct |
49 ms |
9024 KB |
Output is partially correct |