亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

PAT甲級1014

2019-11-10 17:00:18
字體:
來源:轉載
供稿:網友

1014. Waiting in Line (30)

時間限制400 ms內存限制65536 kB代碼長度限制16000 B判題程序Standard作者CHEN, Yue

Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are:

The space inside the yellow line in front of each window is enough to contain a line with M customers. Hence when all the N lines are full, all the customers after (and including) the (NM+1)st one will have to wait in a line behind the yellow line.Each customer will choose the shortest line to wait in when crossing the yellow line. If there are two or more lines with the same length, the customer will always choose the window with the smallest number.Customer[i] will take T[i] minutes to have his/her transaction PRocessed.The first N customers are assumed to be served at 8:00am.

Now given the processing time of each customer, you are supposed to tell the exact time at which a customer has his/her business done.

For example, suppose that a bank has 2 windows and each window may have 2 custmers waiting inside the yellow line. There are 5 customers waiting with transactions taking 1, 2, 6, 4 and 3 minutes, respectively. At 08:00 in the morning, customer1 is served at window1 while customer2 is served at window2. Customer3 will wait in front of window1 and customer4 will wait in front of window2. Customer5 will wait behind the yellow line.

At 08:01, customer1 is done and customer5 enters the line in front of window1 since that line seems shorter now. Customer2 will leave at 08:02, customer4 at 08:06, customer3 at 08:07, and finally customer5 at 08:10.

Input

Each input file contains one test case. Each case starts with a line containing 4 positive integers: N (<=20, number of windows), M (<=10, the maximum capacity of each line inside the yellow line), K (<=1000, number of customers), and Q (<=1000, number of customer queries).

The next line contains K positive integers, which are the processing time of the K customers.

The last line contains Q positive integers, which represent the customers who are asking about the time they can have their transactions done. The customers are numbered from 1 to K.

Output

For each of the Q customers, print in one line the time at which his/her transaction is finished, in the format HH:MM where HH is in [08, 17] and MM is in [00, 59]. Note that since the bank is closed everyday after 17:00, for those customers who cannot be served before 17:00, you must output "Sorry" instead.

Sample Input
2 2 7 51 2 6 4 3 534 23 4 5 6 7Sample Output
08:0708:0608:1017:00Sorry
#include<cstdio>#include<queue>#include<algorithm>using namespace std;const int maxn = 22;const int maxk = 1000 + 10;int N, M, K, Q;int nowTime = 0;int CloseTime = (17 - 8) * 60;struct customer{	int id;	int processtime;	int donetime;	customer():donetime(-1){}}customers[maxk];queue<customer> line[maxn],behindQueue;int lastTime[maxn] = { 0 };int main(){	scanf("%d%d%d%d", &N, &M, &K, &Q);//注意N、M的意義	int capacity = N*M;	for (int i = 1; i <= K; i++)	{		scanf("%d", &customers[i].processtime);		customers[i].id = i;		if (i <= capacity)		{			line[(i - 1) % N + 1].push(customers[i]);		}		else			behindQueue.push(customers[i]);//排隊	}	int countC = K;	while (nowTime < CloseTime&&countC)//模擬時間流動,每分鐘檢查一次有不有完成的	{		nowTime++;		for (int i = 1; i <= N; i++)		{			if (!line[i].empty())			{				int donetime = line[i].front().processtime + lastTime[i];				int id = line[i].front().id;				if ((donetime>CloseTime||donetime == nowTime)&&lastTime[i]<nowTime)				{					customers[id].donetime = donetime;					lastTime[i] = donetime;					line[i].pop();					countC--;					if (behindQueue.size())					{						line[i].push(behindQueue.front());						behindQueue.pop();					}				}				else if (lastTime[i] >= nowTime)				{					line[i].pop();					countC--;					if (behindQueue.size())					{						line[i].push(behindQueue.front());						behindQueue.pop();					}				}			}		}	}	int query;	for (int i = 0; i < Q; i++)	{		scanf("%d", &query);		if (customers[query].donetime != -1)			printf("%02d:%02d/n", 8 + customers[query].donetime / 60, customers[query].donetime % 60);		else			printf("Sorry/n");	}}
上一篇:BZOJ 2655 calc

