結果

問題 No.714 回転寿司屋のシミュレート
ユーザー focus
提出日時 2018-08-13 12:33:13
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 922 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 77,852 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-24 07:57:22
合計ジャッジ時間 2,207 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
using ll = long long;
using namespace std;
int main(){
    int n;
    string str;
    map<string,int> want[21];
    cin >> n;
    for(int i=0;i<n;i++){
        int flag;
        cin >> flag;
        if(flag==0){
            int place,m;
            cin >> place >> m;
            for(int j=0;j<m;j++){
                cin >> str;
                want[place][str]++;
            }
        }
        else if(flag==1){
            cin >> str;
            bool check=true;
            for(int j=1;j<=20;j++){
                if(want[j][str]>0){
                    want[j][str]--;
                    cout << j << endl;
                    check=false;
                    break;
                }
            }
            if(check)   cout << -1 << endl;
        }
        else{
            int place;
            cin >> place;
            want[place].clear();
        }
    }
    return 0;
}
0