結果
問題 |
No.714 回転寿司屋のシミュレート
|
ユーザー |
![]() |
提出日時 | 2018-07-13 22:37:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 761 bytes |
コンパイル時間 | 1,699 ms |
コンパイル使用メモリ | 176,220 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 05:24:43 |
合計ジャッジ時間 | 2,840 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<string, int> sushi[20]; for (int i = 0; i < n; i++) { int p; cin >> p; if (p == 0) { int n, m; cin >> n >> m; n--; for (int j = 0; j < m; j++) { string s; cin >> s; sushi[n][s]++; } } if (p == 1) { string s; cin >> s; [&] { for (int j = 0; j < 20; j++) { for (auto &p : sushi[j]) { if (p.second <= 0) { continue; } auto &t = p.first; if (s == t) { cout << j + 1 << endl; sushi[j][s]--; return; } } } cout << -1 << endl; }(); } if (p == 2) { int c; cin >> c; c--; sushi[c].clear(); } } return 0; }