이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define FF first
#define SS second
#define all(a) a.begin(), a.end()
#define mod (ll)(1000000007)
vector<int>Vis, labels;
vector<vector<int>>A;
vector<array<int, 2>>dp;
// time, max_time
int time_=0;
void dfs(int ind){
Vis[ind]=1, labels[ind]=time_++;
for(int i=0;i<A[ind].size();i++)
if(!Vis[A[ind][i]])
dfs(A[ind][i]);
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
dp.clear(), Vis.clear(), A.clear(), labels.clear();
dp.resize(n), Vis.resize(n), A.resize(n), labels.resize(n);
for(int i=0;i<n;i++)
A[u[i]].push_back(v[i]), A[v[i]].push_back(u[i]);
dfs(0);
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
for(int i=c.size()-1;i>=0;i--){
if(t>c[i])
return c[i];
}
return c[0];
}
컴파일 시 표준 에러 (stderr) 메시지
stations.cpp: In function 'void dfs(int)':
stations.cpp:16:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
16 | for(int i=0;i<A[ind].size();i++)
| ~^~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |