Submission #757684

# Submission time Handle Problem Language Result Execution time Memory
757684 2023-06-13T14:46:49 Z ymm CONSUL (info1cup19_consul) C++17
85 / 100
32 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,30) {
		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 Incorrect 10 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 208 KB Output is correct
2 Correct 24 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 8 ms 208 KB Output is correct
5 Correct 21 ms 208 KB Output is correct
6 Correct 28 ms 208 KB Output is correct
7 Correct 22 ms 208 KB Output is correct
8 Correct 31 ms 208 KB Output is correct
9 Correct 32 ms 208 KB Output is correct
10 Correct 19 ms 208 KB Output is correct
11 Correct 26 ms 208 KB Output is correct
12 Correct 10 ms 208 KB Output is correct
13 Correct 12 ms 208 KB Output is correct
14 Correct 11 ms 208 KB Output is correct