結果
問題 | No.714 回転寿司屋のシミュレート |
ユーザー |
![]() |
提出日時 | 2019-09-29 11:05:55 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 347 ms / 2,000 ms |
コード長 | 919 bytes |
コンパイル時間 | 2,000 ms |
コンパイル使用メモリ | 78,068 KB |
実行使用メモリ | 47,728 KB |
最終ジャッジ日時 | 2024-10-03 04:25:24 |
合計ジャッジ時間 | 11,230 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
import java.util.*;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int n = sc.nextInt();ArrayList[] list = new ArrayList[21];for(int i = 0; i < 21; i++) {list[i] = new ArrayList<String>();}for(int i = 0; i < n; i++) {int d = sc.nextInt();if(d == 0) {int seki = sc.nextInt();int m = sc.nextInt();for(int j = 0; j < m; j++) {String a = sc.next();list[seki].add(a);}} else if(d == 1) {String neta = sc.next();int ans = -1;for(int j = 1; j < 21; j++) {if(list[j].contains(neta)) {ans = j;list[j].remove(neta);break;}}System.out.println(ans);} else {int c = sc.nextInt();list[c] = new ArrayList<String>();}}}}