Submission #1057798

# Submission time Handle Problem Language Result Execution time Memory
1057798 2024-08-14T06:14:28 Z MercubytheFirst Rarest Insects (IOI22_insects) C++17
0 / 100
1 ms 344 KB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;


int min_cardinality(int N) {
  int type_cnt = 0;
  vector<int> type(N, -1);
  type[0] = 0;
  for(int i = 0; i < N; ++i) {
    if(type[i] == -1) {
      type[i] = i;
    }
    else {
      continue;
    }
    move_inside(i);
    for(int j = i + 1; j < N; ++j) {
      if(type[j] != -1) {
        continue;
      }
      move_inside(j);
      const int c = press_button();
      if(c == 2) {
        type[j] = type[i];
      }
      move_outside(j);
    }
    move_outside(i);
  }
  vector<int> cnt(N);
  for(int x : type) {
    assert(x != -1);
    cnt[x]++;
  }
  return *min_element(cnt.begin(), cnt.end());
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:8:7: warning: unused variable 'type_cnt' [-Wunused-variable]
    8 |   int type_cnt = 0;
      |       ^~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 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 -