#37389: C++詳解


terrytseng98@gmail.com (曾宥誠)


#include <bits/stdc++.h>
using namespace std;

char ans[25][25];

int main(){


    ios_base::sync_with_stdio(0);     //加速cin
    cin.tie(0);                                   //加速cin

    int k, q, r;
    cin >> k >> q >> r;
    cin >> ans[0];

    for(int i = 0; i < q; i++){
        for(int j = 0; j < k; j++){
            int x; cin >> x;
            ans[i+1][x-1] = ans[i][j];
        }
    }

    for(int i = 0; i < r; i++){
        for(int j = 1; j <= q; j++){
            cout << ans[j][i];
        }
        cout << '\n';
    }

    return 0;
}