結果
問題 |
No.714 回転寿司屋のシミュレート
|
ユーザー |
|
提出日時 | 2019-08-20 23:19:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 1,058 bytes |
コンパイル時間 | 2,192 ms |
コンパイル使用メモリ | 202,652 KB |
最終ジャッジ日時 | 2025-01-07 14:23:27 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin>>n; map<string,int> seats[20]; for (int i=0;i<n;i++) { int t; cin>>t; if (t==0) { int a,b; cin>>a>>b; for (int j=0;j<b;j++) { string s; cin>>s; seats[a-1][s]++; } } else if (t==1) { string s; cin>>s; bool taken=false; for (int j=0;j<20;j++) { auto it=seats[j].find(s); if (it!=seats[j].end()) { cout<<j+1<<endl; seats[j][s]--; if (seats[j][s]==0) { seats[j].erase(it); } taken=true; break; } } if (!taken) cout<<-1<<endl; } else if (t==2) { int bye; cin>>bye; seats[bye-1].clear(); } } return 0; }