結果
問題 | No.714 回転寿司屋のシミュレート |
ユーザー |
|
提出日時 | 2018-07-13 23:01:46 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 336 ms / 2,000 ms |
コード長 | 1,013 bytes |
コンパイル時間 | 2,262 ms |
コンパイル使用メモリ | 78,244 KB |
実行使用メモリ | 47,412 KB |
最終ジャッジ日時 | 2024-10-09 05:28:56 |
合計ジャッジ時間 | 11,241 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
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;}}