Submission #797853

#TimeUsernameProblemLanguageResultExecution timeMemory
797853vjudge1Packing Biscuits (IOI20_biscuits)C++17
Compilation error
0 ms0 KiB
#include "mushrooms.h"
#include<bits/stdc++.h>
using namespace std;
#define X 80
int count_mushrooms(int n) {
	if(n<400) {
        int ans = 0;
        n--;
        for(int i = 1; i <= n/2;i++)
            ans+=use_machine({i*2-1,0,i*2});
        if(n%2) ans+=use_machine({0,n});
        return n+1-ans;
    }
    vector<int> good{0};
    vector<int> other;
    int second = 0;
    if(!use_machine({0,1}))
        second = 1, good.push_back(1);
    else
        other.push_back(1);
    if(!use_machine({0,2}))
        second = 1, good.push_back(2);
    else
        other.push_back(2);
    if(!second)
        swap(good, other);
    for(int i = 3; i < 2*X-1; i+=2) {
        int res = use_machine({i,good[0],i+1,good[1]});
        if(res%2-1)
            good.push_back(i);
        else
            other.push_back(i);
        if(res<2)
            good.push_back(i+1);
        else
            other.push_back(i+1);
    }
    if(good.size()<other.size())
        second=!second, swap(good, other);
    int ans = 0, num = 0;
    for(int i = 2*X-1; i < n;) {
        int r = min(n, i+(int)good.size());
        num+=r-i-1;
        vector<int> v;
        for(int j = i; j < r; j++) {
            v.push_back(j);
            v.push_back(good[j-i]);
        }
        int x = use_machine(v);
        ans+=r-i-1-x/2;
        int sz = good.size();
        if(x%2) other.push_back(i);
        else good.push_back(i);
        i+=sz;
        if(good.size()<other.size())
            second=!second, swap(good, other), ans = num-ans;
    }
    ans+=good.size();
    if(second)
        return ans;
    return n - ans;
}

Compilation message (stderr)

biscuits.cpp:1:10: fatal error: mushrooms.h: No such file or directory
    1 | #include "mushrooms.h"
      |          ^~~~~~~~~~~~~
compilation terminated.