제출 #1067575

#제출 시각아이디문제언어결과실행 시간메모리
1067575guanex기지국 (IOI20_stations)C++14
5 / 100
664 ms832 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { std::vector<int> labels(n); int ed[n]; vector<vector<int>> x(n); for(int i = 0; i < n-1; ++i){ labels[i] = -1; x[u[i]].push_back(v[i]); x[v[i]].push_back(u[i]); } labels[n-1] = -1; int root = 0; for(int i = 0; i < n; ++i){ if((int)x[i].size() == 1){ root = i; break; } } queue<int> q; q.push(root); labels[root] = 0; int num = 0; while(!q.empty()){ int p = q.front(); q.pop(); for(auto e:x[p]){ if(labels[e] != -1){ continue; }else{ q.push(e); labels[e] = ++num; } } } return labels; } int find_next_station(int s, int t, std::vector<int> c) { if(s > t){ return s-1; }else{ return s+1; } }

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

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:8:9: warning: unused variable 'ed' [-Wunused-variable]
    8 |     int ed[n];
      |         ^~
#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...