Submission #628166

#TimeUsernameProblemLanguageResultExecution timeMemory
628166sword060Rarest Insects (IOI22_insects)C++17
0 / 100
0 ms208 KiB
#include <bits/stdc++.h> #include "insects.h" using namespace std; void move_inside(int); void move_outside(int); int press_button(); int min_cardinality(int x) { map<int,int>mp; int ans=1e9,lst=1; for(int i=0;i<x;i++)move_inside(i); int z=press_button(); ans=z; while(mp.size()!=x){ for(int i=0;i<x;i++){ if(mp[i])continue; move_outside(i); int c=press_button(); if(c!=z){ mp[i]=1; for(int j=i-1;j>=0;j--){ move_inside(j); if(press_button()!=c){ mp[j]=1; }else{ move_inside(j); } } z=c;ans=min(ans,c); break; } } } return ans; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:13:18: warning: comparison of integer expressions of different signedness: 'std::map<int, int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   13 |   while(mp.size()!=x){
      |         ~~~~~~~~~^~~
insects.cpp:9:15: warning: unused variable 'lst' [-Wunused-variable]
    9 |   int ans=1e9,lst=1;
      |               ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...