結果
問題 | No.714 回転寿司屋のシミュレート |
ユーザー |
![]() |
提出日時 | 2019-03-28 09:13:33 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 929 bytes |
コンパイル時間 | 14,232 ms |
コンパイル使用メモリ | 231,800 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-12 09:47:24 |
合計ジャッジ時間 | 15,402 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
package mainimport ("bufio""fmt""os""strconv")func main() {sc := bufio.NewScanner(os.Stdin)sc.Split(bufio.ScanWords)sc.Scan()n, _ := strconv.Atoi(sc.Text())type client map[string]intclients := make(map[int]client, 0)for i := 0; i < n; i++ {sc.Scan()d, _ := strconv.Atoi(sc.Text())switch d {case 0: // 入店sc.Scan()n, _ := strconv.Atoi(sc.Text())sc.Scan()m, _ := strconv.Atoi(sc.Text())c := client{}for j := 0; j < m; j++ {sc.Scan()c[sc.Text()]++}clients[n] = ccase 1: // サラキタルsc.Scan()s := sc.Text()catch := falsefor j := 1; j <= 20; j++ {if c, ok := clients[j]; ok {if c[s] > 0 {c[s]--catch = truefmt.Println(j)break}}}if !catch {fmt.Println(-1)}case 2: // 退店sc.Scan()n, _ := strconv.Atoi(sc.Text())delete(clients, n)}}}