# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1109941 | 2024-11-08T07:38:16 Z | tibinyte | Rarest Insects (IOI22_insects) | C++17 | 492 ms | 1416 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 st = 2, dr = n; while (st <= dr) { int mid = (st + dr) / 2; if (n - distincte * mid == get(mid)) { ans = mid; st = mid + 1; } else { dr = mid - 1; } } return ans; } /* 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) */
# | Verdict | Execution time | Memory | 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 | 28 ms | 336 KB | Output is correct |
7 | Correct | 27 ms | 336 KB | Output is correct |
8 | Correct | 29 ms | 336 KB | Output is correct |
9 | Correct | 26 ms | 336 KB | Output is correct |
10 | Correct | 24 ms | 336 KB | Output is correct |
11 | Correct | 28 ms | 336 KB | Output is correct |
12 | Correct | 31 ms | 336 KB | Output is correct |
13 | Correct | 23 ms | 336 KB | Output is correct |
14 | Correct | 30 ms | 336 KB | Output is correct |
15 | Correct | 32 ms | 336 KB | Output is correct |
16 | Correct | 26 ms | 336 KB | Output is correct |
17 | Correct | 22 ms | 336 KB | Output is correct |
18 | Correct | 25 ms | 336 KB | Output is correct |
19 | Correct | 31 ms | 336 KB | Output is correct |
20 | Correct | 28 ms | 504 KB | Output is correct |
21 | Correct | 22 ms | 336 KB | Output is correct |
22 | Correct | 20 ms | 336 KB | Output is correct |
# | Verdict | Execution time | Memory | 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 | 28 ms | 336 KB | Output is correct |
7 | Correct | 27 ms | 336 KB | Output is correct |
8 | Correct | 29 ms | 336 KB | Output is correct |
9 | Correct | 26 ms | 336 KB | Output is correct |
10 | Correct | 24 ms | 336 KB | Output is correct |
11 | Correct | 28 ms | 336 KB | Output is correct |
12 | Correct | 31 ms | 336 KB | Output is correct |
13 | Correct | 23 ms | 336 KB | Output is correct |
14 | Correct | 30 ms | 336 KB | Output is correct |
15 | Correct | 32 ms | 336 KB | Output is correct |
16 | Correct | 26 ms | 336 KB | Output is correct |
17 | Correct | 22 ms | 336 KB | Output is correct |
18 | Correct | 25 ms | 336 KB | Output is correct |
19 | Correct | 31 ms | 336 KB | Output is correct |
20 | Correct | 28 ms | 504 KB | Output is correct |
21 | Correct | 22 ms | 336 KB | Output is correct |
22 | Correct | 20 ms | 336 KB | Output is correct |
23 | Correct | 225 ms | 336 KB | Output is correct |
24 | Correct | 189 ms | 336 KB | Output is correct |
25 | Correct | 175 ms | 336 KB | Output is correct |
26 | Correct | 206 ms | 428 KB | Output is correct |
27 | Correct | 172 ms | 336 KB | Output is correct |
28 | Correct | 207 ms | 688 KB | Output is correct |
29 | Correct | 211 ms | 336 KB | Output is correct |
30 | Correct | 183 ms | 336 KB | Output is correct |
31 | Correct | 199 ms | 504 KB | Output is correct |
32 | Correct | 183 ms | 336 KB | Output is correct |
33 | Correct | 198 ms | 432 KB | Output is correct |
34 | Correct | 202 ms | 584 KB | Output is correct |
35 | Correct | 197 ms | 336 KB | Output is correct |
36 | Correct | 215 ms | 428 KB | Output is correct |
37 | Correct | 213 ms | 432 KB | Output is correct |
38 | Correct | 219 ms | 336 KB | Output is correct |
39 | Correct | 169 ms | 336 KB | Output is correct |
40 | Correct | 184 ms | 336 KB | Output is correct |
41 | Correct | 193 ms | 336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 508 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Partially correct | 1 ms | 336 KB | Output is partially correct |
7 | Partially correct | 474 ms | 676 KB | Output is partially correct |
8 | Partially correct | 406 ms | 676 KB | Output is partially correct |
9 | Partially correct | 457 ms | 896 KB | Output is partially correct |
10 | Partially correct | 449 ms | 436 KB | Output is partially correct |
11 | Partially correct | 397 ms | 336 KB | Output is partially correct |
12 | Partially correct | 408 ms | 1180 KB | Output is partially correct |
13 | Partially correct | 429 ms | 432 KB | Output is partially correct |
14 | Partially correct | 408 ms | 924 KB | Output is partially correct |
15 | Partially correct | 492 ms | 1152 KB | Output is partially correct |
16 | Partially correct | 440 ms | 928 KB | Output is partially correct |
17 | Partially correct | 440 ms | 876 KB | Output is partially correct |
18 | Partially correct | 452 ms | 900 KB | Output is partially correct |
19 | Partially correct | 439 ms | 912 KB | Output is partially correct |
20 | Partially correct | 435 ms | 1416 KB | Output is partially correct |
21 | Partially correct | 440 ms | 920 KB | Output is partially correct |
22 | Partially correct | 450 ms | 924 KB | Output is partially correct |
23 | Partially correct | 431 ms | 904 KB | Output is partially correct |
24 | Partially correct | 422 ms | 892 KB | Output is partially correct |
25 | Partially correct | 402 ms | 1152 KB | Output is partially correct |
26 | Partially correct | 443 ms | 680 KB | Output is partially correct |
27 | Partially correct | 441 ms | 904 KB | Output is partially correct |
28 | Partially correct | 465 ms | 680 KB | Output is partially correct |
29 | Partially correct | 417 ms | 924 KB | Output is partially correct |
30 | Partially correct | 399 ms | 1052 KB | Output is partially correct |
31 | Partially correct | 435 ms | 676 KB | Output is partially correct |
32 | Partially correct | 427 ms | 920 KB | Output is partially correct |
33 | Partially correct | 428 ms | 432 KB | Output is partially correct |
34 | Partially correct | 424 ms | 900 KB | Output is partially correct |
35 | Partially correct | 439 ms | 1156 KB | Output is partially correct |
36 | Partially correct | 434 ms | 676 KB | Output is partially correct |
37 | Partially correct | 435 ms | 924 KB | Output is partially correct |
38 | Partially correct | 457 ms | 676 KB | Output is partially correct |
39 | Partially correct | 436 ms | 864 KB | Output is partially correct |
40 | Partially correct | 431 ms | 916 KB | Output is partially correct |
41 | Partially correct | 452 ms | 908 KB | Output is partially correct |
42 | Partially correct | 458 ms | 924 KB | Output is partially correct |
43 | Partially correct | 97 ms | 336 KB | Output is partially correct |
44 | Partially correct | 388 ms | 688 KB | Output is partially correct |
45 | Partially correct | 452 ms | 1056 KB | Output is partially correct |
46 | Partially correct | 426 ms | 924 KB | Output is partially correct |
47 | Partially correct | 409 ms | 924 KB | Output is partially correct |
48 | Partially correct | 447 ms | 932 KB | Output is partially correct |