結果

問題 No.714 回転寿司屋のシミュレート
ユーザー kotatsugamekotatsugame
提出日時 2018-07-17 06:29:55
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 488 bytes
コンパイル時間 847 ms
コンパイル使用メモリ 77,712 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-24 01:52:11
合計ジャッジ時間 2,193 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<map>
using namespace std;
map<string,int>M[21];
int n;
main()
{
	cin>>n;
	for(;n--;)
	{
		int d;cin>>d;
		if(d==0)
		{
			int l,k;cin>>l>>k;
			for(;k--;)
			{
				string s;cin>>s;
				M[l][s]++;
			}
		}
		else if(d==1)
		{
			string s;cin>>s;
			bool f=1;
			for(int i=1;i<=20;i++)
			{
				if(M[i][s]>0)
				{
					M[i][s]--;
					f=0;
					cout<<i<<endl;
					break;
				}
			}
			if(f)cout<<-1<<endl;
		}
		else
		{
			int i;cin>>i;M[i].clear();
		}
	}
}
0