제출 #149786

#제출 시각아이디문제언어결과실행 시간메모리
149786CHT를 사랑하는 모임 (#200)로카히아 유적 (FXCUP4_lokahia)C++17
0 / 100
8 ms640 KiB
#include"lokahia.h"
#include<vector>
#include<ctime>
#include<algorithm>
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const ll inf=1e18;
int C[205];
int FindBase(int N)
{
	if(N==1)
		return 0;
	for(int i=0;i<500;i++)
		srand(time(0));
	for(int i=0;i<601-N;i++)
	{
		int n=rand()%N;
		int j=n;
		while(j==n)
			j=rand()%N;
		int t=CollectRelics(n,j);
		if(t!=-1)
			C[t]++;
	}
	int m,M=-1;
	for(int i=0;i<N;i++)
		if(C[i]>M)
			m=i,M=C[i];
	int c=0;
	for(int i=0;i<N;i++)
	{
		if(i==m)
			c++;
		else
			c+=CollectRelics(i,m)!=-1;
	}
	if(c<N/2)
		return-1;
	return m;
}

컴파일 시 표준 에러 (stderr) 메시지

lokahia.cpp: In function 'int FindBase(int)':
lokahia.cpp:31:6: warning: 'm' may be used uninitialized in this function [-Wmaybe-uninitialized]
  int m,M=-1;
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...