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>
using namespace std;
int n, m, tN;
vector<int> x, y, a;
int build(int s, int t) {
if(s+t >= tN) {
if(s == tN-1) return 0;
if(s >= n) return -1e9;
return a[s];
}
int A = build(s, 2*t);
int B = build(s+t, 2*t);
x.push_back(A);
y.push_back(B);
//cout << -(int)x.size() << " " << s << " " << t << " // " << A << " " << B << '\n';
return -(int)x.size();
}
void create_circuit(int M, vector<int> A) {
n = A.size(), m = M;
a = A;
tN = n+1;
//printf("%d %d", tN, n);
while(tN&(tN-1)) tN++;
//printf("%d %d", tN, n);
build(0, 1);
for(int i = 0; i < x.size(); i++) {
if(x[i] == -1e9) x[i] = -(int)x.size();
if(y[i] == -1e9) y[i] = -(int)x.size();
}
vector<int> C(M + 1, -(int)x.size());
answer(C, x, y);
}
Compilation message (stderr)
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
27 | for(int i = 0; i < x.size(); i++) {
| ~~^~~~~~~~~~
# | 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... |