Submission #779870

# Submission time Handle Problem Language Result Execution time Memory
779870 2023-07-12T01:50:47 Z rxlfd314 CONSUL (info1cup19_consul) C++17
85 / 100
30 ms 336 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;

void solve(int N) {
	srand(time(NULL));
	int V[N];
	for (int i = 0; i < N; i++) {
		V[i] = rand();
	}
	int ord[N];
	iota(ord, ord+N, 0);
	sort(ord, ord+N, [&](const int &a, const int &b) {
		return V[a] < V[b];		
	});
	map<int, int> m;
	for (int x = 0, i = 0; x < 60 && i < N; x++, i++) {
		int v = kth(ord[i]+1);
		if (m.find(v) == m.end() && x < 59) {
			m[v] = cnt(v);
			x++;
		}
		if (m[v] > N/3) {
			say_answer(v);
			return;
		}
	}
	say_answer(-1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 336 KB Output is correct
2 Correct 29 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 10 ms 288 KB Output is correct
5 Correct 13 ms 296 KB Output is correct
6 Correct 27 ms 208 KB Output is correct
7 Correct 24 ms 208 KB Output is correct
8 Correct 30 ms 208 KB Output is correct
9 Correct 27 ms 208 KB Output is correct
10 Correct 26 ms 208 KB Output is correct
11 Correct 28 ms 288 KB Output is correct
12 Correct 25 ms 208 KB Output is correct
13 Correct 22 ms 292 KB Output is correct
14 Correct 21 ms 208 KB Output is correct