結果

問題 No.893 お客様を誘導せよ
ユーザー koi_kotya
提出日時 2019-09-27 21:33:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 848 bytes
コンパイル時間 1,823 ms
コンパイル使用メモリ 177,908 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 20:52:10
合計ジャッジ時間 2,632 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n;
    cin >> n;
    vector<vector<int>> a(n);
    vector<P> b;
    for (int i = 0;i < n;++i) {
        int p;
        cin >> p;
        a[i].resize(p);
        for (int j = 0;j < p;++j) {
            cin >> a[i][j];
            b.push_back(P(j,i));
        }
    }
    sort(b.begin(),b.end());
    for (P& p : b) cout << a[p.second][p.first] << " \n"[p == b.back()];
    return 0;
}
0