Submission #365287

# Submission time Handle Problem Language Result Execution time Memory
365287 2021-02-11T11:33:47 Z Mlxa CONSUL (info1cup19_consul) C++14
0 / 100
1 ms 364 KB
#ifdef LC
#include "pch.h"
#else
#include <bits/stdc++.h>
#include "grader.h"
#endif
using namespace std;
#define all(x) x.begin(), x.end()
#define x first
#define y second
#define mp make_pair
#define mt make_tuple

int kth(int i);
int cnt(int x);
void say_answer(int a);

mt19937 rnd;

void solve(int n) {
	int q = 56;
	set<int> ind;
	set<int> was;
	while (q > 0) {
		int i = rnd() % n;
		while (ind.count(i)) {
			i = rnd() % n;
		}
		int v = kth(i);
		--q;
		if (was.count(v)) {
			continue;
		}
		int c = cnt(v);
		--q;
		if (3 * c > n) {
			say_answer(i);
			return;
		}
	}
	say_answer(-1);
}

#ifdef LC

const int N = 1000;
map<int, int> cn;
int v[N];

int kth(int i) {
	return v[i];
}
int cnt(int x) {
	return cn[x];
}
void say_answer(int x) {
	cout << "answer " << x << endl;
}

signed main() {
    assert(freopen("input.txt", "r", stdin));
    ios::sync_with_stdio(0); cin.tie(0);
    for (int i = 0; i < N; ++i) {
    	v[i] = rnd() % 4;
    	++cn[v[i]];
    }
    solve(N);
    return 0;
}

#endif
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong answer
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong answer
2 Halted 0 ms 0 KB -