Submission #922959

# Submission time Handle Problem Language Result Execution time Memory
922959 2024-02-06T11:10:34 Z Ludissey Rarest Insects (IOI22_insects) C++17
0 / 100
0 ms 344 KB
#include "insects.h"
#include <bits/stdc++.h>

using namespace std;

struct insect {
  int i,sz;
};

int min_cardinality(int N) {
  vector<int> in(0);
  vector<int> out;
  for (int i = 0; i < N; i++) out.push_back(i);
  int r;
  for (r = 1; r < N && out.size()>0; r++)
  {
    int lastIn=in.size();
    for (int i = 0; i < (int)out.size(); i++){
      move_inside(out[i]);
      if(press_button()>r){
        move_outside(out[i]);
      }else{
        in.push_back(out[i]);
        out.erase(out.begin()+i);
        i--;
      }
    }
    if(in.size()<lastIn*2) return (r-1);
    lastIn=in.size();
  }
  return (r-1);
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:28:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |     if(in.size()<lastIn*2) return (r-1);
      |        ~~~~~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong answer.
3 Halted 0 ms 0 KB -