Submission #82557

# Submission time Handle Problem Language Result Execution time Memory
82557 2018-10-31T12:38:29 Z farukkastamonuda Highway Tolls (IOI18_highway) C++14
5 / 100
413 ms 262148 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 90005
#define mp make_pair
#define pb push_back
#define mid (start+end)/2
using namespace std;
lo dep,dep2,aaa;
int baba[li],atakenar[li],tut;
vector< pair<int,int> > v[li];
vector<int> val,ol;
int yol[130005];
void dfs(int node,int ata,lo 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;
		if(go==ata) continue;
		atakenar[go]=v[node][i].se;
		dfs(go,node,der+aaa);
	}
}
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){
	aaa=A;
	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=0;i<(int)U.size();i++) val.pb(0);
	dep=ask(val);
	val.clear();
	for(int i=0;i<(int)U.size();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 Correct 4 ms 2856 KB Output is correct
2 Correct 5 ms 2860 KB Output is correct
3 Correct 4 ms 2936 KB Output is correct
4 Correct 4 ms 2836 KB Output is correct
5 Correct 4 ms 2920 KB Output is correct
6 Correct 5 ms 2832 KB Output is correct
7 Correct 4 ms 2856 KB Output is correct
8 Correct 4 ms 2844 KB Output is correct
9 Correct 4 ms 2856 KB Output is correct
10 Correct 4 ms 2836 KB Output is correct
11 Correct 4 ms 2832 KB Output is correct
12 Correct 4 ms 2916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 3064 KB Output is correct
2 Incorrect 32 ms 3652 KB Output is incorrect: more than 100 calls to ask.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 3960 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 3016 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 413 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 394 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -