結果
問題 | No.893 お客様を誘導せよ |
ユーザー | iwa_choco_168 |
提出日時 | 2019-12-08 20:10:34 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 493 ms / 2,000 ms |
コード長 | 926 bytes |
コンパイル時間 | 2,230 ms |
コンパイル使用メモリ | 76,500 KB |
実行使用メモリ | 62,940 KB |
最終ジャッジ日時 | 2023-08-30 03:59:17 |
合計ジャッジ時間 | 6,397 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 119 ms
55,468 KB |
testcase_01 | AC | 119 ms
56,172 KB |
testcase_02 | AC | 243 ms
59,948 KB |
testcase_03 | AC | 379 ms
60,832 KB |
testcase_04 | AC | 378 ms
62,412 KB |
testcase_05 | AC | 367 ms
60,812 KB |
testcase_06 | AC | 318 ms
60,364 KB |
testcase_07 | AC | 118 ms
55,568 KB |
testcase_08 | AC | 493 ms
62,940 KB |
testcase_09 | AC | 177 ms
56,164 KB |
testcase_10 | AC | 128 ms
55,632 KB |
testcase_11 | AC | 180 ms
54,724 KB |
testcase_12 | AC | 189 ms
57,476 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); ArrayDeque<Integer>[] queue = new ArrayDeque[n]; for(int i = 0; i < n; i++) { queue[i] = new ArrayDeque<Integer>(); int rep = Integer.parseInt(sc.next()); for(int j = 0; j < rep; j++) { queue[i].add(Integer.parseInt(sc.next())); } } Queue<Integer> ans = new ArrayDeque<>(); boolean flag; while(true) { flag = true; for(int i = 0; i < n; i++) { if(queue[i].size() == 0) continue; ans.add(queue[i].poll()); flag = false; } if(flag) break; } StringBuilder sb = new StringBuilder(); int rep = ans.size(); for(int i = 0; i < rep; i++) { sb.append(ans.poll()); sb.append(" "); } System.out.println(sb.toString().trim()); } }