제출 #802636

#제출 시각아이디문제언어결과실행 시간메모리
802636I_Love_EliskaM_기지국 (IOI20_stations)C++14
0 / 100
3 ms664 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=0;i<n;++i) #define pb push_back #define all(x) x.begin(), x.end() using ll = long long; const int N=1e3; int l[N], r[N]; vector<int> adj[N]; int nxt=0; void dfs(int u, int p) { l[u]=r[u]=nxt++; for(auto&v:adj[u]) { if (v==p) continue; dfs(v,u); r[u]=max(r[u],r[v]); } } vector<int> label(int n, int k, vector<int>u, vector<int> v) { forn(i,n) adj[i].clear(); nxt=0; forn(i,n-1) { adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } dfs(0,-1); vector<int> ans(n); forn(i,n) ans[i]=l[i]; return ans; } int is_ancestor(int x, int y) { //x is anc of y return x < y; } int find_next_station(int s, int t, vector<int> adj) { if (is_ancestor(s,t)) { for(auto&v:adj) { if (is_ancestor(v,s)) continue; if (is_ancestor(v,t)) return v; } } else { for(auto&v:adj) { if (is_ancestor(v,s)) return v; } } exit(1); }

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

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:4:19: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    4 | #define forn(i,n) for(int i=0;i<n;++i)
      |                   ^~~
stations.cpp:23:2: note: in expansion of macro 'forn'
   23 |  forn(i,n) adj[i].clear(); nxt=0;
      |  ^~~~
stations.cpp:23:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   23 |  forn(i,n) adj[i].clear(); nxt=0;
      |                            ^~~
#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...