Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- // #include <string>
- #include <vector>
- // #include <algorithm>
- // #include <utility>
- #define ULL unsigned long long
- #define LL long long
- #define uint unsigned int
- #define uchar unsigned char
- inline void thing(void) {
- uint n;
- scanf("%u", &n);
- std::vector<uchar> x(n), a(n), b(n);
- scanf("%hhu", &x[0]);
- a[0] = 1;
- b[0] = 1;
- uint i = 1;
- while (i < n) {
- scanf("%hhu", &x[i]);
- switch (x[i]) {
- case 1:
- a[i] = 1;
- b[i] = 0;
- i++;
- break;
- case 2:
- a[i] = 1;
- b[i] = 1;
- i++;
- continue;
- case 0:
- a[i] = 0;
- b[i] = 0;
- i++;
- continue;
- }
- break;
- }
- while (i < n) {
- a[i] = 0;
- b[i] = x[i];
- i++;
- }
- for (uint i = 0; i < n; i++) {
- printf("%hhu", a[i]);
- }
- putchar('\n');
- for (uint i = 0; i < n; i++) {
- printf("%hhu", b[i]);
- }
- putchar('\n');
- return;
- }
- int main(void) {
- // uint n;
- // scanf("%u", &n);
- //
- // printf("%u\n", n);
- // std::vector<uint> a(n);
- // for (uint i = 0; i < n; i++) {
- //
- // }
- // for (uint i = 0; i < n; i++) {
- // for (uint j = 0; j < n; j++) {
- //
- // }
- // }
- uint t;
- scanf("%u", &t);
- while (t--) {
- thing();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement