Submission #831519

#TimeUsernameProblemLanguageResultExecution timeMemory
831519TrumlingStations (IOI20_stations)C++17
Compilation error
0 ms0 KiB
#include "stations.h" #include <vector> #include<bits/stdc++.h> using namespace std; #define F first #define S second #define all(x) x.begin(),x.end() typedef long long ll; #define pb push_back #define INF 99999999999 ll nn; vector<vector<int>>g; vector<vector<vector<int> > >dic; ll here=0; vector<int>labels; void dfs(int beg,int sec,int start,int pre) { //assert(beg<nn); dic[beg][sec].pb(start); for(auto x:g[start]) if(pre!=x) dfs(beg,sec,x,start); } vector<int> label(int n, int k, vector<int> u, vector<int> v) { nn=n; dic.assign(n+1,vector<vector<int>>(n+1,vector<int>())); g.assign(n+1,vector<int>()); labels.assign(n,0); vector<bool>cnt(n,0); for (int i = 0; i < n-1; i++) { g[u[i]].pb(v[i]); g[v[i]].pb(u[i]); } for(int i=0;i<n;i++) { labels[i]=i; for(auto x:g[i]) dfs(i,x,x,i); } return labels; } int find_next_station(int s, int t, vector<int> c) { for(auto x:c) { assert(s<n); for(auto y:dic[s][x]) if(y==t) return x; } } /* 1 6 10000 0 1 1 2 2 3 1 4 4 5 */

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 stations.cpp:3:
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:57:13: error: 'n' was not declared in this scope
   57 |    assert(s<n);
      |             ^
stations.cpp:65:5: warning: control reaches end of non-void function [-Wreturn-type]
   65 |     }
      |     ^