답안 #1000043

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1000043 2024-06-16T13:53:48 Z kunzaZa183 드문 곤충 (IOI22_insects) C++17
0 / 100
1 ms 596 KB
#include "insects.h"

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

int min_cardinality(int N) {
  vector<int> cur;
  vector<int> each(N);
  int ct = 0;
  for (int i = 0; i < N; i++) {
    cur.push_back(i);
    move_inside(i);
    int res = press_button();
    if (res == 1)
      each[i] = ct++;
    else {
      for (auto a : cur) {
        move_outside(a);
        res = press_button();
        if (res == 1) {
          each[i] = each[a];
          break;
        }
        move_inside(a);
      }
      cur.pop_back();
      move_outside(i);
    }
  }
  map<int, int> mii;
  for (auto a : each) mii[a]++;
  vector<pair<int, int>> vpii;
  for (auto [a, b] : mii) vpii.emplace_back(b, a);
  sort(vpii.begin(), vpii.end());
  // for (auto a : vpii) cout << a.first << ' ' << a.second << "\n";
  return vpii.front().first;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 0 ms 344 KB Wrong answer.
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 0 ms 344 KB Wrong answer.
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Incorrect 1 ms 344 KB Wrong answer.
7 Halted 0 ms 0 KB -