【題解】Codeforces 1305A. Kuroni and the Gifts

【題目敘述】http://codeforces.com/contest/1305/problem/A

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int t, n, a, b;
vector <int> va, vb;
 
int main() {
    cin >> t;
    while (t--){
        cin >> n;
        va.clear();
        for (int i = 0; i < n; i++){
            cin >> a;
            va.push_back(a);
        }
        vb.clear();
        for (int i = 0; i < n; i++){
            cin >> b;
            vb.push_back(b);
        }
        sort(va.begin(), va.end());
        for (int i = 0; i < n; i++){
            cout << va[i] << " ";
        }
        cout << "\n";
        sort(vb.begin(), vb.end());
        for (int i = 0; i < n; i++){
            cout << vb[i] << " ";
        }
        cout << "\n";
    }
}
分享本文 Share with friends