結果
問題 | No.714 回転寿司屋のシミュレート |
ユーザー | fine |
提出日時 | 2018-07-13 22:34:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 1,217 bytes |
コンパイル時間 | 1,726 ms |
コンパイル使用メモリ | 173,200 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-09 05:24:12 |
合計ジャッジ時間 | 2,920 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<string> v[20]; vector<int> used[20]; for (int i = 0; i < n; i++) { int d; cin >> d; if (d == 0) { int n, m; cin >> n >> m; n--; v[n].resize(m); used[n].assign(m, false); for (int j = 0; j < m; j++) { cin >> v[n][j]; } } else if (d == 1) { string b; cin >> b; int ans = -1; for (int j = 0; j < 20; j++) { for (int k = 0; k < (int)v[j].size(); k++) { if (used[j][k]) continue; if (v[j][k] == b) { used[j][k] = true; ans = j + 1; break; } } if (ans != -1) break; } cout << ans << endl; } else if (d == 2) { int c; cin >> c; c--; v[c].clear(); used[c].clear(); } } return 0; }