Submission #300994

#TimeUsernameProblemLanguageResultExecution timeMemory
300994TMJNMechanical Doll (IOI18_doll)C++17
Compilation error
0 ms0 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; void create_circuit(int M,vector<int>A) { vector<int>X,Y,C(M+1,0); A.push_back(0); int f=0; for(int i:A){ C[f]=i; f=i; } vector<bool>B(400000,false); int p=0; vector<int>T; do{ if(p>=0){ if(p)T.push_back(p); p=C[p]; } else{ if(B[-p-1]){ B[-p-1]=!B[-p-1]; p=Y[-p-1]; } else{ B[-p-1]=!B[-p-1]; p=X[-p-1]; } } }while(p); assert(A==T); bool f=false; for(int i=0;i<400000;i++){ f|=B[i]; } assert(!f); answer(C,X,Y); }

Compilation message (stderr)

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:33:7: error: conflicting declaration 'bool f'
   33 |  bool f=false;
      |       ^
doll.cpp:8:6: note: previous declaration as 'int f'
    8 |  int f=0;
      |      ^