//
#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));
while(k > p){
s = (p+k+1)/2;
vector <int> w, e;
bool b(1);
for(auto i: d){
move_inside(i);
if(press_button() > s){
move_outside(i);
e.pb(i);
}
else w.pb(i);
if(sz(w)+sz(v) == s*r){
p = s;
for(auto i: w)v.pb(i);
for(auto j: d)if(j > i)e.pb(j);
d = e;
b = 0;
break;
}
}
if(b){
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 |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
3 ms |
432 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
3 ms |
344 KB |
Output is correct |
9 |
Correct |
4 ms |
344 KB |
Output is correct |
10 |
Correct |
3 ms |
344 KB |
Output is correct |
11 |
Correct |
2 ms |
344 KB |
Output is correct |
12 |
Correct |
4 ms |
344 KB |
Output is correct |
13 |
Correct |
4 ms |
344 KB |
Output is correct |
14 |
Correct |
4 ms |
344 KB |
Output is correct |
15 |
Correct |
3 ms |
344 KB |
Output is correct |
16 |
Correct |
2 ms |
344 KB |
Output is correct |
17 |
Correct |
3 ms |
344 KB |
Output is correct |
18 |
Correct |
2 ms |
440 KB |
Output is correct |
19 |
Correct |
3 ms |
344 KB |
Output is correct |
20 |
Correct |
3 ms |
436 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
440 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 |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
3 ms |
432 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
3 ms |
344 KB |
Output is correct |
9 |
Correct |
4 ms |
344 KB |
Output is correct |
10 |
Correct |
3 ms |
344 KB |
Output is correct |
11 |
Correct |
2 ms |
344 KB |
Output is correct |
12 |
Correct |
4 ms |
344 KB |
Output is correct |
13 |
Correct |
4 ms |
344 KB |
Output is correct |
14 |
Correct |
4 ms |
344 KB |
Output is correct |
15 |
Correct |
3 ms |
344 KB |
Output is correct |
16 |
Correct |
2 ms |
344 KB |
Output is correct |
17 |
Correct |
3 ms |
344 KB |
Output is correct |
18 |
Correct |
2 ms |
440 KB |
Output is correct |
19 |
Correct |
3 ms |
344 KB |
Output is correct |
20 |
Correct |
3 ms |
436 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
440 KB |
Output is correct |
23 |
Correct |
10 ms |
696 KB |
Output is correct |
24 |
Correct |
8 ms |
432 KB |
Output is correct |
25 |
Correct |
12 ms |
344 KB |
Output is correct |
26 |
Correct |
15 ms |
344 KB |
Output is correct |
27 |
Correct |
12 ms |
344 KB |
Output is correct |
28 |
Correct |
5 ms |
344 KB |
Output is correct |
29 |
Correct |
17 ms |
848 KB |
Output is correct |
30 |
Correct |
20 ms |
344 KB |
Output is correct |
31 |
Correct |
11 ms |
344 KB |
Output is correct |
32 |
Correct |
12 ms |
344 KB |
Output is correct |
33 |
Correct |
16 ms |
600 KB |
Output is correct |
34 |
Correct |
10 ms |
344 KB |
Output is correct |
35 |
Correct |
8 ms |
344 KB |
Output is correct |
36 |
Correct |
13 ms |
696 KB |
Output is correct |
37 |
Correct |
20 ms |
676 KB |
Output is correct |
38 |
Correct |
14 ms |
344 KB |
Output is correct |
39 |
Correct |
8 ms |
600 KB |
Output is correct |
40 |
Correct |
7 ms |
344 KB |
Output is correct |
41 |
Correct |
5 ms |
436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
24 ms |
928 KB |
Output is correct |
8 |
Correct |
11 ms |
344 KB |
Output is correct |
9 |
Correct |
26 ms |
592 KB |
Output is correct |
10 |
Correct |
30 ms |
432 KB |
Output is correct |
11 |
Correct |
20 ms |
424 KB |
Output is correct |
12 |
Correct |
13 ms |
344 KB |
Output is correct |
13 |
Correct |
25 ms |
344 KB |
Output is correct |
14 |
Correct |
29 ms |
600 KB |
Output is correct |
15 |
Correct |
38 ms |
344 KB |
Output is correct |
16 |
Correct |
22 ms |
344 KB |
Output is correct |
17 |
Correct |
30 ms |
444 KB |
Output is correct |
18 |
Correct |
19 ms |
444 KB |
Output is correct |
19 |
Correct |
24 ms |
344 KB |
Output is correct |
20 |
Correct |
28 ms |
344 KB |
Output is correct |
21 |
Correct |
31 ms |
600 KB |
Output is correct |
22 |
Correct |
50 ms |
1108 KB |
Output is correct |
23 |
Correct |
30 ms |
448 KB |
Output is correct |
24 |
Correct |
25 ms |
592 KB |
Output is correct |
25 |
Correct |
14 ms |
440 KB |
Output is correct |
26 |
Correct |
8 ms |
344 KB |
Output is correct |
27 |
Correct |
21 ms |
344 KB |
Output is correct |
28 |
Correct |
17 ms |
344 KB |
Output is correct |
29 |
Correct |
34 ms |
592 KB |
Output is correct |
30 |
Correct |
30 ms |
432 KB |
Output is correct |
31 |
Correct |
26 ms |
688 KB |
Output is correct |
32 |
Correct |
34 ms |
600 KB |
Output is correct |
33 |
Correct |
18 ms |
344 KB |
Output is correct |
34 |
Correct |
23 ms |
600 KB |
Output is correct |
35 |
Partially correct |
30 ms |
612 KB |
Output is partially correct |
36 |
Correct |
19 ms |
344 KB |
Output is correct |
37 |
Correct |
21 ms |
684 KB |
Output is correct |
38 |
Correct |
28 ms |
600 KB |
Output is correct |
39 |
Correct |
22 ms |
432 KB |
Output is correct |
40 |
Correct |
16 ms |
344 KB |
Output is correct |
41 |
Correct |
21 ms |
344 KB |
Output is correct |
42 |
Partially correct |
27 ms |
600 KB |
Output is partially correct |
43 |
Correct |
5 ms |
344 KB |
Output is correct |
44 |
Correct |
18 ms |
344 KB |
Output is correct |
45 |
Correct |
21 ms |
600 KB |
Output is correct |
46 |
Correct |
12 ms |
600 KB |
Output is correct |
47 |
Correct |
13 ms |
448 KB |
Output is correct |
48 |
Correct |
14 ms |
820 KB |
Output is correct |