//
#ifndef __SIZEOF_INT128__
#define __SIZEOF_INT128__
#endif
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
template <typename T> using oset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define rep(i, p, k) for(int i(p); i < (k); ++i)
#define per(i, p, k) for(int i(p); i > (k); --i)
#define sz(x) (int)(x).size()
#define sc static_cast
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef __int128_t lll;
//#define int ll
template <typename T = int> using par = std::pair <T, T>;
#define fi first
#define se second
#define test int _number_of_tests(in()); while(_number_of_tests--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb emplace_back
struct Timer {
string name{""};
time_point<high_resolution_clock> end, start{high_resolution_clock::now()};
duration<float, std::milli> dur;
Timer() = default;
Timer(string nm): name(nm) {}
~Timer() {
end = high_resolution_clock::now(); dur= end - start;
cout << "@" << name << "> " << dur.count() << " ms" << '\n';
}
};
template <typename T = int> inline T in()
{
static T x;
std::cin >> x;
return x;
}
std::string yn(bool b)
{
if(b) return "YES\n";
else return "NO\n";
}
template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par);
template <typename T> std::ostream& operator<< (std::ostream& out, const std::vector <T>& wek)
{
for(const auto& i : wek)out << i << ' ';
return out;
}
template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par)
{
out << '{'<<par.first<<", "<<par.second<<"}";
return out;
}
#define show(x) cerr << #x << " = " << x << '\n';
#include "insects.h"
int min_cardinality(int n)
{
vector <int> v;
vector <int> d;
rep(i, 0, n){
move_inside(i);
if(press_button() > 1){
move_outside(i);
d.pb(i);
}
else v.pb(i);
}
int p(1), k(n/sz(v)), s;
int r(sz(v));
// cerr << v << " | " << d << '\n';
mt19937 tw(2137);
while(k > p){
// cerr << d << ":\n";
s = p + tw()%(k-p+1);
vector <int> w, e;
for(auto i: d){
move_inside(i);
if(press_button() > s){
move_outside(i);
e.pb(i);
}
else w.pb(i);
}
// cerr << s << ": " << w << " | " << e << '\n';
if(sz(w)+sz(v) == s*r){
p = s;
for(auto i: w)v.pb(i);
d = e;
}
else{
k = s-1;
for(auto i: w)move_outside(i);
d = w;
}
}
return p;
}
# |
Verdict |
Execution time |
Memory |
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 |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
2 ms |
344 KB |
Output is correct |
9 |
Correct |
3 ms |
344 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
592 KB |
Output is correct |
12 |
Correct |
5 ms |
344 KB |
Output is correct |
13 |
Correct |
2 ms |
344 KB |
Output is correct |
14 |
Correct |
4 ms |
440 KB |
Output is correct |
15 |
Correct |
5 ms |
344 KB |
Output is correct |
16 |
Correct |
5 ms |
344 KB |
Output is correct |
17 |
Correct |
7 ms |
344 KB |
Output is correct |
18 |
Correct |
3 ms |
344 KB |
Output is correct |
19 |
Correct |
2 ms |
440 KB |
Output is correct |
20 |
Correct |
2 ms |
344 KB |
Output is correct |
21 |
Correct |
2 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
2 ms |
344 KB |
Output is correct |
9 |
Correct |
3 ms |
344 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
592 KB |
Output is correct |
12 |
Correct |
5 ms |
344 KB |
Output is correct |
13 |
Correct |
2 ms |
344 KB |
Output is correct |
14 |
Correct |
4 ms |
440 KB |
Output is correct |
15 |
Correct |
5 ms |
344 KB |
Output is correct |
16 |
Correct |
5 ms |
344 KB |
Output is correct |
17 |
Correct |
7 ms |
344 KB |
Output is correct |
18 |
Correct |
3 ms |
344 KB |
Output is correct |
19 |
Correct |
2 ms |
440 KB |
Output is correct |
20 |
Correct |
2 ms |
344 KB |
Output is correct |
21 |
Correct |
2 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
9 ms |
704 KB |
Output is correct |
24 |
Correct |
5 ms |
344 KB |
Output is correct |
25 |
Correct |
17 ms |
596 KB |
Output is correct |
26 |
Correct |
48 ms |
344 KB |
Output is correct |
27 |
Correct |
18 ms |
600 KB |
Output is correct |
28 |
Correct |
5 ms |
344 KB |
Output is correct |
29 |
Correct |
17 ms |
444 KB |
Output is correct |
30 |
Correct |
14 ms |
440 KB |
Output is correct |
31 |
Correct |
11 ms |
344 KB |
Output is correct |
32 |
Correct |
12 ms |
600 KB |
Output is correct |
33 |
Correct |
21 ms |
344 KB |
Output is correct |
34 |
Correct |
21 ms |
344 KB |
Output is correct |
35 |
Correct |
10 ms |
344 KB |
Output is correct |
36 |
Correct |
22 ms |
600 KB |
Output is correct |
37 |
Correct |
32 ms |
344 KB |
Output is correct |
38 |
Correct |
12 ms |
344 KB |
Output is correct |
39 |
Correct |
12 ms |
600 KB |
Output is correct |
40 |
Correct |
10 ms |
600 KB |
Output is correct |
41 |
Correct |
5 ms |
444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
20 ms |
444 KB |
Output is correct |
8 |
Correct |
6 ms |
344 KB |
Output is correct |
9 |
Partially correct |
29 ms |
428 KB |
Output is partially correct |
10 |
Correct |
30 ms |
684 KB |
Output is correct |
11 |
Correct |
28 ms |
600 KB |
Output is correct |
12 |
Correct |
19 ms |
432 KB |
Output is correct |
13 |
Correct |
29 ms |
432 KB |
Output is correct |
14 |
Partially correct |
33 ms |
344 KB |
Output is partially correct |
15 |
Correct |
32 ms |
592 KB |
Output is correct |
16 |
Partially correct |
63 ms |
428 KB |
Output is partially correct |
17 |
Partially correct |
54 ms |
692 KB |
Output is partially correct |
18 |
Correct |
23 ms |
428 KB |
Output is correct |
19 |
Partially correct |
43 ms |
444 KB |
Output is partially correct |
20 |
Partially correct |
52 ms |
1104 KB |
Output is partially correct |
21 |
Partially correct |
46 ms |
600 KB |
Output is partially correct |
22 |
Partially correct |
40 ms |
604 KB |
Output is partially correct |
23 |
Partially correct |
45 ms |
600 KB |
Output is partially correct |
24 |
Correct |
32 ms |
344 KB |
Output is correct |
25 |
Correct |
28 ms |
432 KB |
Output is correct |
26 |
Correct |
13 ms |
600 KB |
Output is correct |
27 |
Partially correct |
46 ms |
600 KB |
Output is partially correct |
28 |
Partially correct |
48 ms |
600 KB |
Output is partially correct |
29 |
Partially correct |
52 ms |
600 KB |
Output is partially correct |
30 |
Partially correct |
24 ms |
600 KB |
Output is partially correct |
31 |
Correct |
21 ms |
428 KB |
Output is correct |
32 |
Correct |
45 ms |
344 KB |
Output is correct |
33 |
Correct |
34 ms |
672 KB |
Output is correct |
34 |
Correct |
14 ms |
600 KB |
Output is correct |
35 |
Partially correct |
38 ms |
932 KB |
Output is partially correct |
36 |
Partially correct |
53 ms |
676 KB |
Output is partially correct |
37 |
Partially correct |
37 ms |
428 KB |
Output is partially correct |
38 |
Partially correct |
32 ms |
444 KB |
Output is partially correct |
39 |
Partially correct |
34 ms |
444 KB |
Output is partially correct |
40 |
Partially correct |
34 ms |
344 KB |
Output is partially correct |
41 |
Partially correct |
32 ms |
444 KB |
Output is partially correct |
42 |
Partially correct |
36 ms |
856 KB |
Output is partially correct |
43 |
Correct |
5 ms |
344 KB |
Output is correct |
44 |
Correct |
17 ms |
600 KB |
Output is correct |
45 |
Partially correct |
29 ms |
440 KB |
Output is partially correct |
46 |
Correct |
35 ms |
600 KB |
Output is correct |
47 |
Correct |
26 ms |
448 KB |
Output is correct |
48 |
Correct |
17 ms |
600 KB |
Output is correct |