Submission #821474

# Submission time Handle Problem Language Result Execution time Memory
821474 2023-08-11T10:40:03 Z Dan4Life Highway Tolls (IOI18_highway) C++17
0 / 100
9 ms 5592 KB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
const int mxN = (int)2e5+10;
using ll = long long;
vector<pair<int,int>> adj[mxN];
vector<int> edges;
int n,m,dist = 0, dis[mxN];
void dfs(int s, int p=-1){
	if(p!=-1) dis[s] = dis[p]+1;
	else dis[s] = 0;
	for(auto [u,i] : adj[s]){	
		if(u!=p){
			if(dis[s]==dist-1) edges.pb(i);
			dfs(u,s);
		}
	}
}

void find_pair(int N, vi u, vi v, int A, int B) {
	n = N; m = sz(u); vi w(m,0);
	for(int i = 0; i < m; i++){
		int a = u[i], b = v[i];
		adj[a].pb({b,i}); adj[b].pb({a,i});
	}
	ll toll = ask(w);
	dist = toll/A;
	int l = 0, r = sz(edges)-1;
	while(l<r){
		int mid = (l+r)/2;
		fill(all(w),0);
		for(int i = 0; i <= mid; i++) w[edges[i]]=1;
		if(ask(w)!=toll) r=mid;
		else l=mid+1;
	}
	answer(0,dis[u[l]]<dis[v[l]]?v[l]:u[l]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4944 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4944 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 5464 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4944 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 5592 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 5592 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -