結果
問題 | No.714 回転寿司屋のシミュレート |
ユーザー |
![]() |
提出日時 | 2018-07-13 22:37:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 943 bytes |
コンパイル時間 | 851 ms |
コンパイル使用メモリ | 90,988 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 05:24:45 |
合計ジャッジ時間 | 1,899 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> using namespace std; typedef long long int ll; typedef pair<int, int> P; int main() { int n; cin>>n; map<string, int> mp[20]; for(int i=0; i<n; i++){ int t; cin>>t; if(t==0){ int n0, m; cin>>n0>>m; n0--; for(int j=0; j<m; j++){ string a; cin>>a; if(mp[n0].find(a)==mp[n0].end()){ mp[n0][a]=1; }else{ mp[n0][a]++; } } }else if(t==1){ string b; cin>>b; bool e=0; for(int i=0; i<20; i++){ if(mp[i].find(b)!=mp[i].end()){ mp[i][b]--; if(mp[i][b]==0){ mp[i].erase(b); } cout<<(i+1)<<endl; e=1; break; } } if(e==0){ cout<<-1<<endl; } }else{ int c; cin>>c; c--; mp[c].clear(); } } return 0; }