Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bits/stdc++.h"
- using namespace std;
- typedef int64_t ll;
- // #define int ll
- const ll inf = ll(4e18) + 5;
- const char nl = '\n';
- const int N = 10;
- bitset<N> b;
- bool ask(int g)
- {
- cout << g << endl;
- b[g] = 0;
- if(b == bitset<N>()){
- cout << "found\n";
- exit(0);
- }
- cout << b << '\n';
- b = (b >> 1) | (b << 1);
- b[0] = 0;
- return 0;
- }
- void mess_it_up()
- {
- int n;
- cin >> n;
- for(int i = 1; i <= n; i++){
- b[i] = 1;
- }
- while (n > 3) {
- if (ask(n-1)) {
- return;
- }
- if (ask(n+1)) {
- return;
- }
- if (ask(n)) {
- return;
- }
- n--;
- }
- if (ask(2)) {
- return;
- }
- if (ask(4)) {
- return;
- }
- if (ask(3)) {
- return;
- }
- if (ask(2)) {
- return;
- }
- // assert(false);
- // for(int i = 1; i <= 1000; i++){
- // if(b[i])
- // cout << i << '\n';
- // }
- return;
- }
- signed main()
- {
- int let_it_happen = 1;
- cin >> let_it_happen;
- for (int cool = 1; cool <= let_it_happen; cool++) {
- mess_it_up();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment