제출 #804752

#제출 시각아이디문제언어결과실행 시간메모리
8047521binHighway Tolls (IOI18_highway)C++14
0 / 100
15 ms4392 KiB
#include <bits/stdc++.h> #include "highway.h" using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; const int NMAX = 1e5 + 5; ll n, m, lv[NMAX], cost; vector<pair<int, int>> adj[NMAX]; vector<int> od; void dfs(int x){ for(auto&[nx, e] : adj[x]) if(!lv[nx]){ lv[nx] = lv[x] + 1; dfs(nx); } od.emplace_back(x); return; } int find(int rt){ od.clear(); memset(lv, 0, sizeof(lv)); lv[rt] = 1; dfs(rt); for(int i = 0; i < n; i++) cout << od[i] << ' '; cout << '\n'; int l = 0, r = n - 1, mid; while(l < r){ mid = (l + r) / 2; vector<int> w(m, 0); for(int i = l; i <= mid; i++) for(auto&[j, e] : adj[od[i]]) if(lv[j] < lv[od[i]]) w[e] = 1; if(ask(w) > cost) r = mid; else l = mid + 1; } return od[l]; } void find_pair(int n_, vector<int> U, std::vector<int> V, int A, int B) { n = n_; m = U.size(); for(int i = 0; i < m; i++){ adj[U[i]].emplace_back(V[i], i); adj[V[i]].emplace_back(U[i], i); } cost = ask(vector<int>(m, 0)); int s = find(0); cout << "vertex one is " << s << '\n'; int t = find(s); answer(s, t); return; }

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

highway.cpp: In function 'void dfs(int)':
highway.cpp:15:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   15 |     for(auto&[nx, e] : adj[x])
      |              ^
highway.cpp: In function 'int find(int)':
highway.cpp:35:22: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   35 |             for(auto&[j, e] : adj[od[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...
#Verdict Execution timeMemoryGrader output
Fetching results...