#include "doll.h"
#include <bits/stdc++.h>
#define MAXM 100005
using namespace std;
int N, M, S, cnt;
vector < int > A, C, X, Y;
vector < int > r ( 1, 1 );
void max_self ( int& _a, int _b )
{
_a = max ( _a, _b );
}
void create_circuit ( int _M, vector <int> _A )
{
N = _A.size();
M = _M;
swap ( A, _A );
C.resize ( M + 1 );
C[0] = A[0];
for ( int i = 1; i <= M; i++ )
C[i] = -1;
vector < int > aux;
while ( 2 * r.size() < A.size() )
{
aux.clear();
for ( auto i : r )
aux.push_back ( 2*i );
for ( auto i : r )
aux.push_back ( 2*i + 1 );
swap ( aux, r );
}
X.resize ( 2*r.size() - 1, -1 );
Y.resize ( 2*r.size() - 1, -1 );
Y[r[r.size() - 1] - 1] = 0;
for ( int i = 1; i < r[0]; i++ )
{
X[i - 1] = -(2*i);
Y[i - 1] = -(2*i + 1);
}
for ( auto i : r )
{
cnt++;
if ( cnt >= A.size() )
break;
X[i - 1] = A[cnt];
}
for ( auto i : r )
{
cnt++;
if ( cnt >= A.size() )
break;
Y[i - 1] = A[cnt];
}
answer ( C, X, Y );
}
Compilation message
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:50:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | if ( cnt >= A.size() )
| ~~~~^~~~~~~~~~~
doll.cpp:57:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
57 | if ( cnt >= A.size() )
| ~~~~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
2 |
Correct |
48 ms |
5188 KB |
Output is correct |
3 |
Partially correct |
79 ms |
8784 KB |
Output is partially correct |
4 |
Partially correct |
85 ms |
9096 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
2 |
Correct |
48 ms |
5188 KB |
Output is correct |
3 |
Partially correct |
79 ms |
8784 KB |
Output is partially correct |
4 |
Partially correct |
85 ms |
9096 KB |
Output is partially correct |
5 |
Partially correct |
96 ms |
10308 KB |
Output is partially correct |
6 |
Partially correct |
106 ms |
10104 KB |
Output is partially correct |
7 |
Partially correct |
110 ms |
10104 KB |
Output is partially correct |
8 |
Partially correct |
86 ms |
9884 KB |
Output is partially correct |
9 |
Partially correct |
70 ms |
8628 KB |
Output is partially correct |
10 |
Partially correct |
90 ms |
9828 KB |
Output is partially correct |
11 |
Partially correct |
92 ms |
9572 KB |
Output is partially correct |
12 |
Partially correct |
72 ms |
8988 KB |
Output is partially correct |
13 |
Correct |
48 ms |
5476 KB |
Output is correct |
14 |
Partially correct |
73 ms |
9332 KB |
Output is partially correct |
15 |
Partially correct |
131 ms |
9464 KB |
Output is partially correct |
16 |
Partially correct |
3 ms |
588 KB |
Output is partially correct |
17 |
Correct |
47 ms |
5436 KB |
Output is correct |
18 |
Correct |
46 ms |
5400 KB |
Output is correct |
19 |
Partially correct |
73 ms |
8944 KB |
Output is partially correct |
20 |
Partially correct |
85 ms |
9768 KB |
Output is partially correct |
21 |
Partially correct |
81 ms |
9524 KB |
Output is partially correct |
22 |
Partially correct |
86 ms |
9508 KB |
Output is partially correct |