結果

問題 No.714 回転寿司屋のシミュレート
ユーザー KKT89
提出日時 2020-10-14 19:54:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 882 bytes
コンパイル時間 1,926 ms
コンパイル使用メモリ 197,968 KB
最終ジャッジ日時 2025-01-15 07:16:41
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    multiset<string> st[20];
    int n; cin >> n;
    while(n--){
        int t; cin >> t;
        if(t==0){
            int n,m; cin >> n >> m;
            for(int i=0;i<m;i++){
                string s; cin >> s;
                st[n-1].insert(s);
            }
        }
        else if(t==1){
            string s; cin >> s;
            int res=-1;
            for(int i=0;i<20;i++){
                if(st[i].find(s)!=st[i].end()){
                    res=i+1;
                    auto it=st[i].lower_bound(s);
                    st[i].erase(it);
                    break;
                }
            }
            printf("%d\n",res);
        }
        else{
            int n; cin >> n;
            st[n-1].clear();
        }
    }
}
0