Advertisement
STANAANDREY

fb hack cup ex

Aug 27th, 2021
1,020
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.20 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define HERE cerr << "HERE" << endl;
  4. using ll = long long;
  5. ///********************
  6.  
  7. void setUp() {
  8.  
  9. }
  10.  
  11. void testCase() {
  12.     int n;
  13.     string in, out;
  14.     cin >> n >> in >> out;
  15.     for (int i = 0; i < n; i++) {
  16.         for (int j = 0; j < n; j++) {
  17.             bool ok = true;
  18.             if (i <= j) {
  19.                 for (int k = i; k < j; k++) {
  20.                     if (out[k] == 'N' || in[k + 1] == 'N') {
  21.                         ok = false;
  22.                     }
  23.                 }
  24.             } else {
  25.                 for (int k = i; k > j; k--) {
  26.                     if (out[k] == 'N' || in[k - 1] == 'N') {
  27.                         ok = false;
  28.                     }
  29.                 }
  30.             }
  31.             cout << (ok ? 'Y' : 'N');
  32.         }
  33.         cout << endl;
  34.     }
  35. }
  36.  
  37. signed main() {
  38.     cin.tie(nullptr), cout.tie(nullptr);
  39.     ios::sync_with_stdio(false);//*/
  40.     freopen("text.in", "r", stdin);
  41.     freopen("text.out", "w", stdout);
  42.     ll t(1);
  43.     cin >> t;
  44.     setUp();
  45.     for (ll tt = 1; tt <= t; tt++) {
  46.         cout << "Case #" << tt << ": ";
  47.         cout << '\n';
  48.         testCase();
  49.     }
  50.     return 0;
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement