제출 #802147

#제출 시각아이디문제언어결과실행 시간메모리
802147I_Love_EliskaM_기지국 (IOI20_stations)C++14
10 / 100
751 ms640 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(); 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]+N*r[i]; return ans; } int find_next_station(int s, int t, vector<int> adj) { int l=s%N, r=s/N; int lx=t%N, rx=t/N; if (l<=lx && rx<=r) { for(auto&x:adj) { int lq=x%N, rq=x/N; if (lq<l) continue; if (lq<=lx && rx<=rq) return x; } } else { for(auto&x:adj) { int lq=x%N, rq=x/N; if (lq<l) return x; } } //assert(0); exit(1); }

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

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:45:16: warning: unused variable 'rq' [-Wunused-variable]
   45 |    int lq=x%N, rq=x/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...