Submission #255523

#TimeUsernameProblemLanguageResultExecution timeMemory
255523HeheheToy Train (IOI17_train)C++14
Compilation error
0 ms0 KiB
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("no-stack-protector") #pragma GCC target("sse,sse2,ssse3,sse3,sse4,popcnt,avx,mmx,abm") #include "train.h" #include <bits/stdc++.h> #define DEBUG 1 using namespace std; namespace output{ void __(short x){cout<<x;} void __(unsigned x){cout<<x;} void __(int x){cout<<x;} void __(long long x){cout<<x;} void __(unsigned long long x){cout<<x;} void __(double x){cout<<x;} void __(long double x){cout<<x;} void __(char x){cout<<x;} void __(const char*x){cout<<x;} void __(const string&x){cout<<x;} void __(bool x){cout<<(x?"true":"false");} template<class S,class T> void __(const pair<S,T>&x){__(DEBUG?"(":""),__(x.first),__(DEBUG?", ":" "),__(x.second),__(DEBUG?")":"");} template<class T> void __(const vector<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");} template<class T> void __(const set<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");} template<class T> void __(const multiset<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");} template<class S,class T> void __(const map<S,T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");} void pr(){cout<<"\n";} template<class S,class... T> void pr(const S&a,const T&...b){__(a);if(sizeof...(b))__(' ');pr(b...);} } using namespace output; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<int,char> pic; typedef pair<double,double> pdd; typedef pair<ld,ld> pld; typedef vector<int> vi; typedef vector<ll> vl; #define pb push_back #define fox(i,x,y) for(int i=(x);i<=(y);i++) #define foxr(i,x,y) for(int i=(y);i>=(x);i--) const int MN = 5005; int N, M, i, j, x, ok[MN], deg[MN], arr[MN], ch[MN], vs[MN], prop[MN], rf[MN], dn; vi adj[MN]; queue<int> q; inline void bfs(){ for(i=0;i<N;i++) deg[i]=vs[i]=prop[i]=0, rf = ok[i]; for(i=0;i<N;i++){ for(auto v : adj[i]) deg[v]++; } for(i=0;i<N;i++){ if(!ok[i] || !ch[i])continue; for(auto v : adj[i]){ if(vs[v]) continue; if(arr[v]||!(--deg[v])){ vs[v]=1; q.push(v); } } prop[i]=1; } for(i=0;i<N;i++)ok[i] = 0; while(q.size()){ x=q.front(); q.pop(); ok[x]=1; if(prop[x]) continue; for(auto v : adj[x]){ if(vs[v]) continue; if(arr[v]||!(--deg[v])){ vs[v]=1; q.push(v); } } } int fl=0; for(i=0;i<N;i++){ if(ok[i]!=rf[i]) fl=1; } if(!fl) dn=1; } vi who_wins(vi a,vi r,vi u,vi v){ N = (int)a.size(); M = (int)u.size(); for(i=0;i<N;i++) arr[i]=a[i],ch[i]=r[i]; for(i=0;i<M;i++) adj[v[i]].pb(u[i]); memset(ok,1,sizeof(ok)); for(j=0;j<N&&!dn;j++) bfs(); vi res; for(i=0;i<N;i++) res.pb(ok[i]); return res; }

Compilation message (stderr)

train.cpp: In function 'void bfs()':
train.cpp:59:42: error: incompatible types in assignment of 'int' to 'int [5005]'
         deg[i]=vs[i]=prop[i]=0, rf = ok[i];
                                          ^