Submission #1076241

# Submission time Handle Problem Language Result Execution time Memory
1076241 2024-08-26T12:07:43 Z Boas Rarest Insects (IOI22_insects) C++17
0 / 100
1 ms 344 KB
#include "insects.h"

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define loop(x, i) for (int i = 0; i < x; i++)
#define rev(x, i) for (int i = (int)x - 1; i >= 0; i--)
#define ALL(x) begin(x), end(x)
#define sz(x) (int)x.size()

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;

int min_cardinality(int N)
{
  int res = 1;
  vi type(N);
  loop(N, i) type[i] = i;
  loop(N, i)
  {
    if (type[i] != i)
      continue;
    int cnt = 1;
    move_inside(i);
    for (int j = i + 1; j < N; j++)
    {
      move_inside(j);
      int res = press_button();
      if (res == 2)
      {
        type[j] = type[i]; // =i
        cnt++;
      }
      move_outside(j);
    }
    move_outside(i);
    res = min(res, cnt);
    if (cnt == 1)
      break;
  }
  return res;
}
# 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 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong answer.
3 Halted 0 ms 0 KB -