제출 #805148

#제출 시각아이디문제언어결과실행 시간메모리
805148Andrey기지국 (IOI20_stations)C++14
0 / 100
724 ms928 KiB
#include "stations.h" #include<bits/stdc++.h> using namespace std; vector<int> yay(0); vector<int> haha[10001]; int p; void dfs(int a, int t, int d) { yay[a] = d; for(int i = 0; i < haha[a].size(); i++) { if(haha[a][i] != t) { dfs(haha[a][i],a,d+1); } } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for(int i = 0; i < n; i++) { haha[i].clear(); } for(int i = 0; i < n-1; i++) { haha[u[i]].push_back(v[i]); haha[v[i]].push_back(u[i]); } p = 0; yay.clear(); for(int i = 0; i < n; i++) { yay.push_back(0); } vector<int> ans(0); for(int i = 0; i < n; i++) { if(haha[i].size() == 1) { dfs(0,-1,0); break; } } for(int i = 0; i < n; i++) { ans.push_back(yay[i]); } return ans; } int find_next_station(int s, int t, vector<int> c) { if(s == 0) { for(int i = 0; i < c.size(); i++) { if(c[i] <= t && (i == c.size()-1 || c[i+1] > t)) { return c[i]; } } } else { if(t < s) { return c[0]; } else { for(int i = 1; i < c.size(); i++) { if(c[i] <= t && (i == c.size()-1 || c[i+1] > t)) { return c[i]; } } } } }

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

stations.cpp: In function 'void dfs(int, int, int)':
stations.cpp:11:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int i = 0; i < haha[a].size(); i++) {
      |                    ~~^~~~~~~~~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:46:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         for(int i = 0; i < c.size(); i++) {
      |                        ~~^~~~~~~~~~
stations.cpp:47:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |             if(c[i] <= t && (i == c.size()-1 || c[i+1] > t)) {
      |                              ~~^~~~~~~~~~~~~
stations.cpp:57:30: 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 = 1; i < c.size(); i++) {
      |                            ~~^~~~~~~~~~
stations.cpp:58:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |                 if(c[i] <= t && (i == c.size()-1 || c[i+1] > t)) {
      |                                  ~~^~~~~~~~~~~~~
stations.cpp:64:1: warning: control reaches end of non-void function [-Wreturn-type]
   64 | }
      | ^
#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...