Submission #58289

# Submission time Handle Problem Language Result Execution time Memory
58289 2018-07-17T11:06:55 Z Mamnoon_Siam ICC (CEOI16_icc) C++17
0 / 100
360 ms 988 KB
#include "icc.h"
#include <bits/stdc++.h>
using namespace std;

const int maxn = 105;

int n;
int ok[maxn][maxn];

int chex(int u) {
	int a[1] = {u}, b[maxn];
	int sz_a = 1, sz_b = 0;
	for(int i = 1; i <= n; i++) {
		if(i == u) continue;
		if(ok[u][i] == 0) {
			b[sz_b++] = i;
		}
	}
	if(sz_b == 0) return 0;
	return query(sz_a, sz_b, a, b);
}

int find_another(int u) {
	int a[1] = {u}, b[1];
	for(int i = 1; i <= n; i++) {
		if(i == u) continue;
		if(!ok[u][i]) {
			b[0] = i;
			if(query(1, 1, a, b)) {
				return i;
			}
		}
	} assert(false);
}

void run(int N) {
	n = N;
	while(true) {
		int u = -1;
		for(int i = 1; i <= n; i++) {
			if(chex(i)) {
				u = i;
				break;
			}
		}
		int v = find_another(u);
		if(u > v) swap(u, v);
		assert(u != v and u > 0 and u <= N and v > 0 and v <= N);
		setRoad(u, v);
		ok[u][v] = 1;
		ok[v][u] = 1;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 22 ms 632 KB Ok! 301 queries used.
2 Incorrect 16 ms 676 KB Wrong road!
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 676 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 220 ms 692 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 258 ms 692 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 360 ms 988 KB Number of queries more than 3550 out of 1775
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 301 ms 988 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -