Submission #308162

#TimeUsernameProblemLanguageResultExecution timeMemory
308162aintaStations (IOI20_stations)C++17
100 / 100
1013 ms1160 KiB
#include "stations.h" #include <vector> #include <algorithm> using namespace std; vector<int>E[1010]; int Num[1010], cnt; void DFS(int a, int pp, int dep){ int i; if(!dep)Num[a]=++cnt; for(auto &x : E[a]){ if(x==pp)continue; DFS(x,a,!dep); } if(dep)Num[a]=++cnt; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { std::vector<int> labels(n); cnt = 0; for(int i=0;i<n;i++)E[i].clear(); for (int i = 0; i < n; i++) { labels[i] = i; } for(int i=0;i<n-1;i++){ E[u[i]].push_back(v[i]); E[v[i]].push_back(u[i]); } DFS(0,-1,0); for(int i=0;i<n;i++){ labels[i] = Num[i]-1; } return labels; } bool Include(int a, int b){ } int find_next_station(int s, int t, std::vector<int> c) { int i; int b = s, e = s; int sz =c.size(); if(s < c[0]){ if(sz>=2)e = c[sz-2]; if(b<=t && t<=e){ for(auto &x : c){ if(x>=t)return x; } } return c[sz-1]; } else{ if(sz>=2)b = c[1]; if(b<=t && t<=e){ reverse(c.begin(),c.end()); for(auto &x : c){ if(x<=t)return x; } } return c[0]; } }

Compilation message (stderr)

stations.cpp: In function 'void DFS(int, int, int)':
stations.cpp:10:6: warning: unused variable 'i' [-Wunused-variable]
   10 |  int i;
      |      ^
stations.cpp: In function 'bool Include(int, int)':
stations.cpp:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
   38 | }
      | ^
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:41:6: warning: unused variable 'i' [-Wunused-variable]
   41 |  int 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...