Submission #308478

#TimeUsernameProblemLanguageResultExecution timeMemory
308478CaroLinda버섯 세기 (IOI20_mushrooms)C++14
10 / 100
258 ms512 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>

#define debug printf
#define lp(i,a,b) for(int i = a ; i < b; i++)
#define pb push_back
#define ff first
#define ss second
#define mk make_pair
#define pii pair<int,int>
#define ll long long 
#define all(x) x.begin(),x.end()

using namespace std ;

int count_mushrooms(int n) 
{

	if( n <= 226 )
	{
		vector<int> type(n,1) ;

		for(int i = 1 ; i < n ; i++ )
		{
			int x = use_machine( {i,i-1} ) ;
			type[i] = type[i-1] ;
			if(x) type[i] ^= 1 ;
		}

		int cnt = 0 ;
		lp(i,0,n) cnt += type[i] ;
		return cnt ;
	}

	
}

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...