結果

問題 No.893 お客様を誘導せよ
ユーザー tomomo2b2tomomo2b2
提出日時 2019-10-02 14:46:42
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 1,194 bytes
コンパイル時間 841 ms
コンパイル使用メモリ 113,208 KB
実行使用メモリ 32,824 KB
最終ジャッジ日時 2024-04-14 08:56:07
合計ジャッジ時間 2,272 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
27,344 KB
testcase_01 AC 30 ms
25,448 KB
testcase_02 AC 39 ms
25,160 KB
testcase_03 AC 61 ms
32,696 KB
testcase_04 AC 62 ms
32,824 KB
testcase_05 AC 60 ms
30,392 KB
testcase_06 AC 49 ms
27,564 KB
testcase_07 AC 30 ms
25,452 KB
testcase_08 AC 89 ms
32,720 KB
testcase_09 AC 32 ms
27,236 KB
testcase_10 AC 30 ms
25,136 KB
testcase_11 AC 32 ms
25,136 KB
testcase_12 AC 33 ms
25,448 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

class MyClass
{
    public static void Solve()
    {
        var N = int.Parse(Console.ReadLine());
        var list = new List<int>[N];
        var ans = new List<int>();
        for (int i = 0; i < N; i++)
        {
            list[i] = new List<int>();
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for (int j = 0; j < A[0]; j++)
            {
                list[i].Add(A[j + 1]);
            }
        }
        while (true)
        {
            var b = false;
            for (int i = 0; i < N; i++)
            {
                if (list[i].Count > 0)
                {
                    b = true;
                    ans.Add(list[i][0]);
                    list[i].RemoveAt(0);
                }
            }
            if (!b)
            {
                break;
            }
        }
        Console.WriteLine(string.Join(" ", ans));

    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}
0