結果

問題 No.714 回転寿司屋のシミュレート
ユーザー beet
提出日時 2018-07-26 13:23:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 721 bytes
コンパイル時間 1,604 ms
コンパイル使用メモリ 172,440 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 19:05:39
合計ジャッジ時間 3,050 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<vector<string> > s(100);
  for(Int u=0;u<n;u++){
    Int t;
    cin>>t;
    if(t==0){
      Int x,y;
      cin>>x>>y;
      s[x].resize(y);
      for(Int i=0;i<y;i++) cin>>s[x][i];
    }
    if(t==1){
      string b;
      cin>>b;
      Int flg=0;
      for(Int i=0;i<100;i++){
	for(Int j=0;j<(Int)s[i].size();j++){
	  if(s[i][j]==b){
	    cout<<i<<endl;
	    swap(s[i][j],s[i].back());
	    s[i].pop_back();
	    flg=1;
	    break;
	  }	  
	}
	if(flg) break;
      }
      if(!flg) cout<<-1<<endl;
    }
    if(t==2){
      Int c;
      cin>>c;
      s[c].clear();
    }
  }
  return 0;
}
0