This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |