Submission #1078962

# Submission time Handle Problem Language Result Execution time Memory
1078962 2024-08-28T08:42:40 Z Trumling Counting Mushrooms (IOI20_mushrooms) C++14
0 / 100
6 ms 600 KB
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std; 

typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
#define INF 99999999999999999
#define MOD 1000000007
#define all(x) x.begin(),x.end()

int count_mushrooms(int n) {
	vector<int>A,B;
	A.pb(0);
	int i;
	for(i=1;i<min(n,200);i++)
	{
		ll ans=use_machine({0,i});
		
		if(ans)
		{
			if(B.size()!=0)
			B.pb(-1);

			B.pb(i);
			
		}
			
		else
		{
			A.pb(-1);
			A.pb(i);
		}
			
		
		if(A.size()==201 || B.size()==201)
			break;
	}
	assert(A.size()==201 || B.size()==201 || n<=200);
	ll counta=A.size()/2 + 1;
	i++;
	
	for(i=i;i<n;i+=100)
	{
	if(A.size()==201)
	{
		if(i+100<=n)
		{
		for(int j=0;j<100;j++)
			A[j*2+1]=i+j;
		
		ll ans=use_machine(A);
		counta+=100-ans/2;

		continue;

		}
		vector<int>p;
		int j;
		for(j=0;j<n-i;j++)
			{
				p.pb(A[j*2]);
				p.pb(i+j);
			}

		p.pb(A[j*2]);
		ll ans=use_machine(p);
		counta+=(n-i)-ans/2;

	}
	else
	{
		if(i+100<=n)
		{
		for(int j=0;j<100;j++)
			B[j*2+1]=i+j;
		
		ll ans=use_machine(B);
		counta+=ans/2;

		continue;
		}

		vector<int>p;
		int j;
		for(j=0;j<n-i;j++)
			{
				p.pb(B[j*2]);
				p.pb(i+j);
			}

		p.pb(B[j*2]);
		ll ans=use_machine(p);
		counta+=ans/2;
	}

	}
	return counta;

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Partially correct 3 ms 440 KB Output is partially correct
8 Partially correct 4 ms 344 KB Output is partially correct
9 Partially correct 3 ms 344 KB Output is partially correct
10 Partially correct 4 ms 344 KB Output is partially correct
11 Partially correct 4 ms 344 KB Output is partially correct
12 Partially correct 6 ms 344 KB Output is partially correct
13 Partially correct 4 ms 440 KB Output is partially correct
14 Partially correct 2 ms 344 KB Output is partially correct
15 Partially correct 4 ms 344 KB Output is partially correct
16 Partially correct 4 ms 344 KB Output is partially correct
17 Partially correct 2 ms 344 KB Output is partially correct
18 Partially correct 4 ms 344 KB Output is partially correct
19 Partially correct 4 ms 344 KB Output is partially correct
20 Partially correct 3 ms 344 KB Output is partially correct
21 Partially correct 6 ms 600 KB Output is partially correct
22 Partially correct 5 ms 344 KB Output is partially correct
23 Partially correct 4 ms 344 KB Output is partially correct
24 Runtime error 2 ms 600 KB Execution killed with signal 6
25 Halted 0 ms 0 KB -