Submission #542805

#TimeUsernameProblemLanguageResultExecution timeMemory
542805Sho10Mechanical Doll (IOI18_doll)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho #include "doll.h" using ll=int; using ld=long double; int const INF=1000000005; //ll const LINF=1000000000000000005; int const nmax = 400000; ll const mod=1000000007; ld const PI=3.14159265359; #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define f first #define s second #define pb push_back #define mp make_pair #define endl '\n' #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; ll lt[nmax+1],rt[nmax+1],b[nmax+1],ans[nmax+1],switches=0,added=0; vector<int>a; ll creategraph(ll nodes,ll realnodes){ if(realnodes==0){ return -1; } if(nodes==1){ return (added++); } ll centr=-(++switches); lt[-centr]=creategraph(nodes/2,realnodes-min(int(nodes/2),realnodes)); rt[-centr]=creategraph(nodes/2,min(int(nodes/2),realnodes)); return centr; } ll dfs(ll node){ if(node>=0){ return node; } b[-node]=!b[-node]; if(b[-node]==1){ dfs(lt[-node]); }else dfs(rt[-node]); } void create_circuit(int M,vector<int>A){ vector<int>C(M+1); C[0]=-1; for(int i=1;i<=M;i++) { c[i]=-1; } for(ll i=0;i<A.size();i++) { a.pb(A[i]); } a.pb(0); int nodes=1; while(nodes<a.size()){ nodes*=2; } creategraph(nodes,a.size()); for(int i=0;i<a.size();i++) { ans[dfs(-1)]=a[i]; } vector<int>X(switches),Y(switches); for(ll k=1;k<=switches;k++) { X[k-1]=lt[k]; Y[k-1]=rt[k]; if(X[k-1]>=0){ X[k-1]=ans[X[k-1]]; } if(Y[k-1]>=0){ Y[k-1]=ans[Y[k-1]]; } } answer(C,X,Y); }

Compilation message (stderr)

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:47:5: error: 'c' was not declared in this scope
   47 |     c[i]=-1;
      |     ^
doll.cpp:49:13: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 | for(ll i=0;i<A.size();i++)
      |            ~^~~~~~~~~
doll.cpp:55:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 | while(nodes<a.size()){
      |       ~~~~~^~~~~~~~~
doll.cpp:59:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 | for(int i=0;i<a.size();i++)
      |             ~^~~~~~~~~
doll.cpp: In function 'll dfs(ll)':
doll.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
   41 | }
      | ^