ZOJ-1948-团队队列
本文最后更新于 1837 天前,其中的信息可能已经有所发展或是发生改变。
// ZOJ-1948-团队队列.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include<iostream>
#include<string>
#include<map>
#include<queue>
using namespace std;
const int maxt = 1010;
int main()
{
	int j = 0;
	int n;
	cin >> n;
	while(n!=0)
	{
		j++;
		cout << "Scenario #" << j << endl;
		map<int, int> map1;
		while (n != 0)
		{
			int m,m1;
			cin>>m;
			
			for (int i = 0; i < m; i++)
			{
				cin >> m1;
				map1[m1] = n;
			}
			n--;
		}
		queue<int> q, q2[maxt];
		int m2;
		string str;
		cin >> str;
		while (str != "STOP")
		{
			if (str == "ENQUEUE")
			{
				int m3;
				cin >> m3;
				int t = map1[m3];
				if (q2[t].empty()) q.push(t);
				q2[t].push(m3);
			}
			else
			{
				int t;
				t = q.front();
				cout << q2[t].front()<<endl;
				q2[t].pop();
				if (q2[t].empty())
					q.pop();
			}


			cin >> str;
		}
		cout << endl;




		cin >> n;
	}
	return 0;
}

作者:Yuyy
博客:https://yuyy.info
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