下一篇:文章標題

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
91久久精品久久国产性色也91| 久久777国产线看观看精品| 最近2019中文免费高清视频观看www99| 国产精品视频xxx| 精品久久久一区| 在线观看日韩专区| 亚洲人成电影在线观看天堂色| www.欧美三级电影.com| 成人一区二区电影| 欧美裸体男粗大视频在线观看| 91精品视频一区| 成人a在线观看| 97在线视频免费观看| 日韩中文第一页| 久久香蕉国产线看观看网| 日韩成人中文字幕在线观看| 欧美成人亚洲成人日韩成人| 国产香蕉一区二区三区在线视频| 精品一区二区三区四区| 97成人精品区在线播放| 国产视频亚洲视频| 欧美极品美女电影一区| 51精品国产黑色丝袜高跟鞋| 成人网欧美在线视频| 欧美精品国产精品日韩精品| 久久免费福利视频| 久久久久久91| 国产激情999| 懂色av影视一区二区三区| 中文字幕国产日韩| 久久成年人视频| 亚洲一区二区在线| 久久手机精品视频| 亚洲伊人成综合成人网| 亚洲va欧美va国产综合久久| 国产精品美腿一区在线看| 亚洲第一男人av| 国产精品 欧美在线| 久久免费视频在线观看| 国产97人人超碰caoprom| 国产精品国产福利国产秒拍| 亚洲精品成人久久久| 日韩精品视频中文在线观看| 久久琪琪电影院| 九九久久国产精品| 亚洲精品wwwww| 亚洲电影免费观看高清完整版在线观看| 久久伊人色综合| 国产成人aa精品一区在线播放| 日韩一区二区三区xxxx| 综合欧美国产视频二区| 亚洲free性xxxx护士白浆| 奇米影视亚洲狠狠色| 国产精品视频自拍| 亚洲欧美精品中文字幕在线| 欧美性xxxxxxx| 欧美理论片在线观看| 亚洲va码欧洲m码| 欧美丝袜一区二区| 亚洲一区二区三区在线免费观看| 亚洲va欧美va国产综合久久| 午夜剧场成人观在线视频免费观看| 欧美午夜无遮挡| 欧美国产精品va在线观看| 欧美精品激情在线观看| 久久免费视频在线观看| 亚洲黄色成人网| 午夜精品一区二区三区在线视| 神马久久久久久| 欧美性开放视频| 欧美体内谢she精2性欧美| 久久久之久亚州精品露出| 91高清视频在线免费观看| 亚洲欧美日本伦理| 久久九九免费视频| 久久亚洲综合国产精品99麻豆精品福利| 国产a级全部精品| 欧美午夜片欧美片在线观看| 一二美女精品欧洲| 自拍偷拍亚洲一区| 国语自产精品视频在线看抢先版图片| 亚洲片av在线| 国内外成人免费激情在线视频网站| 久久综合国产精品台湾中文娱乐网| 成人黄色影片在线| 92版电视剧仙鹤神针在线观看| 国产精品99久久99久久久二8| 久久久午夜视频| zzijzzij亚洲日本成熟少妇| 国产精品18久久久久久麻辣| 亚洲国产精品va在线看黑人| 日韩av在线电影网| 91久久精品国产91性色| 最近中文字幕2019免费| 精品久久久久久亚洲精品| 久久久爽爽爽美女图片| 欧美成人免费一级人片100| 国产精品夜色7777狼人| 亚洲大胆人体视频| 久久在精品线影院精品国产| 欧美电影免费观看高清| 欧美色另类天堂2015| 久久久免费av| 国产精品亚洲美女av网站| 在线精品91av| 久久乐国产精品| 国产精品扒开腿做爽爽爽的视频| 欧美成人午夜免费视在线看片| 国产精品v片在线观看不卡| 久久国产精品偷| 亚洲a成v人在线观看| 欧美夫妻性生活视频| 国产日韩欧美一二三区| 欧美高清在线观看| 亚洲福利视频二区| 久久综合久久88| 国产一级揄自揄精品视频| 一区二区欧美在线| 日韩中文字幕第一页| 欧美日韩亚洲国产一区| 欧美午夜宅男影院在线观看| 韩国精品美女www爽爽爽视频| 欧美乱大交做爰xxxⅹ性3| 中文字幕亚洲无线码在线一区| 亚洲精品98久久久久久中文字幕| 亚洲丁香婷深爱综合| 国产在线视频欧美| 日韩精品免费在线观看| 国产精品99导航| 91国内精品久久| 午夜精品一区二区三区在线| 日韩精品免费在线视频| 久久99久国产精品黄毛片入口| 欧美一区二区视频97| 国产精品天天狠天天看| 国产精品欧美风情| 日韩精品免费在线观看| 中文字幕亚洲国产| 另类专区欧美制服同性| 国产精品吊钟奶在线| 一本一道久久a久久精品逆3p| 色中色综合影院手机版在线观看| 欧美黑人国产人伦爽爽爽| 午夜精品久久久久久久久久久久久| 国产va免费精品高清在线| 日韩视频中文字幕| 96精品视频在线| 91经典在线视频| 亚洲综合国产精品| 欧美专区国产专区| 久久久久久噜噜噜久久久精品| 欧美午夜女人视频在线| 国产香蕉精品视频一区二区三区| 欧美大成色www永久网站婷| 亚洲bt天天射| www.亚洲成人| 亚洲天堂网站在线观看视频| 中文字幕久热精品视频在线| 亚洲日本中文字幕| 中文字幕久久久| 一色桃子一区二区| 九九久久综合网站| 日日狠狠久久偷偷四色综合免费| 欧美日韩激情视频|