Submission #616824

#TimeUsernameProblemLanguageResultExecution timeMemory
616824John3_141592Stations (IOI20_stations)C++14
0 / 100
864 ms668 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; vector <int> grafo[1003]; int arr[1003],C; bool vis[1003]; void dfs(int node,int c){ vis[node]=true; if(c) arr[node]=C++; for(auto i:grafo[node]) if(!vis[i]) dfs(i,c^1); if(!c) arr[node]=C++; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { for(int i=0;i<n;i++) grafo[i].clear(); for(int i=0;i<n-1;i++) grafo[u[i]].push_back(v[i]),grafo[v[i]].push_back(u[i]); fill(arr,arr+n+1,0); fill(vis,vis+n+1,false); C=0,dfs(0,0); vector <int> solve; for(int i=0;i<n;i++) solve.push_back(arr[i]); return solve; } int find_next_station(int s, int t, std::vector<int> c) { if(s<c[0]){ if(t<s) return c.back(); for(auto i:c) if(i>=t) return i; } if(t>s) return c[0]; for(int i=1;i<c.size();i++) if(c[i]<=t) return c[i]; return c[0]; }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:34:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int i=1;i<c.size();i++) if(c[i]<=t) return c[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...