답안 #1112338

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1112338 2024-11-14T05:18:20 Z thelegendary08 통행료 (IOI18_highway) C++17
5 / 100
104 ms 9140 KB
#include "highway.h"
#include<bits/stdc++.h>
#define vi vector<int>
#define vb vector<bool>
#define vpii vector<pair<int,int>>
#define pb push_back
#define vvi vector<vector<int>>
#define ll long long int
#define f0r(i,n) for(int i = 0; i<n; i++)
#define vout(v) for(auto u : v)cout<<u<<' '; cout<<'\n';
using namespace std;
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
	int m = U.size();
	ll ret;
	vi w(m,0);
	ret = ask(w);
	int base = ret;
	int len = ret/A;
	vi dep(N);
	dep[0] = 0;
	queue<int>q;
	q.push(0);
	vb vis(N);
	vis[0] = 1;
	vpii adj[N];
	f0r(i, m){
		adj[U[i]].pb({V[i], i});
		adj[V[i]].pb({U[i], i});
	}
	vi par(N, -1);
	while(!q.empty()){
		int cur = q.front();
		q.pop();
		for(auto u : adj[cur]){
			if(vis[u.first])continue;
			par[u.first] = u.second;
			vis[u.first] = 1;
			dep[u.first] = dep[cur] + 1;
			q.push(u.first);
		}
	}
	//vout(par);
	
	vi poss;
	f0r(i, N){
		if(dep[i] == len)poss.pb(i);
	}
	//vout(poss);
	
	int l = 0;
	int r = poss.size() - 1;
	while(l < r){
		vi w(m, 0);
		int mid = (l + r)/2;
		//set l to mid
		for(int i = l; i<=mid; i++){
			w[par[poss[i]]] = 1;
		}
		ret = ask(w);
		if(ret > base){
			r = mid;
		}
		else{
			l = mid + 1;
		}
	}
  	answer(0, poss[l]);
  	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 10 ms 1360 KB Output is correct
3 Correct 97 ms 8804 KB Output is correct
4 Correct 104 ms 8868 KB Output is correct
5 Correct 87 ms 8972 KB Output is correct
6 Correct 102 ms 8808 KB Output is correct
7 Correct 82 ms 8808 KB Output is correct
8 Correct 86 ms 9140 KB Output is correct
9 Correct 83 ms 8704 KB Output is correct
10 Correct 84 ms 8804 KB Output is correct
11 Correct 81 ms 8192 KB Output is correct
12 Correct 80 ms 8040 KB Output is correct
13 Correct 76 ms 8136 KB Output is correct
14 Incorrect 80 ms 8040 KB Output is incorrect: {s, t} is wrong.
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1024 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 504 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 1360 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 1360 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -