이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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], od;
void dfs(int x){
for(auto&[nx, e] : adj[x])
if(!lv[nx]){
lv[nx] = lv[x] + 1;
dfs(nx);
}
return;
}
int find(int rt){
od.clear();
memset(lv, 0, sizeof(lv));
lv[rt] = 1; dfs(rt);
int l = 0, r = n - 1, mid;
while(l < r){
mid = (l + r) / 2;
vector<int> w(m, 0);
for(int i = mid + 1; i <= r; i++)
for(auto&[j, e] : adj[i])
if(lv[j] < lv[i]) w[e] = 1;
if(ask(w) > cost) l = mid + 1;
else r = mid;
}
return 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(1);
int t = find(s);
answer(s, t);
return;
}
컴파일 시 표준 에러 (stderr) 메시지
highway.cpp: In function 'void dfs(int)':
highway.cpp:13:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
13 | for(auto&[nx, e] : adj[x])
| ^
highway.cpp: In function 'int find(int)':
highway.cpp:30:22: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
30 | for(auto&[j, e] : adj[i])
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |