Submission #296399

# Submission time Handle Problem Language Result Execution time Memory
296399 2020-09-10T14:18:48 Z cookiedoth Highway Tolls (IOI18_highway) C++14
5 / 100
21 ms 4888 KB
#include "highway.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <numeric>
#include <functional>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <cassert>
#include <random>
#define ll long long
#define ld long double
#define null NULL
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define length(a) (int)a.size()

using namespace std;

template<class iterator> void output(iterator begin, iterator end, ostream &out = cerr) {
	while (begin != end) {
		out << (*begin) << ' ';
		begin++;
	}
	out << endl;
}

template<class T> void output(const T &x, ostream &out = cerr) {
	output(x.begin(), x.end(), out);
}

template<class T> int chkmin(T &a, const T &b) {
	if (b < a) {
		a = b;
		return 1;
	}
	return 0;
}

template<class T> int chkmax(T &a, const T &b) {
	if (b > a) {
		a = b;
		return 1;
	}
	return 0;
}

void fast_io() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

int n, m, A, B, toll0, last_v;
vector<vector<pair<int, int> > > g;

void dfs(int v, int pv) {
	for (auto pp : g[v]) {
		int v1 = pp.first;
		if (v1 != pv) {
			vector<int> cur(m);
			cur[pp.second] = 1;
			int toll1 = ask(cur);
			if (toll1 > toll0) {
				last_v = v1;
			}
			dfs(v1, v);
		}
	}
}

void solve() {
	toll0 = ask(vector<int> (m));
	dfs(0, 0);
	answer(0, last_v);
}

void find_pair(int _n, vector<int> U, vector<int> V, int _A, int _B) {
	n = _n;
	g.resize(n);
	m = length(U);
	for (int i = 0; i < m; ++i) {
		g[U[i]].emplace_back(V[i], i);
		g[V[i]].emplace_back(U[i], i);
	}
	solve();
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 4888 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 512 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 3832 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 3912 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -