結果

問題 No.714 回転寿司屋のシミュレート
ユーザー MatumoMatumo
提出日時 2018-07-13 23:01:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 343 ms / 2,000 ms
コード長 1,013 bytes
コンパイル時間 2,496 ms
コンパイル使用メモリ 77,588 KB
実行使用メモリ 59,404 KB
最終ジャッジ日時 2024-04-17 11:22:51
合計ジャッジ時間 11,159 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
54,188 KB
testcase_01 AC 136 ms
54,028 KB
testcase_02 AC 169 ms
54,660 KB
testcase_03 AC 186 ms
54,468 KB
testcase_04 AC 217 ms
55,164 KB
testcase_05 AC 242 ms
57,484 KB
testcase_06 AC 273 ms
58,276 KB
testcase_07 AC 299 ms
59,140 KB
testcase_08 AC 343 ms
59,404 KB
testcase_09 AC 271 ms
58,580 KB
testcase_10 AC 262 ms
58,236 KB
testcase_11 AC 264 ms
57,744 KB
testcase_12 AC 264 ms
57,796 KB
testcase_13 AC 264 ms
57,800 KB
testcase_14 AC 260 ms
57,544 KB
testcase_15 AC 256 ms
57,868 KB
testcase_16 AC 262 ms
57,556 KB
testcase_17 AC 259 ms
58,496 KB
testcase_18 AC 268 ms
57,764 KB
testcase_19 AC 260 ms
57,748 KB
testcase_20 AC 261 ms
57,452 KB
testcase_21 AC 262 ms
57,856 KB
testcase_22 AC 237 ms
57,740 KB
testcase_23 AC 238 ms
57,612 KB
testcase_24 AC 241 ms
57,728 KB
testcase_25 AC 234 ms
57,124 KB
testcase_26 AC 238 ms
57,364 KB
testcase_27 AC 235 ms
57,764 KB
testcase_28 AC 235 ms
57,148 KB
testcase_29 AC 240 ms
57,616 KB
testcase_30 AC 136 ms
54,116 KB
testcase_31 AC 145 ms
54,380 KB
testcase_32 AC 144 ms
54,364 KB
testcase_33 AC 119 ms
54,288 KB
testcase_34 AC 141 ms
54,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	static String[] sushi = new String[53];
	static int index = 0;

	static int[][] s = new int[21][53];

	public static void main(String[] args) {

		int n = sc.nextInt();

		all:for(int i = 0; i < n; i++) {
			int type = sc.nextInt();

			if(type == 0) {
				int id = sc.nextInt();
				int m = sc.nextInt();
				for(int j = 0; j < m; j++) {
					int sid = sushi2id(sc.next());
					s[id][sid]++;
				}
			}

			if(type == 1) {
				String name = sc.next();
				int b = sushi2id(name);
				for(int j = 1; j < s.length; j++) {
					if(s[j][b] != 0) {
						s[j][b]--;
						System.out.println(j);
						continue all;
					}
				}
				System.out.println("-1");
			}

			if(type == 2) {
				int id = sc.nextInt();
				s[id] = new int[53];
			}
		}
    }

	static int sushi2id(String str) {
		for(int i = 0; i < index; i++) {
			if(sushi[i].equals(str)) return i;
		}
		sushi[index] = str;
		index++;
		return index - 1;
	}
}
0