제출 #578541

#제출 시각아이디문제언어결과실행 시간메모리
578541Vanilla기지국 (IOI20_stations)C++17
36.23 / 100
959 ms904 KiB
#include <bits/stdc++.h> #include "stations.h" using namespace std; const int maxn = 1002; vector <int> ad [maxn]; int ct = 0; int dfs (int u, int p, vector <int> &lb) { lb[u] = ct++; int mx = 0; for (int v: ad[u]) { if (v == p) continue; mx = max(mx, dfs(v, u, lb)); } mx = max(mx, lb[u]); lb[u] = (lb[u] << 10) + mx; return mx; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<int> labels(n); ct = 0; for (int i = 0; i < n; i++){ ad[i].clear(); } for (int i = 0; i < n - 1; i++){ ad[u[i]].push_back(v[i]); ad[v[i]].push_back(u[i]); } dfs(0, -1, labels); // for (int i = 0; i < n; i++){ // cout << i << " " << (labels[i] >> 10) << " " << (labels[i] & ((1 << 10) - 1)) << "\n"; // } return labels; } int find_next_station(int s, int t, vector<int> c) { if (t < s || (s & ((1 << 10) - 1)) < (t >> 10)) return c[0]; for (int i = 1; i < c.size(); i++){ if (c[i] == t) return c[i]; if (c[i] > t) return c[i-1]; } return c.back(); }

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

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:39:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |  for (int i = 1; i < c.size(); i++){
      |                  ~~^~~~~~~~~~
#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...