Submission #1296200

#TimeUsernameProblemLanguageResultExecution timeMemory
1296200eri16Counting Mushrooms (IOI20_mushrooms)C++20
Compilation error
0 ms0 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>

using namespace std;

int count_mushrooms(int n){
    
    vector <int> A;
    vector <int> B;
    
    int ans=1;
    int cur=150;
        
    A.push_back(0);
    
    vector <int> cl;
    
    for (int i=1; i<3 && i<n; i++){
        vector <int> test;
        test.push_back(0);
        test.push_back(i);
        if (use_machine(test)==0){
            A.push_back(i);
            ans++;
        }
        else{
            B.push_back(i);
        }
    }    
    
    if (A.size()>B.size()){cl=A;}
    else{cl=B;}
    
    for (int i=3; i<150 && i<n; i++){
        vector <int> test;
        test.push_back(cl[0]);
        test.push_back(i);
        int tmans=use_machine(i);
        if (c[0]==0){
            if (tmans==0){A.push_back(i);ans++;}
            else{B.psuh_back(i);}
        }
        else{
            if (tmans==1){A.push_back(i);ans++;}
            else{B.psuh_back(i);}            
        }
    }
    
    vector <int> c;
    
    if (A.size()>B.size()){c=A;}
    else{c=B;}
    
    while (cur<n){
       
        vector <int> test;
         
        int prv=cur;
       
        for (int i=0; i<75 && cur<n; i++){
           test.push_back(cur);
           test.push_back(c[i]);
           cur++;
        }
        
        int tmans=use_machine(test);
        
        if (c[0]==0){
            if (tmans%2==0){ans++;}
            ans=ans+(cur-prv-1)-tmans/2;
        }
        else{
            if (tmans%2==1){ans++;}
            ans=ans+tmans/2;
        }
        
    }  
    return ans;
}

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:38:31: error: could not convert 'i' from 'int' to 'std::vector<int>'
   38 |         int tmans=use_machine(i);
      |                               ^
      |                               |
      |                               int
mushrooms.cpp:39:13: error: 'c' was not declared in this scope
   39 |         if (c[0]==0){
      |             ^
mushrooms.cpp:41:20: error: 'class std::vector<int>' has no member named 'psuh_back'; did you mean 'push_back'?
   41 |             else{B.psuh_back(i);}
      |                    ^~~~~~~~~
      |                    push_back
mushrooms.cpp:45:20: error: 'class std::vector<int>' has no member named 'psuh_back'; did you mean 'push_back'?
   45 |             else{B.psuh_back(i);}
      |                    ^~~~~~~~~
      |                    push_back