結果

問題 No.893 お客様を誘導せよ
ユーザー KKT89KKT89
提出日時 2019-09-27 21:31:23
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 616 ms
コンパイル使用メモリ 77,252 KB
実行使用メモリ 4,496 KB
最終ジャッジ日時 2023-10-25 01:52:32
合計ジャッジ時間 1,373 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 7 ms
4,348 KB
testcase_03 AC 19 ms
4,348 KB
testcase_04 AC 19 ms
4,348 KB
testcase_05 AC 19 ms
4,348 KB
testcase_06 AC 13 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 40 ms
4,496 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;

int cnt[1001];
int p[1001];
vector<int> a[1001];
vector<int> ans;

int main(){
    int n; cin >> n;
    int sum=0;
    for(int i=0;i<n;i++){
        cin >> p[i];
        sum+=p[i];
        for(int j=0;j<p[i];j++){
            int x; cin >> x;
            a[i].push_back(x);
        }
    }
    while(ans.size()<sum){
        for(int i=0;i<n;i++){
            if(cnt[i]==p[i])continue;
            ans.push_back(a[i][cnt[i]]);
            cnt[i]++;
        }
    }
    for(int i=0;i<sum;i++){
        cout << ans[i] << " ";
    }
    cout << endl;
}
0