結果
問題 | No.893 お客様を誘導せよ |
ユーザー |
![]() |
提出日時 | 2019-10-02 14:46:42 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 76 ms / 2,000 ms |
コード長 | 1,194 bytes |
コンパイル時間 | 948 ms |
コンパイル使用メモリ | 109,548 KB |
実行使用メモリ | 32,820 KB |
最終ジャッジ日時 | 2024-10-03 05:59:47 |
合計ジャッジ時間 | 2,250 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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(); } }