제출 #1053350

#제출 시각아이디문제언어결과실행 시간메모리
1053350nightfal기지국 (IOI20_stations)C++17
5 / 100
559 ms940 KiB
// #include "stations.h" #include <cstdio> #include <iostream> #include <cassert> #include <map> #include <vector> #include <algorithm> using namespace std; template <typename T> void print(T elem) {cout << elem << " ";} template <typename T> void print(vector<T> &v) {for(auto elem: v) print(elem); cout << endl;}; template <typename T> void print(vector<vector<T>> &v) {for(auto elem: v) print(elem); cout << endl;}; std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { std::vector<int> labels(n,-1); vector<vector<int>> g(n); for (int i=0; i<n-1; i++) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } // print(g); int node = 0; for (int i=0; i<n; i++) if(g[i].size()==1) node = i; int prev = node; for (int i=0; i<n; i++) { labels[node] = i; for(int next: g[node]) if(labels[next]== -1) {node = next;} } // print(labels); return labels; } int find_next_station(int s, int t, std::vector<int> c) { for(int next: c) if (s<t && s<next) return next; else if (s>t && s>next) return next; }

컴파일 시 표준 에러 (stderr) 메시지

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:25:9: warning: unused variable 'prev' [-Wunused-variable]
   25 |     int prev = node;
      |         ^~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^
#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...