fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. bool test() {
  5. int c[2][4] = {}, d[2][7] = {};
  6. for (int i = 0; i < 4; ++i) {
  7. for (int j = 0; j < 4; ++j) {
  8. char x;
  9. cin >> x;
  10. if (x != 'x') continue;
  11. ++c[0][i], ++c[1][j];
  12. ++d[0][i + j], ++d[1][i + (3 - j)];
  13. }
  14. }
  15. for (int i = 0; i < 4; ++i)
  16. if (c[0][i] > 1 || c[1][i] > 1)
  17. return true;
  18. for (int i = 0; i < 7; ++i)
  19. if (d[0][i] > 1 || d[1][i] > 1)
  20. return true;
  21. return false;
  22. }
  23.  
  24. int main() {
  25. int N;
  26. cin >> N;
  27. cout << boolalpha;
  28. for (int i = 0; i < N; ++i)
  29. cout << "Test #" << i + 1 << ": " << test() << endl;
  30. }
Success #stdin #stdout 0s 3300KB
stdin
6

....
.x..
..x.
....

....
..x.
.x..
....

....
.x..
.x..
....

....
.xx.
....
....

....
....
....
....

.x..
...x
x...
..x.
stdout
Test #1: true
Test #2: true
Test #3: true
Test #4: true
Test #5: false
Test #6: false