Submission #1051176

#TimeUsernameProblemLanguageResultExecution timeMemory
1051176TrentRarest Insects (IOI22_insects)C++17
10 / 100
204 ms600 KiB
#include "insects.h"
#include "bits/stdc++.h"
using namespace std;
#define forR(i, x) for(int i = 0; i < (x); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;

int min_cardinality(int N) {
  vvi dst;
  set<int> vals;
  forR(i, N) vals.insert(i);
  while(dst.size() <= 1 || dst[dst.size() - 1].size() == dst[dst.size() - 2].size()) {
    dst.emplace_back();
    for(int i : vals) {
      move_inside(i);
      if(press_button() == dst.size()) {
        dst.back().push_back(i);
      } else {
        move_outside(i);
      }
    }
    for(int i : dst.back()) vals.erase(vals.find(i));
  }
  // for(vi& i : dst) {
  //   for(int j : i) cerr << j << ' ';
  //   cerr << '\n';
  // }
  return dst.size() - 1;
}

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:21:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |       if(press_button() == dst.size()) {
      |          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...