結果
問題 | No.714 回転寿司屋のシミュレート |
ユーザー |
![]() |
提出日時 | 2019-04-25 17:46:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 1,309 bytes |
コンパイル時間 | 1,754 ms |
コンパイル使用メモリ | 175,008 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-20 20:45:29 |
合計ジャッジ時間 | 2,967 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS#include "bits/stdc++.h"using namespace std;#define rep(i, n) for(int i=0; i<(n); ++i)#define FOR(i, m, n) for(int i=(m); i<(n); ++i)#define sz(x) ((int)(x).size())#define all(x) (x).begin(),(x).end()#define mp make_pair#define pb push_back#define Cout(x) cout << (x) << endl#define dump(x) cerr << #x << " = " << (x) << endl;typedef long long LL;typedef vector<int> VI;typedef vector<long long> VL;typedef vector<string> VS;typedef vector<vector<int>> VVI;typedef pair<int, int> PII;const int inf = (int)1e9;const long long mod = (long long)1e9 + 7;const double pi = acos(-1.0);int main() {vector<pair<bool, vector<string>>> t(20);rep(i, 20)t[i].first = false;int n; cin >> n;rep(i, n) {int q; cin >> q;if (q == 0) {//setint n, m; cin >> n >> m; n--;t[n].first = true;rep(i, m) {string name; cin >> name;t[n].second.pb(name);}}else if (q == 1) {//susistring s; cin >> s;int ans = -1;rep(i, 20) {if (t[i].first) {rep(j, sz(t[i].second))if (ans == -1 && t[i].second[j] == s) {ans = i + 1;t[i].second.erase(t[i].second.begin() + j);}}}Cout(ans);}else if (q == 2) {//deleteint c; cin >> c; c--;t[c].second.clear(); t[c].first = false;}}}