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 pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
const int inf = 1e9;
void create_circuit(int m, vector<int> A){
int n = A.size();
int k = 1;
while(k < n) k*=2;
vector<int> C(m+1, -1), X(k-1), Y(k-1);
C[0] = A[0];
for(int i = 1; i < k/2; i++) X[i-1] = -(2*i), Y[i-1] = -(2*i+1);
for(int i = k; i < 2*k; i++){
int j = i, pos = 0;
while(j != 1){
if(j&1) pos++;
pos<<=1;
j>>=1;
}
pos>>=1;
if(pos == k-1){
if(i&1) Y[i/2-1] = 0;
else X[i/2-1] = 0;
}
else if(pos >= n-1){
if(i&1) Y[i/2-1] = -1;
else X[i/2-1] = -1;
}
else{
if(i&1) Y[i/2-1] = A[pos+1];
else X[i/2-1] = A[pos+1];
}
}
answer(C, X, Y);
}
# | 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... |