/**
* In the name of Allah
* We are nothing and you're everything
**/
#include <bits/stdc++.h>
#include "highway.h"
using namespace std;
using ll = long long;
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
const char nl = '\n';
vector<int> w;
const int NN = 9e4+5;
int btree[NN], whom[NN];
//int ask(vector<int> w1) {
//int cost = 0;
//for (int i = 0; i < sz(w1); ++i) {
//if (w1[i] == 1) {
//if (i == 0)cost += 2;
//} else
//if (i == 0)cost += 1;
//}
//return cost;
//}
//void answer(int x, int y) {
//cout << y;
//}
void find_pair(int N, vector<int> u, vector<int> v, int a, int b) {
int m = sz(u), n = N;
vector<pair<int, int>> g[n+1];
w.resize(m);
for (int i = 0; i < m; ++i) {
g[u[i]].push_back({v[i], i});
g[v[i]].push_back({u[i], i});
}
ll cost = ask(w), len = cost/a;
//int l = 0, r = n+1;
//while (r-l>1) {
//int mid = l+r>>1;
//for (int i = 0; i < m; ++i) {
//w[i] = 0;
//if (i < mid)w[i] = 1;
//}
//ll d = ask(w);
//if (d != cost)r = mid;
//else l = mid;
//}
int r = 0;
for (int i = 0; i < n-1; ++i) {
w[i] = 1;
ask(w);
ll d = ask(w);
if (d != cost){r = i; break;}
w[i] = 0;
}
//r--;
int start = u[r], end = u[r];
while (len > 0) {
end = g[end][0].first;
len -= 1;
}
answer(start, end);
}
//void solve() {
//int n, m; cin >> n >> m;
//vector<int> u(m), v(m);
//for (int i = 0; i < m; ++i) {
//cin >> u[i] >> v[i];
//}
//find_pair(n, u, v, 1, 2);
//}
//int32_t main() {
//ios::sync_with_stdio(0);
//cin.tie(0);
//int t = 1;
//for (int _ = 0; _ < t; ++_) {
//solve();
//}
//return 0;
//}
# | 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... |