Guest User

Untitled

a guest
Mar 2nd, 2026
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #include "bits/stdc++.h"
  2. using namespace std;
  3.  
  4. typedef int64_t ll;
  5. // #define int ll
  6.  
  7. const ll inf = ll(4e18) + 5;
  8. const char nl = '\n';
  9.  
  10. const int N = 10;
  11. bitset<N> b;
  12.  
  13. bool ask(int g)
  14. {
  15. cout << g << endl;
  16. b[g] = 0;
  17. if(b == bitset<N>()){
  18. cout << "found\n";
  19. exit(0);
  20. }
  21. cout << b << '\n';
  22. b = (b >> 1) | (b << 1);
  23. b[0] = 0;
  24. return 0;
  25. }
  26.  
  27. void mess_it_up()
  28. {
  29. int n;
  30. cin >> n;
  31. for(int i = 1; i <= n; i++){
  32. b[i] = 1;
  33. }
  34. while (n > 3) {
  35. if (ask(n-1)) {
  36. return;
  37. }
  38. if (ask(n+1)) {
  39. return;
  40. }
  41. if (ask(n)) {
  42. return;
  43. }
  44. n--;
  45. }
  46. if (ask(2)) {
  47. return;
  48. }
  49. if (ask(4)) {
  50. return;
  51. }
  52. if (ask(3)) {
  53. return;
  54. }
  55. if (ask(2)) {
  56. return;
  57. }
  58. // assert(false);
  59. // for(int i = 1; i <= 1000; i++){
  60. // if(b[i])
  61. // cout << i << '\n';
  62. // }
  63. return;
  64. }
  65.  
  66. signed main()
  67. {
  68. int let_it_happen = 1;
  69. cin >> let_it_happen;
  70.  
  71. for (int cool = 1; cool <= let_it_happen; cool++) {
  72. mess_it_up();
  73. }
  74. return 0;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment