Submission #293646

#TimeUsernameProblemLanguageResultExecution timeMemory
293646DovranHighway Tolls (IOI18_highway)C++11
0 / 100
22 ms5632 KiB
#include <bits/stdc++.h>
#include "highway.h"
#define N 200009
#define pii pair <int, int>
#define ff first
#define ss second
#define pb push_back
#define ll long long

using namespace std;

int n, m, l[N], qwe;
vector<int>e[N];
ll x;

void f(int nd, int lv){
	qwe=max(qwe, lv);
	if(lv==x){
		answer(0, nd);
		return;
	}
	l[nd]=lv;

	for(int i=0; i<e[nd].size(); i++)
		if(!l[e[nd][i]] and e[nd][i]>0 and qwe<x) f(e[nd][i], lv+1);
}

void find_pair(int NN, std::vector<int>u, std::vector<int>v, int a, int b){
	n=NN;
	m=u.size();
	vector<int>asd;
	for(int i=0; i<m; i++){
		e[u[i]].pb(v[i]);
		e[v[i]].pb(u[i]);
		
		asd.pb(0);
	}
	if(a>b)
		swap(a, b);
	
	x=ask(asd);
	x=x/a;
	
	f(0, 0);
}

Compilation message (stderr)

highway.cpp: In function 'void f(int, int)':
highway.cpp:24:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(int i=0; i<e[nd].size(); 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...