Submission #351916

#TimeUsernameProblemLanguageResultExecution timeMemory
351916beksultan04Counting Mushrooms (IOI20_mushrooms)C++14
25 / 100
128 ms512 KiB
#include "mushrooms.h"
#ifndef EVAL
#include "stub.cpp"
#endif // EVAL
#include <bits/stdc++.h>
using namespace std;
#define lol long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
const int N = 1e6+12,INF=1e9+7;
int count_mushrooms(int n) {
	vector<int> m;
	int ostatok = n-1,ans=1;
	int x = 1;
	while (x+1 < n){
        m.pb(x++);
        m.pb(0);
        m.pb(x++);
        int z = use_machine(m);
        if (z == 1)
            ans++;
        if (z == 0)ans +=2;
        m.pop_back();
        m.pop_back();
        m.pop_back();
	}
	if (x < n){
        m.pb(0);
        m.pb(x);
        ans += 1 - (use_machine(m));
	}
	ret ans;


}








Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:30:6: warning: unused variable 'ostatok' [-Wunused-variable]
   30 |  int ostatok = n-1,ans=1;
      |      ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...