結果
| 問題 | No.714 回転寿司屋のシミュレート |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-26 14:17:06 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| + 822µs | |
| コード長 | 1,040 bytes |
| 記録 | |
| コンパイル時間 | 1,206 ms |
| コンパイル使用メモリ | 175,896 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-26 14:17:20 |
| 合計ジャッジ時間 | 3,212 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
const int N = 30;
int q;
map<string, int> mm[N];
int main() {
// freopen("sushi.in", "r", stdin);
// freopen("sushi.out", "w", stdout);
scanf("%d", &q);
while (q--) {
int op;
scanf("%d", &op);
if (op == 0) {
int n, m;
scanf("%d%d", &n, &m);
mm[n].clear();
string s;
while (m--) {
cin >> s;
++mm[n][s];
}
} else if (op == 1) {
string s;
cin >> s;
int ans = -1;
for (int i = 1; i <= 20; ++i) {
auto it = mm[i].find(s);
if (it == mm[i].end()) continue;
ans = i;
if (--((*it).second) == 0) mm[i].erase(it);
break;
}
printf("%d\n", ans);
} else {
int n;
scanf("%d", &n);
mm[n].clear();
}
}
return 0;
}