最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

CF 427A - Police Recruits

2023-07-26 12:20 作者:您是打尖兒還是住店呢  | 我要投稿



The police department of your city has just started its journey. Initially, they don’t have any manpower. So, they started hiring new recruits in groups.


Meanwhile, crimes keeps occurring within the city. One member of the police force can investigate only one crime during his/her lifetime.


If there is no police officer free (isn't busy with crime) during the occurrence of a crime, it will go untreated.


Given the chronological order of crime occurrences and recruit hirings, find the number of crimes which will go untreated.


Input

The first line of input will contain an integer n (1?≤?n?≤?105), the number of events. The next line will contain n space-separated integers.


If the integer is -1 then it means a crime has occurred. Otherwise, the integer will be positive, the number of officers recruited together at that time. No more than 10 officers will be recruited at a time.


Output

Print a single integer, the number of crimes which will go untreated.

-----------------------------------------------------

你所在城市的警察局剛剛開(kāi)始其旅程。 最初,他們沒(méi)有任何人力。 于是,他們開(kāi)始分組招募新人。


與此同時(shí),城市內(nèi)犯罪不斷發(fā)生。 一名警察在其一生中只能調(diào)查一項(xiàng)犯罪行為。


如果犯罪發(fā)生期間沒(méi)有警察空閑(不忙于犯罪),犯罪就會(huì)得不到處理。


根據(jù)犯罪發(fā)生和新兵招聘的時(shí)間順序,找出未得到處理的犯罪數(shù)量。


輸入

輸入的第一行將包含一個(gè)整數(shù) n (1?≤?n?≤?105),即事件數(shù)。 下一行將包含 n 個(gè)空格分隔的整數(shù)。


如果整數(shù)為-1,則表示發(fā)生了犯罪。 否則,該整數(shù)將為正數(shù),即當(dāng)時(shí)一起招募的軍官人數(shù)。 一次招募的軍官不超過(guò)10人。


輸出

打印一個(gè)整數(shù),即未得到處理的犯罪數(shù)量。

----------------------------------------------

直接模擬即可;


CF 427A - Police Recruits的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
昌江| 平潭县| 大安市| 宁津县| 祁东县| 邢台市| 太仓市| 沙河市| 平陆县| 泰来县| 凤城市| 酒泉市| 会昌县| 藁城市| 深圳市| 南丹县| 临武县| 汤原县| 甘德县| 星子县| 原平市| 威远县| 北京市| 北碚区| 乌拉特后旗| 阳东县| 微博| 于都县| 武鸣县| 平昌县| 临潭县| 石嘴山市| 淮安市| 来安县| 沂源县| 仙游县| 阜平县| 昭通市| 万年县| 新乡市| 广昌县|