Submission #978139

# Submission time Handle Problem Language Result Execution time Memory
978139 2024-05-08T22:59:29 Z SiliconSquared Counting Mushrooms (IOI20_mushrooms) C++14
Compilation error
0 ms 0 KB
#include "insects.h"
using namespace std;
#include <vector>
#include <iostream>
int min_cardinality(int N) {
    int a,b,c,x,y,q;
    vector<bool> g;
    vector<bool> h;
    bool f;
    g.resize(N,false);
    h.resize(N);
    // for (int i=0;i<N;i++){
    //     move_inside(i);
    // }
    // b=press_button();
    // for (int i=0;i<N;i++){
    //     move_outside(i);
    // }
    a=1;b=N;
    y=0;
    for (int i=0;i<N;i++){
        move_inside(i);
        if (press_button()==2){
            move_outside(i);
            g[i]=true;
        }else{
            y++;
        }
    }
    for (int i=0;i<N;i++){
        if (!g[i]){
            move_outside(i);
        }
        g[i]=false;
    }
    while (a!=b){
        c=(a+b+1)/2;
        x=0;
        for (int i=0;i<N;i++){
            // if (!g[i]){
                move_inside(i);
                q=press_button();
                if (q>c){//cerr<<c<<','<<i<<';';
                    move_outside(i);
                    h[i]=true;
                    x++;
                }
            // }
        }
        for (int i=0;i<N;i++){
            // if (!g[i]){
                if (!h[i]){
                    move_outside(i);
                }
            // }
        }
        f=((N-x)==y*c);
        // for (int i=0;i<N;i++){
        //     if (!g[i]){
        //         if (h[i]){
        //             move_inside(i);
        //             if (press_button()==2){
        //                 move_outside(i);
        //             }
        //         }
        //     }
        // }
        // f=true;
        // for (int i=0;i<N;i++){
        //     if ((!g[i])&&(!h[i])){
        //         move_inside(i);
        //         if (press_button()==2){
        //             h[i]=true;
        //         }else{
        //             f=false;
        //         }
        //         move_outside(i);
        //     }
        // }
        if (f){
            //all bugs eliminated
            a=c;
        }else{
            //some bugs remain
            b=c-1;
            // for (int i=0;i<N;i++){
            //     if (h[i]){
            //         g[i]=true;
            //     }
            // }
        }
    }
    return a;
}

Compilation message

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