crowulll

Untitled

Aug 16th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include<iostream>
  2. #include<vector>
  3. int t;
  4. using namespace std;
  5. int main(){
  6.     cin >> t;
  7.     while (t--){
  8.         int n; cin >> n;
  9.         vector <int> a(n + 1);
  10.         for (int i = 1; i < n + 1; ++i) cin >> a[i];
  11.         vector <string> s(n + 2);
  12.         string t(200, 'a'); s[0] = t;
  13.         for (int i = 1; i < n + 2; ++i){
  14.             s[i] = s[i-1];
  15.             if (s[i][a[i-1]] == 'a') s[i][a[i-1]] = 'b';
  16.                 else s[i][a[i-1]] = 'a';
  17.         }
  18.         for (int i = 1; i < s.size(); ++i)
  19.             cout << s[i] << endl;
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment