Submission #757688

# Submission time Handle Problem Language Result Execution time Memory
757688 2023-06-13T14:48:57 Z ymm CONSUL (info1cup19_consul) C++17
100 / 100
26 ms 208 KB
#ifdef EVAL
#include "grader.h"
#endif

#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;

#ifndef EVAL
void solve(int N);
int kth(int i) {
	int x;
	cout << "v[" << i << "]: ";
	cin >> x;
	return x;
}
int cnt(int x) {
	int ans;
	cout << "cnt(" << x << "): ";
	cin >> ans;
	return ans;
}
void say_answer(int a) {
	cout << "ans: " << a << '\n';
}
int main() {
	int n;
	cin >> n;
	solve(n);
}
#endif

void solve(int n)
{
	mt19937_64 rd(time(0));
	Loop (_,0,25) {
		int p = rd()%n;
		int v = kth(p+1);
		int c = cnt(v);
		if (c*3 > n) {
			say_answer(v);
			return;
		}
	}
	say_answer(-1);
}

# Verdict Execution time Memory Grader output
1 Correct 12 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 208 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 6 ms 208 KB Output is correct
4 Correct 6 ms 208 KB Output is correct
5 Correct 17 ms 208 KB Output is correct
6 Correct 18 ms 208 KB Output is correct
7 Correct 18 ms 208 KB Output is correct
8 Correct 12 ms 208 KB Output is correct
9 Correct 13 ms 208 KB Output is correct
10 Correct 13 ms 208 KB Output is correct
11 Correct 25 ms 208 KB Output is correct
12 Correct 15 ms 208 KB Output is correct
13 Correct 26 ms 208 KB Output is correct
14 Correct 20 ms 208 KB Output is correct