Advertisement
Soupborsh

1328C

May 21st, 2025
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.30 KB | Source Code | 0 0
  1. #include <cstdio>
  2. // #include <string>
  3. #include <vector>
  4. // #include <algorithm>
  5. // #include <utility>
  6.  
  7. #define ULL unsigned long long
  8. #define LL long long
  9. #define uint unsigned int
  10. #define uchar unsigned char
  11.  
  12. inline void thing(void) {
  13.   uint n;
  14.   scanf("%u", &n);
  15.   std::vector<uchar> x(n), a(n), b(n);
  16.  
  17.   scanf("%hhu", &x[0]);
  18.   a[0] = 1;
  19.   b[0] = 1;
  20.   uint i = 1;
  21.  
  22.   while (i < n) {
  23.     scanf("%hhu", &x[i]);
  24.     switch (x[i]) {
  25.     case 1:
  26.       a[i] = 1;
  27.       b[i] = 0;
  28.       i++;
  29.       break;
  30.     case 2:
  31.       a[i] = 1;
  32.       b[i] = 1;
  33.       i++;
  34.       continue;
  35.     case 0:
  36.       a[i] = 0;
  37.       b[i] = 0;
  38.       i++;
  39.       continue;
  40.     }
  41.     break;
  42.   }
  43.  
  44.   while (i < n) {
  45.     a[i] = 0;
  46.     b[i] = x[i];
  47.     i++;
  48.   }
  49.  
  50.   for (uint i = 0; i < n; i++) {
  51.     printf("%hhu", a[i]);
  52.   }
  53.   putchar('\n');
  54.   for (uint i = 0; i < n; i++) {
  55.     printf("%hhu", b[i]);
  56.   }
  57.   putchar('\n');
  58.  
  59.   return;
  60. }
  61.  
  62. int main(void) {
  63.   // uint n;
  64.   // scanf("%u", &n);
  65.   //
  66.   // printf("%u\n", n);
  67.  
  68.   // std::vector<uint> a(n);
  69.  
  70.   // for (uint i = 0; i < n; i++) {
  71.   //
  72.   // }
  73.  
  74.   //   for (uint i = 0; i < n; i++) {
  75.   //     for (uint j = 0; j < n; j++) {
  76.   //
  77.   //     }
  78.   //   }
  79.  
  80.   uint t;
  81.   scanf("%u", &t);
  82.   while (t--) {
  83.     thing();
  84.   }
  85.  
  86.   return 0;
  87. }
  88.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement