結果
| 問題 |
No.714 回転寿司屋のシミュレート
|
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2020-02-13 20:33:06 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 250 ms / 2,000 ms |
| コード長 | 1,080 bytes |
| コンパイル時間 | 2,025 ms |
| コンパイル使用メモリ | 78,748 KB |
| 実行使用メモリ | 47,384 KB |
| 最終ジャッジ日時 | 2024-10-06 06:22:07 |
| 合計ジャッジ時間 | 9,466 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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();
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);
}
}
htensai