結果
問題 | No.714 回転寿司屋のシミュレート |
ユーザー |
![]() |
提出日時 | 2018-08-08 15:26:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 20 ms / 2,000 ms |
コード長 | 1,791 bytes |
コンパイル時間 | 886 ms |
コンパイル使用メモリ | 85,656 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 18:35:35 |
合計ジャッジ時間 | 2,109 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:46:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 46 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:49:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 49 | scanf("%d", &m); | ~~~~~^~~~~~~~~~ main.cpp:52:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 52 | scanf("%d %d", &t1, &t2); | ~~~~~^~~~~~~~~~~~~~~~~~~ main.cpp:75:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 75 | scanf("%d", &t1); | ~~~~~^~~~~~~~~~~
ソースコード
/*g++ -std=c++11 -Wall -O2 -o main.exe main.cppmain.exe*/#include <cstdio>#include <iostream>#include <string>#include <vector>#include <map>#include <functional>#include <algorithm>#include <complex>#include <numeric>//最大公約数: gcd()//最小公倍数: lcm()#define ll long long intusing namespace std;bool flag1 = false, flag2 = true;template <typename T>void in(T &t){ //標準入力cin >> t;return;}template <typename T>void sortasc(vector<T> &v){ //vectorを昇順にソートsort(v.begin(), v.end(), std::greater<T>());return;}template <typename T>void sortdesc(vector<T> &v){ //vectorを降順にソートsort(v.begin(), v.end(), std::less<T>());return;}int main(){int n, m, t1, t2;string temp;vector< map<string, int> > sushi(21);scanf("%d", &n);for(int i = 0; i < n; i++){scanf("%d", &m);switch(m){case 0:scanf("%d %d", &t1, &t2);for(int j = 0; j < t2; j++){cin >> temp;sushi[t1][temp]++;}break;case 1:cin >> temp;for(int j = 1; j < 21; j++){if(sushi[j][temp] > 0){printf("%d\n", j);sushi[j][temp]--;j = -1;flag1 = true;break;}}if(!flag1) printf("%d\n", -1);flag1 = false;break;case 2:scanf("%d", &t1);sushi[t1].erase(sushi[t1].begin(), sushi[t1].end());break;}}return 0;}