Submission #360861

#TimeUsernameProblemLanguageResultExecution timeMemory
360861ezdpCONSUL (info1cup19_consul)C++14
100 / 100
39 ms512 KiB
#include "grader.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(int n)
{
	set<ll> s;
	srand(42069);
	while(s.size() < min(29, n / 2)){
		int i = rand() % n + 1;
		if(!s.count(i)){
			s.insert(i);
			ll val = kth(i);
			if(cnt(val) > n / 3){
				say_answer(val);
				return;
			}
		}
	}
    say_answer(cnt(kth(1)) > n / 3 ? kth(1) : -1);
}

Compilation message (stderr)

consul.cpp: In function 'void solve(int)':
consul.cpp:9:17: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'const int' [-Wsign-compare]
    9 |  while(s.size() < min(29, n / 2)){
      |        ~~~~~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...