답안 #674413

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
674413 2022-12-24T05:17:16 Z QwertyPi CONSUL (info1cup19_consul) C++14
100 / 100
46 ms 300 KB
#include <bits/stdc++.h>

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int kth(int i);
int cnt(int x);
void say_answer(int a);

int v[1001];
void solve(int N){
	if(N <= 50){
		for(int i = 1; i <= N; i++){
			v[i] = kth(i);
		}
		map<int, int> M;
		for(int i = 1; i <= N; i++){
			M[v[i]]++;
		}
		for(auto i : M){
			if(i.second * 3 > N){
				say_answer(i.first);
				return;
			}
		}
		say_answer(-1);
	}else{
		for(int j = 0; j < 30; j++){
			int val = kth(rng() % N + 1);
			if(cnt(val) * 3 > N){
				say_answer(val);
				return;
			}
		}
		say_answer(-1);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 208 KB Output is correct
2 Correct 8 ms 220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 208 KB Output is correct
2 Correct 24 ms 208 KB Output is correct
3 Correct 7 ms 208 KB Output is correct
4 Correct 6 ms 208 KB Output is correct
5 Correct 21 ms 300 KB Output is correct
6 Correct 21 ms 208 KB Output is correct
7 Correct 20 ms 208 KB Output is correct
8 Correct 23 ms 208 KB Output is correct
9 Correct 18 ms 296 KB Output is correct
10 Correct 22 ms 208 KB Output is correct
11 Correct 21 ms 208 KB Output is correct
12 Correct 17 ms 208 KB Output is correct
13 Correct 13 ms 208 KB Output is correct
14 Correct 22 ms 208 KB Output is correct