이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define con(x) (cerr << __LINE__ << ": " << #x << ' ' << (x) << endl, (x))
#define vis() (cerr << __LINE__ << endl)
#define ll long long
#define f first
#define s second
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define mp make_pair
using namespace std;
void dfs(int n, int p, int &e, vector<int> &L, vector<vector<int>> &G){
L[n] = (1e3 * e);
for(int v: G[n]){
if(v != p){
e++;
dfs(v, n, e, L, G);
}
}
L[n] += e;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v){
vector<vector<int>> G(n);
for(int i=0; i<n-1; i++){
G[u[i]].pb(v[i]);
G[v[i]].pb(u[i]);
}
vector<int> L(n);
int e = 0;
dfs(0, -1, e, L, G);
return L;
}
int find_next_station(int s, int t, std::vector<int> c){
int a_s = s/1000, b_s = s%1000;
int a_t = t/1000, b_t = t%1000;
if(a_s <= a_t && b_t <= b_s){
for(int f: c){
if(f < s) continue;
int a_f = f/1000, b_f = f%1000;
if(a_f <= a_t && b_t <= b_f)
return f;
}
}else{
return c[0];
}
}
컴파일 시 표준 에러 (stderr) 메시지
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:58:1: warning: control reaches end of non-void function [-Wreturn-type]
58 | }
| ^
# | 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... |