Submission #965949

#TimeUsernameProblemLanguageResultExecution timeMemory
965949anangoMechanical Doll (IOI18_doll)C++17
0 / 100
1 ms348 KiB
#include "doll.h" #include <bits/stdc++.h> #define int long long using namespace std; int m; int n; int MAXN=1; int depth=0; vector<int> C; vector<int> X; vector<int> Y; void update(int pos, int val) { pos+=MAXN/2; if (pos%2==0) { X[pos] = val; } else { Y[pos] = val; } pos/=2; while (pos>1) { int par=pos/2; if (pos%2==0) { X[par] = pos; } else { Y[par] = pos; } pos=par; } } int binrev(int v) { unsigned int r = v; int s = sizeof(v) * CHAR_BIT - 1; for (v >>= 1; v; v >>= 1) { r <<= 1; r |= v & 1; s--; } r <<= s; return r; } void create_circuit(signed M, vector<signed> A) { int N = A.size(); N++; A.push_back(0); //top of the tree = 1 //sons of i are 2*i and 2*i+1 for (int i=1; i<100; i++) { MAXN*=2; if (MAXN>N) { depth=i; break; } } int S=MAXN; C=vector<int>(M+1); X=vector<int>(S,1); Y=vector<int>(S,1); C[0] = -1; int lef=MAXN/2; int ri=N-MAXN; for (int i=0; i<lef; i++) { update(i,A[binrev(i)]); } for (int i=ri; i<MAXN; i++) { update(i, A[i-ri+lef]); } vector<int32_t> C2(M+1,1); vector<int32_t> X2(S,1); vector<int32_t> Y2(S,1); for (int i=0; i<C.size(); i++) { C2[i] = C[i]; } for (int i=0; i<X.size(); i++) { X2[i] = X[i]; } for (int i=0; i<Y.size(); i++) { Y2[i] = Y[i]; } answer(C2, X2, Y2); }

Compilation message (stderr)

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:76:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |     for (int i=0; i<C.size(); i++) {
      |                   ~^~~~~~~~~
doll.cpp:80:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |     for (int i=0; i<X.size(); i++) {
      |                   ~^~~~~~~~~
doll.cpp:84:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   84 |     for (int i=0; i<Y.size(); i++) {
      |                   ~^~~~~~~~~
#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...