이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "stations.h"
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define N 100005
#define PB push_back
#define sz(x) int(x.size())
#define F first
#define M ll(1e9 + 7)
#define S second
#define all(x) x.begin(), x.end()
#define endl '\n'
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
//typedef tree <int, null_type, less_equal <int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll mlt(ll x, ll y) {return (x * y) % M;}
ll sm(ll x, ll y) {return (x + y) % M;}
vector <int> g[N], a;
int id = 0;
void dfs(int v, int p)
{
a[v] = id++;
for (auto it : g[v])
{
if (it == p) continue;
dfs(it, v);
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v)
{
a.resize(n);
for (int i = 0; i < n - 1; i++)
{
g[u[i]].PB(v[i]);
g[v[i]].PB(u[i]);
}
for (int i = 0; i < n; i++)
if (sz(g[i]) == 1) {dfs(i, -1); break;}
return a;
}
int find_next_station(int s, int t, vector<int> c)
{
if (sz(c) == 1) return c[0];
if (s < t) return max(c[0], c[1]);
return min(c[0], c[1]);
}
//int main()
//{
// iostream::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//
// //freopen("fcolor.in", "r", stdin); freopen("fcolor.out", "w", stdout);
//
//
//}
컴파일 시 표준 에러 (stderr) 메시지
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:58:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
58 | for (int i = 0; i < n; i++)
| ^~~
stations.cpp:61:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
61 | return a;
| ^~~~~~
# | 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... |