Submission #537703

#TimeUsernameProblemLanguageResultExecution timeMemory
537703groshiStations (IOI20_stations)C++17
0 / 100
791 ms656 KiB
#include<iostream> #include<vector> #include<algorithm> #include<stations.h> using namespace std; int kiedy=1,kiedy2=1; int odw[1010]; int odw2[1010]; vector<int> Q[1010]; int moj_koniec[2000]; void dfs(int x) { odw[x]=kiedy; kiedy++; for(int i=0;i<Q[x].size();i++) { int pom=Q[x][i]; if(odw[pom]!=0) continue; dfs(pom); } moj_koniec[odw[x]]=kiedy2; odw2[x]=kiedy2; kiedy2++; } vector<int> label(int n,int k,vector<int> u,vector<int> v) { for(int i=0;i<=n+3;i++) { odw[i]=0; odw2[i]=0; moj_koniec[i]=0; } for(int i=0;i<=n+3;i++) Q[i].clear(); kiedy=1; kiedy2=1; for(int i=0;i<u.size();i++) { u[i]++; v[i]++; Q[u[i]].push_back(v[i]); Q[v[i]].push_back(u[i]); } dfs(1); vector<int> wypisz; for(int i=1;i<=n;i++) wypisz.push_back(odw[i]); return wypisz; } int find_next_station(int s,int t,vector<int> c) { if(t<s) return c[0]; if(t>moj_koniec[s]) return c[0]; for(int i=0;i<c.size();i++) { if(t>=c[i] && t<=moj_koniec[c[i]]) return c[i]; } }

Compilation message (stderr)

stations.cpp: In function 'void dfs(int)':
stations.cpp:15:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i=0;i<Q[x].size();i++)
      |                 ~^~~~~~~~~~~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:38:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for(int i=0;i<u.size();i++)
      |                 ~^~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:57:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |     for(int i=0;i<c.size();i++)
      |                 ~^~~~~~~~~
stations.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
   62 | }
      | ^
#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...