Submission #530149

# Submission time Handle Problem Language Result Execution time Memory
530149 2022-02-24T17:20:47 Z LucaDantas CONSUL (info1cup19_consul) C++17
4.96076 / 100
46 ms 320 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;

constexpr int maxn = 1e5+10, SZ = 50, tot = 100;

mt19937 rng(random_device{}());

int rnd(int x) { return (rng() % x + x) % x; }

int a[maxn], mark[maxn];

void solve(int n)
{
	for(int i = 0; 2*i < tot; i++) {
		int rd = rnd(n)+1, cor = kth(rd);
		if(cnt(cor) > n/3)
			return (void)(say_answer(cor));
	}
	say_answer(-1);
	/* vector<int> usar;
	map<int,int> freq;
	while(usar.size() < min(n, SZ)) {
		int rd = rnd(n)+1;
		if(!mark[rd])
			usar.push_back(rd), a[rd] = kth(rd), freq[a[rd]]++;
		mark[rd] = 1;
	}
	for(int x : usar)
		mark[x] = 0;

	vector<pair<int,int>> maiores;
	for(auto it : freq)
		maiores.push_back({it.second, it.first});
	sort(maiores.begin(), maiores.end(), greater<pair<int,int>>());

	while(maiores.size() > tot - SZ)
		maiores.pop_back();

	if(n <= SZ) {
		if(maiores[0].first > n/3) say_answer(maiores[0].second);
		else say_answer(-1);
		return;
	}

	for(int i = 0; i < maiores.size(); i++)
		if(cnt(maiores[i].second) > n/3) return (void)(say_answer(maiores[i].first));

	say_answer(-1); */
}
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 200 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 46 ms 200 KB Output is partially correct
2 Correct 8 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 33 ms 200 KB Output is partially correct
2 Partially correct 30 ms 300 KB Output is partially correct
3 Correct 6 ms 320 KB Output is correct
4 Correct 8 ms 280 KB Output is correct
5 Partially correct 43 ms 200 KB Output is partially correct
6 Partially correct 38 ms 200 KB Output is partially correct
7 Partially correct 21 ms 200 KB Output is partially correct
8 Partially correct 37 ms 284 KB Output is partially correct
9 Partially correct 16 ms 304 KB Output is partially correct
10 Partially correct 40 ms 200 KB Output is partially correct
11 Partially correct 36 ms 280 KB Output is partially correct
12 Partially correct 35 ms 304 KB Output is partially correct
13 Partially correct 39 ms 300 KB Output is partially correct
14 Partially correct 30 ms 300 KB Output is partially correct