結果

問題 No.714 回転寿司屋のシミュレート
ユーザー YamaKasaYamaKasa
提出日時 2018-07-14 01:31:18
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,359 bytes
コンパイル時間 2,852 ms
コンパイル使用メモリ 82,540 KB
実行使用メモリ 59,624 KB
最終ジャッジ日時 2024-04-17 11:49:15
合計ジャッジ時間 11,464 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		Map<Integer, ArrayList<String>> map = new TreeMap<Integer, ArrayList<String>>();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < N; i++) {
			int t = scan.nextInt();
			if(t == 0) {
				int n = scan.nextInt();
				int m = scan.nextInt();
				ArrayList<String> list = new ArrayList<String>();
				for(int j = 0; j < m; j++) {
					String s = scan.next();
					list.add(s);
				}
				map.put(n, list);
			}else if(t == 1) {
				String s = scan.next();
				boolean flag = false;
				for(int j : map.keySet()) {
					ArrayList<String> list = map.get(j);
					for(int k = 0; k < list.size(); k++) {
						if(s.equals(list.get(k))) {
							list.remove(k);
							map.put(j, list);
							sb.append(j).append("\n");
							flag = true;
							break;
						}
					}
					if(flag) {
						break;
					}
				}
				if(!flag) {
					sb.append(-1).append("\n");
				}
			}else {
				int n = scan.nextInt();
				map.remove(n);
			}
		}
		scan.close();
		System.out.println(sb.toString());
	}
	static void disp(ArrayList<String> list) {
		for(String s : list) {
			System.out.print(s + " ");
		}
		System.out.println();
	}
}
0