結果

問題 No.714 回転寿司屋のシミュレート
ユーザー htensaihtensai
提出日時 2020-02-13 20:33:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 280 ms / 2,000 ms
コード長 1,080 bytes
コンパイル時間 2,765 ms
コンパイル使用メモリ 78,596 KB
実行使用メモリ 47,152 KB
最終ジャッジ日時 2024-04-15 23:20:10
合計ジャッジ時間 11,181 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
41,168 KB
testcase_01 AC 144 ms
41,404 KB
testcase_02 AC 174 ms
41,872 KB
testcase_03 AC 191 ms
41,568 KB
testcase_04 AC 202 ms
42,712 KB
testcase_05 AC 215 ms
43,440 KB
testcase_06 AC 225 ms
45,804 KB
testcase_07 AC 248 ms
46,292 KB
testcase_08 AC 280 ms
47,152 KB
testcase_09 AC 230 ms
45,988 KB
testcase_10 AC 239 ms
45,840 KB
testcase_11 AC 220 ms
43,800 KB
testcase_12 AC 230 ms
44,780 KB
testcase_13 AC 222 ms
43,620 KB
testcase_14 AC 213 ms
44,116 KB
testcase_15 AC 223 ms
44,792 KB
testcase_16 AC 221 ms
43,900 KB
testcase_17 AC 228 ms
45,988 KB
testcase_18 AC 222 ms
44,820 KB
testcase_19 AC 226 ms
44,432 KB
testcase_20 AC 219 ms
44,820 KB
testcase_21 AC 223 ms
44,656 KB
testcase_22 AC 212 ms
44,424 KB
testcase_23 AC 220 ms
44,696 KB
testcase_24 AC 209 ms
44,416 KB
testcase_25 AC 216 ms
44,484 KB
testcase_26 AC 211 ms
44,104 KB
testcase_27 AC 214 ms
44,496 KB
testcase_28 AC 214 ms
43,848 KB
testcase_29 AC 215 ms
44,320 KB
testcase_30 AC 141 ms
41,240 KB
testcase_31 AC 152 ms
41,896 KB
testcase_32 AC 150 ms
41,920 KB
testcase_33 AC 143 ms
41,384 KB
testcase_34 AC 146 ms
41,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		final int SIZE = 20;
		ArrayList<String>[] seats = new ArrayList[SIZE];
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
		    int type = sc.nextInt();
		    if (type == 0) {
		        int idx = sc.nextInt() - 1;
		        int m = sc.nextInt();
		        ArrayList<String> list = new ArrayList<>();
		        for (int j = 0; j < m; j++) {
		            list.add(sc.next());
		        }
		        seats[idx] = list;
		    } else if (type == 1) {
		        int idx = -1;
		        String dish = sc.next();
		        for (int j = 0; j < SIZE && idx < 0; j++) {
		            if (seats[j] == null) {
		                continue;
		            }
		            if (seats[j].remove(dish)) {
		                idx = j + 1;
		                break;
		            }
		        }
		        sb.append(idx).append("\n");
		    } else {
		        seats[sc.nextInt() - 1] = null;
		    }
		}
		System.out.print(sb);
   }
}
0