Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- int t;
- using namespace std;
- int main(){
- cin >> t;
- while (t--){
- int n; cin >> n;
- vector <int> a(n + 1);
- for (int i = 1; i < n + 1; ++i) cin >> a[i];
- vector <string> s(n + 2);
- string t(200, 'a'); s[0] = t;
- for (int i = 1; i < n + 2; ++i){
- s[i] = s[i-1];
- if (s[i][a[i-1]] == 'a') s[i][a[i-1]] = 'b';
- else s[i][a[i-1]] = 'a';
- }
- for (int i = 1; i < s.size(); ++i)
- cout << s[i] << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment