제출 #613751

#제출 시각아이디문제언어결과실행 시간메모리
613751eNGy기지국 (IOI20_stations)C++17
52.32 / 100
888 ms776 KiB
#include <bits/stdc++.h> #define con(x) (cerr << __LINE__ << ": " << #x << ' ' << (x) << endl, (x)) #define vis() (cerr << __LINE__ << endl) #define ll long long #define f first #define s second #define pb push_back #define rsz resize #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() #define mp make_pair using namespace std; void dfs(int n, int p, int &e, vector<int> &L, vector<vector<int>> &G){ L[n] = (1e3 * e); for(int v: G[n]){ if(v != p){ e++; dfs(v, n, e, L, G); } } L[n] += e; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v){ vector<vector<int>> G(n); for(int i=0; i<n-1; i++){ G[u[i]].pb(v[i]); G[v[i]].pb(u[i]); } vector<int> L(n); int e = 0; dfs(0, -1, e, L, G); return L; } int find_next_station(int s, int t, std::vector<int> c){ int a_s = s/1000, b_s = s%1000; int a_t = t/1000, b_t = t%1000; if(a_s <= a_t && b_t <= b_s){ for(int f: c){ if(f < s) continue; int a_f = f/1000, b_f = f%1000; if(a_f <= a_t && b_t <= b_f) return f; } }else{ return c[0]; } }

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

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:58:1: warning: control reaches end of non-void function [-Wreturn-type]
   58 | }
      | ^
#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...