Submission #82549

# Submission time Handle Problem Language Result Execution time Memory
82549 2018-10-31T12:27:30 Z farukkastamonuda Highway Tolls (IOI18_highway) C++14
0 / 100
19 ms 808 KB
#include "highway.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long 
#define inf 1000000009
#define md 1000000007
#define li 105
#define mp make_pair
#define pb push_back
#define mid (start+end)/2
using namespace std;
lo dep,dep2;
int baba[li],atakenar[li],tut;
vector< pair<int,int> > v[li];
vector<int> val,ol;
int yol[105];
void dfs(int node,int ata,int der){
	baba[node]=ata;
	if(der==dep) ol.pb(node);
	for(int i=0;i<(int)v[node].size();i++){
		int go=v[node][i].fi;
		atakenar[go]=v[node][i].se;
		if(go==ata) continue;
		dfs(go,node,der+1);
	}
}
void git(int a,int b){
	while(b!=a){
		yol[atakenar[b]]=1;
		b=baba[b];
	}
	//yol.pb(a);
}
void find_pair(int N,vector<int> U,vector<int> V,int A,int B){
	for(int i=0;i<(int)U.size();i++){
		v[U[i]].pb(mp(V[i],i));
		v[V[i]].pb(mp(U[i],i));
	}
	for(int i=1;i<=N;i++) val.pb(0);
	dep=ask(val);
	val.clear();
	for(int i=1;i<=N;i++) val.pb(1);
	dep2=ask(val);
	dfs(0,-1,0);
	//val.clear();
	for(int i=0;i<(int)ol.size();i++){
		val.clear();
		memset(yol,0,sizeof(yol));
		git(0,ol[i]);
		for(int j=0;j<(int)U.size();j++){
			if(yol[j]==1) val.pb(1);
			else val.pb(0);
		}
		if(ask(val)==dep2){
			tut=ol[i];
			break;
		}
	}
	answer(0,tut);
}
//~ int main(){
	
	//~ return 0;
//~ }
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 19 ms 808 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -