Submission #1080070

# Submission time Handle Problem Language Result Execution time Memory
1080070 2024-08-29T06:44:36 Z Sir_Ahmed_Imran Counting Mushrooms (IOI20_mushrooms) C++17
Compilation error
0 ms 0 KB
                            ///~~~LOTA~~~///
//#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define N 1501
int count_mushrooms(int n){
    int m;
    vector<int> a,b;
    a.append(0);
    if(use_machine({0,1}))
        b.append(1);
    else a.append(1);
    if(n>2){
        if(use_machine({0,2}))
            b.append(2);
        else a.append(2);
    }
    if(b.size()==2) swap(a,b);
    for(int i=3;i<n-1;i+=2){
        m=use_machine({i,a[0],i+1,a[1]});
        if(m%2) b.append(i);
        else a.append(i);
        if(m>1) b.append(i+1);
        else a.append(i+1);
    }
    if(n%2==0 && n>2){
        if(use_machine({a[0],n-1}))
            b.append(n-1);
        else a.append(n-1);
    }
    if(!a[0]) return a.size();
    return b.size();
}

Compilation message

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:22:8: error: 'use_machine' was not declared in this scope
   22 |     if(use_machine({0,1}))
      |        ^~~~~~~~~~~
mushrooms.cpp:26:12: error: 'use_machine' was not declared in this scope
   26 |         if(use_machine({0,2}))
      |            ^~~~~~~~~~~
mushrooms.cpp:32:11: error: 'use_machine' was not declared in this scope
   32 |         m=use_machine({i,a[0],i+1,a[1]});
      |           ^~~~~~~~~~~
mushrooms.cpp:39:12: error: 'use_machine' was not declared in this scope
   39 |         if(use_machine({a[0],n-1}))
      |            ^~~~~~~~~~~