結果
問題 | No.714 回転寿司屋のシミュレート |
ユーザー |
![]() |
提出日時 | 2018-08-18 04:12:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 1,289 bytes |
コンパイル時間 | 1,029 ms |
コンパイル使用メモリ | 101,884 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 01:40:39 |
合計ジャッジ時間 | 2,470 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <unordered_map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; vector< vector<string> > V(21); int func( string s ) { for ( int i = 1; i <= 20; i++ ) { for ( int j = 0; j < V[i].size(); j++ ) { if ( V[i][j] == s ) { V[i].erase( V[i].begin()+j ); return i; } } } return -1; } int main() { int N; cin >> N; vector<int> ans; for ( int i = 0; i < N; i++ ) { int a; cin >> a; if ( a == 0 ) { int n,m; cin >> n >> m; for ( int j = 0; j < m; j++ ) { string s; cin >> s; V[n].push_back(s); } } else if ( a == 1 ) { string s; cin >> s; ans.push_back( func(s) ); } else { int c; cin >> c; V[c].clear(); } } for ( int i = 0; i < ans.size(); i++ ) { cout << ans[i] << endl; } return 0; }