-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path1328C.cpp
82 lines (74 loc) · 2 KB
/
1328C.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Author : Mars_Coder
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
using namespace std;
#define ln "\n" // no flush, oppos of endl
#define _flush endl
#define stop_sync ios::sync_with_stdio(false) // not to use c-style io
#define untie_ios cin.tie(nullptr) // no flush
#define lli long long int
#define vi vector<int>
#define vii vector<lli>
#define vch vector<char>
#define double long double
#define vss vector<string>
#define pq priority_queue // high prec.
#define pqq(T) priority_queue<T, vector<T>, greater<T>>
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define Fi(p) get<0>(p)
#define Sc(p) get<1>(p)
#define sz(x) int ((x).size())
#define all(x) (x).begin(), (x).end()
#define bin_sc(a, x) binary_search(all(a), x)
#define lbd(a, x) lower_bound(all(a), x) // an iter.
#define ubd(a, x) upper_bound(all(a), x) // an iter.
#define eq_seg(a, x) equal_range(all(a), x) // a pair of lb, ub
#define FIXED(x) cout << fixed << setprecision(x)
const double PI = acos(-1.0L);
int main(void){
stop_sync;
untie_ios;
#ifndef ONLINE_JUDGE
//freopen("generator.txt", "r", stdin);
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("error.txt", "w", stderr);
#endif
int t;
cin >> t;
while(t--){
int n;
cin >> n;
string s;
cin >> s;
string a, b;
for(int i = 0; i < n; ++i){
if(s[i] == '0'){
a.pb('0');
b.pb('0');
}else if(s[i] == '2'){
a.pb('1');
b.pb('1');
}else{
a.pb('1');
b.pb('0');
for(int j = i + 1; j < n; ++j){
a.pb('0');
b.pb(s[j]);
}
break;
}
}
cout << a << ln << b << ln;
}
return 0;
}
/*
some familiar issues:
!----> [look at global variables and their values]
!----> [llabs() for long long int type]
!----> [look at input size]
!----> [No sync with puts fn]
*/