제출 #501398

#제출 시각아이디문제언어결과실행 시간메모리
501398sidon통행료 (IOI18_highway)C++17
12 / 100
387 ms10700 KiB
#include <bits/stdc++.h> #include "highway.h" using namespace std; using ll = long long; void find_pair(int N, vector<int> U, vector<int> V, int A, int B) { int M = size(U), x = 0, u, d[2][N]; vector<int> w(M); ll least = ask(w); for(int b = 1<<17; b/=2; ) if(x + b < M) { fill(begin(w), begin(w) + x + b, 1); if(ask(w) == least) x |= b; fill(begin(w), begin(w) + x + b, 0); } array<int, 2> S = {U[x], V[x]}, ans {}; vector<array<int, 2>> g[N], a; for(int i = x; i < M; i++) { g[U[i]].push_back({V[i], i}); g[V[i]].push_back({U[i], i}); } for(int k : {0, 1}) { fill(d[k], d[k] + N, N); queue<int> q; d[k][S[k]] = 0; q.push(S[k]); while(!empty(q)) { u = q.front(); q.pop(); for(auto &[v, e] : g[u]) if(d[k][v] > d[k][u] + 1) d[k][v] = d[k][u] + 1, q.push(v); } } for(int k : {0, 1}) { a.clear(); for(int i = 0; i < N; i++) if(d[k][i] < d[!k][i]) a.push_back({-d[k][i], i}); sort(begin(a), end(a)); for(int b = 1<<17; b/=2; ) if(ans[k] + b < size(a)) { fill(begin(w), begin(w) + x, 1); for(int i = ans[k] + b; --i >= 0; ) for(auto &[v, e] : g[a[i][1]]) w[e] = 1; if(ask(w) == least) ans[k] |= b; for(int i = ans[k] + b; --i >= 0; ) for(auto &[v, e] : g[a[i][1]]) w[e] = 0; fill(begin(w), begin(w) + x, 0); } ans[k] = a[ans[k]][1]; } answer(ans[0], ans[1]); }

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

highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:46:44: warning: comparison of integer expressions of different signedness: 'std::array<int, 2>::value_type' {aka 'int'} and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |   for(int b = 1<<17; b/=2; ) if(ans[k] + b < size(a)) {
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...