結果
問題 | No.714 回転寿司屋のシミュレート |
ユーザー | ikd |
提出日時 | 2018-07-13 22:45:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 878 bytes |
コンパイル時間 | 1,146 ms |
コンパイル使用メモリ | 93,732 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 05:25:36 |
合計ジャッジ時間 | 2,062 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<set> #include<map> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) int main(){ int q; cin>> q; map<string, int> mp; vector<map<int, int>> a(30); while(q--){ int t; cin>> t; if(t==0){ int n, m; cin>> n>> m; rep(_, m){ string s; cin>> s; if(mp.count(s)==0) mp[s]=(int)mp.size(); a[n][mp[s]]++; } }else if(t==1){ string neta; cin>> neta; if(mp.count(neta)==0){ cout<< -1<< endl; continue; } int id=mp[neta]; for(int i=1; i<=20; i++){ if(a[i].count(id)){ cout<< i<< endl; if((--a[i][id])==0) a[i].erase(id); goto heaven; } } cout<< -1<< endl; heaven:; }else{ int c; cin>> c; a[c].clear(); } } return 0; }