제출 #304446

#제출 시각아이디문제언어결과실행 시간메모리
304446arnold518버섯 세기 (IOI20_mushrooms)C++14
0 / 100
1 ms256 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 2e4;
const int SQ = 2;

int N;

int query(vector<int> V)
{
	return use_machine(V);
}

int count_mushrooms(int _N)
{
	N=_N;

	vector<int> A, B;
	A.push_back(0);

	int p, ans=0;
	for(p=1; p<N && A.size()<=SQ && B.size()<=SQ; p++)
	{
		if(query({0, p})) B.push_back(p);
		else A.push_back(p);
	}
	ans=A.size();

	if(A.size()>=SQ)
	{
		while(p<N)
		{
			int i, j;
			vector<int> V;
			for(j=0; p<N && j<SQ; p++, j++)
			{
				V.push_back(A[j]);
				V.push_back(p);
			}
			V.push_back(A[j]);
			ans+=SQ-query(V)/2;
		}
	}
	else
	{
		while(p<N)
		{
			int i, j;
			vector<int> V;
			for(j=0; p<N && j<SQ; p++, j++)
			{
				V.push_back(B[j]);
				V.push_back(p);
			}
			V.push_back(B[j]);
			ans+=query(V)/2;
		}
	}

	return ans;
}

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

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:38:8: warning: unused variable 'i' [-Wunused-variable]
   38 |    int i, j;
      |        ^
mushrooms.cpp:53:8: warning: unused variable 'i' [-Wunused-variable]
   53 |    int i, j;
      |        ^
#Verdict Execution timeMemoryGrader output
Fetching results...