fork download
  1. #include<bits/stdc++.h>
  2. #define pb push_back
  3. using namespace std;
  4. typedef vector< vector<bool> > vvb;
  5. typedef vector<bool> vb;
  6. vvb pet;
  7. void print(vvb a)
  8. {
  9. for(int i = 1; i < a.size(); i++)
  10. {
  11. for(int j = 1; j < a.size(); j++)
  12. cout << a[i][j];
  13. cout << "\n";
  14. }
  15. fflush(stdout);
  16. }
  17. void bruteforce()
  18. {
  19. print(pet);
  20. int x; cin >> x;
  21. int tot1 = x;
  22. for(int i = 1; i < pet.size(); i++)
  23. {
  24. for(int j = 1; j < pet.size(); j++)
  25. {
  26. pet[i][j] = 1;
  27. print(pet);
  28. cin >> x;
  29. if(x < tot1)
  30. {
  31. pet[i][j] = 1;
  32. tot1--;
  33. }
  34. else pet[i][j] = 0;
  35. }
  36. }
  37. }
  38. int main()
  39. {
  40. string s, t; cin >> s >> t;
  41. int n; cin >> n;
  42. vb temp;
  43. for(int i = 0; i <= n; i++) temp.pb(0);
  44. pet.pb(temp);
  45. for(int i = 1; i <= n; i++)
  46. {
  47. temp.clear();
  48. for(int j = 0; j <= n; j++) temp.pb(0);
  49. pet.pb(temp);
  50. }
  51. bruteforce();
  52. }
Time limit exceeded #stdin #stdout 5s 331904KB
stdin
Standard input is empty
stdout
Standard output is empty