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

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

PAT甲級1014

2019-11-10 19:08:46
字體:
來源:轉載
供稿:網友

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");	}}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
九九精品在线播放| 在线视频欧美日韩精品| 欧美在线精品免播放器视频| 久久久亚洲欧洲日产国码aⅴ| 久久天天躁夜夜躁狠狠躁2022| 日韩av影片在线观看| 精品国产91久久久久久| 亚洲日本欧美日韩高观看| 日韩大陆毛片av| 日韩欧美中文免费| 亚洲品质视频自拍网| 2018国产精品视频| 91香蕉亚洲精品| 日韩视频永久免费观看| 黑人极品videos精品欧美裸| 国产不卡av在线免费观看| 欧美极品第一页| 亚洲欧美成人在线| 亚洲色图美腿丝袜| 国产精品青青在线观看爽香蕉| 欧美日韩免费在线观看| 国产自摸综合网| 国产成人a亚洲精品| 国产日韩中文字幕| 亚洲欧美日韩在线一区| 欧美日韩国产在线看| 日本国产精品视频| 国产欧美日韩免费看aⅴ视频| 日韩亚洲成人av在线| 欧美日韩免费在线| 国产视频精品久久久| 91亚洲精品久久久久久久久久久久| 亚洲欧洲日本专区| 性色av一区二区三区红粉影视| 国产精品视频网站| 91手机视频在线观看| 亚洲人成在线观| 97视频在线观看播放| 国产精品三级网站| 国产日韩欧美在线视频观看| 欧美精品一区在线播放| 欧美国产日韩中文字幕在线| 69av视频在线播放| 98精品国产高清在线xxxx天堂| 亚洲精品视频免费在线观看| 在线亚洲男人天堂| 久久久国产视频| 国产免费一区二区三区香蕉精| 久久夜色精品国产亚洲aⅴ| 啊v视频在线一区二区三区| 久久久久国产视频| 中文国产成人精品久久一| 欧美激情亚洲另类| 国产69精品久久久久99| 亚洲精品久久久久久久久| 91精品久久久久久久久久| 欧美与欧洲交xxxx免费观看| **欧美日韩vr在线| 欧美在线观看视频| 成人在线视频网站| 久久国产精品偷| 91成人国产在线观看| 亚洲人成电影网站色xx| 欧美日韩福利在线观看| 亚洲欧美制服另类日韩| 国产精品视频999| 国产乱肥老妇国产一区二| 欧美黑人视频一区| 日韩最新免费不卡| 91精品视频在线免费观看| 国内精品久久久久久久久| 狠狠色狠色综合曰曰| 亚洲精品久久久久中文字幕二区| 亚洲爱爱爱爱爱| 久久久久久尹人网香蕉| 国产视频精品一区二区三区| 成人黄色在线免费| 一区二区三区回区在观看免费视频| 国产成人精品久久久| 日韩精品极品视频免费观看| 午夜精品一区二区三区在线视| 亚洲精品久久久久中文字幕二区| 日韩在线观看网址| 久久人人爽人人| 日韩成人在线免费观看| 亚洲国产成人精品久久| 国产精品一香蕉国产线看观看| 亚洲图片欧美日产| 91免费看国产| 欧美精品少妇videofree| 国内偷自视频区视频综合| 亚洲欧美一区二区三区情侣bbw| 亚洲日韩中文字幕在线播放| 欧美成年人在线观看| 狠狠躁夜夜躁人人爽天天天天97| 日韩欧美国产成人| 日本国产欧美一区二区三区| 亚洲成色777777在线观看影院| 国产日韩欧美中文| 欧美大胆a视频| 亚洲一区精品电影| 欧美亚洲在线播放| 日韩精品在线观看一区| 亚洲一区二区日本| 清纯唯美日韩制服另类| 亚洲一品av免费观看| 国产精品麻豆va在线播放| 国模极品一区二区三区| 26uuu另类亚洲欧美日本一| 国产精品久久久久久超碰| 欧美色欧美亚洲高清在线视频| 精品久久久久久久久久ntr影视| 亚洲精品国产电影| 成人国产在线激情| 亚洲高清在线观看| 国产91精品久久久久| 日韩亚洲成人av在线| 国产欧美在线观看| 久久久久日韩精品久久久男男| 亚洲一区久久久| 日韩欧美第一页| 日韩成人性视频| 欧美亚洲免费电影| 三级精品视频久久久久| 91精品国产自产在线老师啪| 精品国产一区二区三区久久久狼| 久久精品视频99| 日韩精品中文字幕视频在线| 国产91对白在线播放| 欧美最顶级丰满的aⅴ艳星| 欧美视频在线观看免费| xvideos国产精品| 成人在线精品视频| 国产成人精品视频| 国产精品女人久久久久久| 欧美国产日韩精品| 黑人狂躁日本妞一区二区三区| 欧美精品videosex性欧美| 国产成人啪精品视频免费网| 国产成人精品av在线| 欧美视频13p| 国产91ⅴ在线精品免费观看| 日韩的一区二区| 亚洲国产精彩中文乱码av在线播放| 亚洲图片欧美日产| 亚洲精品在线91| 国产精品久久久久久久久久久久久久| 黄色成人在线播放| 国产视频久久久久| 国模私拍一区二区三区| 欧美性极品xxxx娇小| 日韩有码在线观看| 国产精品成人免费视频| 亚洲精品国产精品国自产观看浪潮| 欧美精品久久久久久久免费观看| 日韩欧美在线国产| 日韩av网址在线观看| 在线观看国产精品日韩av| 日韩黄色在线免费观看| 久久视频在线免费观看| 91精品国产电影| 国产香蕉精品视频一区二区三区| 欧美三级免费观看| 亚洲激情久久久|