Submission #372927

#TimeUsernameProblemLanguageResultExecution timeMemory
372927Jarif_RahmanStations (IOI20_stations)C++17
0 / 100
898 ms5772 KiB
#include "stations.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; struct graph{ int n; vector<vector<int>> v; graph(){} graph(int nn){ n = nn; v.assign(n, {}); } void add(vector<int> aa, vector<int> bb){ for(int i = 0; i < aa.size(); i++){ v[aa[i]].pb(bb[i]); v[bb[i]].pb(aa[i]); } } }g(1e5); int r = 0, rr = 0; vector<int> label(int n, int k, vector<int> aa, vector<int> bb){ vector<int> lb(n); for(int i = 0; i < n; i++) lb[i] = rr++; for(int i = 0; i < n-1; i++) aa[i] = lb[aa[i]], bb[i] = lb[bb[i]]; g.add(aa, bb); return lb; } vector<int> cur; int ans; void dfs(int nd, int ss, int tt){ if(nd == tt){ ans = cur.front(); return; } if(ans != -1) return; for(int x: g.v[nd]) if(x!=ss){ cur.pb(x); dfs(x, nd, tt); cur.pop_back(); } } int find_next_station(int s, int t, vector<int> c){ cur.clear(); ans = -1; dfs(s, -1, t); return ans; }

Compilation message (stderr)

stations.cpp: In member function 'void graph::add(std::vector<int>, std::vector<int>)':
stations.cpp:18:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for(int i = 0; i < aa.size(); i++){
      |                        ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...