제출 #1057574

#제출 시각아이디문제언어결과실행 시간메모리
1057574boyliguanhan기지국 (IOI20_stations)C++17
100 / 100
535 ms1188 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; vector<int>adj[1010]; int CC; void dfs(int n,vector<int>&cols,int dep=0,int p=-1){ if(dep)cols[n]=CC++; for(auto i:adj[n])if(i-p) dfs(i,cols,!dep,n); if(!dep)cols[n]=CC++; } vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { CC=0; for(int i=0;i<n;i++) adj[i].clear(); vector<int>res(n); for(int i=0;i<n-1;i++) adj[u[i]].push_back(v[i]), adj[v[i]].push_back(u[i]); dfs(0,res); return res; } int find_next_station(int s, int t, std::vector<int> c) { if(s<c[0]){ if(t<s) return c.back(); for(auto i:c) if(t<=i) return i; return c.back(); } else { if(t>s) return c[0]; reverse(c.begin(),c.end()); int prv=s; for(auto i:c) if(t>=i) return i; return c.back(); } }

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

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:36:13: warning: unused variable 'prv' [-Wunused-variable]
   36 |         int prv=s;
      |             ^~~
#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...