답안 #315226

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
315226 2020-10-22T05:00:16 Z yjojdkgk5bp CONSUL (info1cup19_consul) C++14
100 / 100
41 ms 288 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
void solve(int n)
{
	srand(time(0));
	int v;	
	if(n<=50)
	{
		map<int,int> can;
		for(int i=1; i<=n; i++)
		{
			v=kth(i);
			can[v]++;
			if(can[v]>n/3)
			{
				say_answer(v); return;
			}
		}
		say_answer(-1);
	}
	else
	{
		for(int i=1; i<=30; i++)
		{
			int k=(rand()%n)+1;
			v=kth(k);
			if(cnt(v)>n/3)
			{
				say_answer(v); return;
			}
		}
		say_answer(-1);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 256 KB Output is correct
2 Correct 8 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 256 KB Output is correct
2 Correct 25 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 7 ms 256 KB Output is correct
5 Correct 22 ms 256 KB Output is correct
6 Correct 25 ms 256 KB Output is correct
7 Correct 22 ms 256 KB Output is correct
8 Correct 17 ms 256 KB Output is correct
9 Correct 23 ms 256 KB Output is correct
10 Correct 24 ms 256 KB Output is correct
11 Correct 25 ms 256 KB Output is correct
12 Correct 21 ms 288 KB Output is correct
13 Correct 27 ms 256 KB Output is correct
14 Correct 23 ms 256 KB Output is correct