Submission #726643

#TimeUsernameProblemLanguageResultExecution timeMemory
726643vjudge1Rarest Insects (IOI22_insects)C++17
10 / 100
403 ms412 KiB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;

int min_cardinality(int N) {
    int Min = -1;
    map<int , int> cnts;
    for(int i=0 ; i<N ; i++){
        int cnt = 1;
        move_inside(i);
        vector<int> now;
        now.push_back(i);
        for(int j=0 ; j<N ; j++){
            if(i != j){
                move_inside(j);
                int cnt1 = press_button();
                if(cnt1 > cnt){
                    cnt = cnt1;
                    now.push_back(j);
                }
                else{
                    move_outside(j);
                }
            }
        }
        cnts[i] = cnt;
        for(int j=0 ; j<now.size() ; j++){
            move_outside(now[j]);
        }
    }
    for(auto [x , y] : cnts){
        Min = min(Min , y);
        if(Min == -1){
            Min = y;
        }
    }
    return Min;
}

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:27:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for(int j=0 ; j<now.size() ; j++){
      |                       ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...