Submission #139384

# Submission time Handle Problem Language Result Execution time Memory
139384 2019-07-31T15:34:01 Z wilwxk Highway Tolls (IOI18_highway) C++14
0 / 100
1500 ms 262148 KB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN=9e4+5;
vector<int> g[MAXN], config;
vector<int> bons;
int aresta[MAXN*2][2];
int pid[MAXN], lvl[MAXN];
int n, m, x, y, tam;

void dfs(int cur, int pp, int d) {
	printf("%d %d %d\n", cur, pp, d);
	pid[cur]=pp; lvl[cur]=d;
	for(auto vid : g[cur]) {
		if(vid==pp) continue;
		int viz= aresta[vid][ aresta[vid][0]==cur ];
		dfs(viz, vid, d+1);
	}
}

void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
  n=N; m=U.size(); x=A; y=B;
  for(int i=0; i<m; i++) {
  	int a=U[i]; int b=V[i];
  	aresta[i][0]=a; aresta[i][1]=b;
  	g[a].push_back(i);
  	g[b].push_back(i);
  	config.push_back(0);
  }

  dfs(0, -1, 0);
  tam=ask(config); tam/=x;
  for(int i=0; i<n; i++) if(lvl[i]==tam) bons.push_back(i);

  srand(0); random_shuffle(bons.begin(), bons.end());
  for(auto cur : bons) {
  	config[pid[cur]]=1;
  	int val=ask(config);
  	if(val!=tam*x) answer(0, cur);
  	config[pid[cur]]=0;
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2424 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2472 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 3528 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2424 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2490 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 2250 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -