Submission #463709

#TimeUsernameProblemLanguageResultExecution timeMemory
463709tomsydMechanical Doll (IOI18_doll)C++17
0 / 100
8 ms812 KiB
#include "doll.h" #include<bits/stdc++.h> using namespace std; void create_circuit(int M, vector<int> A) { if (M == A.size()){ vector<int> C(M + 1); C[0] = A[0]; int N = A.size(); for (int i = 0; i<N-1; ++i) { C[A[i]] = A[i+1]; } C[A[N-1]] = 0; vector<int> X,Y; answer(C, X, Y); } else if (M == 1){ int pow2 = 1, N = A.size(); while (pow2 < N) pow2 <<= 1; vector<int> X(2*pow2),Y(2*pow2); for (int i=0; i<pow2; ++i){ X[i] = 2*(i+1)+1; Y[i] = 2*(i+1)+2; } while (pow2 > N+1){ pow2--; X.pop_back(); Y.pop_back(); } vector<int> C(M+1); C[0] = 1; C[1] = -1; X[X.size()-1] = 1; Y[Y.size()-1] = 0; int idx = X.size()-2, crt = N-1; while (crt > 0){ X[idx] = 1; Y[idx] = 1; idx--; crt -= 2; } answer(C,X,Y); } }

Compilation message (stderr)

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:6:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |  if (M == A.size()){
      |      ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...