답안 #1109951

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1109951 2024-11-08T08:17:19 Z tibinyte 드문 곤충 (IOI22_insects) C++17
0 / 100
35 ms 504 KB
#include "insects.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int random(int st, int dr)
{
  uniform_int_distribution<int> dist(st, dr);
  return dist(rng);
}

template <typename t>
using ordered_set = tree<t, null_type, less<t>, rb_tree_tag, tree_order_statistics_node_update>;

const int mod = 1e9 + 7;
struct Mint
{
  int val;
  Mint(int x = 0)
  {
    val = x % mod;
  }
  Mint(long long x)
  {
    val = x % mod;
  }
  Mint operator+(Mint oth)
  {
    return val + oth.val;
  }
  Mint operator-(Mint oth)
  {
    return val - oth.val + mod;
  }
  Mint operator*(Mint oth)
  {
    return 1ll * val * oth.val;
  }
  void operator+=(Mint oth)
  {
    val = (*this + oth).val;
  }
  void operator-=(Mint oth)
  {
    val = (*this - oth).val;
  }
  void operator*=(Mint oth)
  {
    val = (*this * oth).val;
  }
};

Mint powmod(int a, int b)
{
  if (b == 0)
  {
    return 1;
  }
  if (b % 2 == 1)
  {
    return powmod(a, b - 1) * a;
  }
  Mint p = powmod(a, b / 2);
  return p * p;
}

/*
                 .___                 __                 __           .__
  ____  ____   __| _/____     _______/  |______ ________/  |_  ______ |  |__   ___________   ____
_/ ___\/  _ \ / __ |/ __ \   /  ___/\   __\__  \\_  __ \   __\/  ___/ |  |  \_/ __ \_  __ \_/ __ \
\  \__(  <_> ) /_/ \  ___/   \___ \  |  |  / __ \|  | \/|  |  \___ \  |   Y  \  ___/|  | \/\  ___/
 \___  >____/\____ |\___  > /____  > |__| (____  /__|   |__| /____  > |___|  /\___  >__|    \___  >
     \/           \/    \/       \/            \/                 \/       \/     \/            \/
*/

int min_cardinality(int N)
{
  int n = N;
  function<int(int)> get = [&](int x)
  {
    int ans = 0;
    vector<bool> out(n, false);
    for (int i = 0; i < n; ++i)
    {
      move_inside(i);
      if (press_button() == x + 1)
      {
        ans++;
        move_outside(i);
        out[i] = true;
      }
    }
    for (int i = 0; i < n; ++i)
    {
      if (!out[i])
      {
        move_outside(i);
      }
    }
    return ans;
  };
  int ans = 1;
  int distincte = n - get(1);
  int sum = n;
  while (true)
  {
    int ans = sum / distincte;
    int val = n - distincte * ans;
    int frog = get(ans);
    if (val == get(ans))
    {
      return ans;
    }
    sum = sum - frog;
  }
}

/*
I cannot take this anymore
Saying everything I've said before
All these words, they make no sense
I find bliss in ignorance
Less I hear, the less you say
You'll find that out anyway
Just like before

Everything you say to me
(Takes me one step closer to the edge)
(And I'm about to break)
I need a little room to breathe
(Cause I'm one step closer to the edge)
(I'm about to break)
*/

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:110:7: warning: unused variable 'ans' [-Wunused-variable]
  110 |   int ans = 1;
      |       ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 7 ms 336 KB Output is correct
7 Correct 7 ms 336 KB Output is correct
8 Correct 11 ms 336 KB Output is correct
9 Incorrect 35 ms 504 KB Wrong answer.
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 7 ms 336 KB Output is correct
7 Correct 7 ms 336 KB Output is correct
8 Correct 11 ms 336 KB Output is correct
9 Incorrect 35 ms 504 KB Wrong answer.
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Incorrect 1 ms 336 KB Wrong answer.
6 Halted 0 ms 0 KB -