Submission #821394

#TimeUsernameProblemLanguageResultExecution timeMemory
821394BaytoroSplit the Attractions (IOI19_split)C++17
Compilation error
0 ms0 KiB
#include "split.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; const int maxN=1e5+5; vector<int> ans,g[maxN]; void dfs(int x, int d, int c, int p=-1){ if(d==0) return; ans[x]=c; for(auto it: g[x]){ if(it==p) continue; dfs(it,d-1,c,x); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { assert(m==n-1); ans.resize(n); int A=a,B=b,C=c; if(A>B) swap(A,B); if(B>C) swap(B,C); if(A>B) swap(A,B); bool ok=1; for(int i=0;i<(int)p.size();i++){ g[p[i]].push_back(q[i]); g[q[i]].push_back(p[i]); } for(int i=0;i<n;i++){ if(g[i].size()==1 && ok){ dfs(i,a,1); ok=0; } else if(g[i].size()==1 && !ok){ dfs(i,b,2); break; } } for(int i=0;i<n;i++){ if(!ans[i]) ans[i]=3; } return ans; }

Compilation message (stderr)

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from split.cpp:3:
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:16:9: error: 'm' was not declared in this scope
   16 |  assert(m==n-1);
      |         ^