五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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ó)家法律
玉环县| 井研县| 长丰县| 双鸭山市| 西乡县| 宁强县| 郸城县| 南投市| 神池县| 张家界市| 巩义市| 齐齐哈尔市| 衡水市| 米泉市| 长顺县| 德阳市| 铜鼓县| 易门县| 红安县| 巴彦县| 全椒县| 五莲县| 井陉县| 晋宁县| 龙口市| 威海市| 柳江县| 隆尧县| 湛江市| 怀柔区| 吴川市| 汉阴县| 阿瓦提县| 湘潭县| 抚宁县| 平度市| 永康市| 塘沽区| 霍邱县| 恭城| 黑河市|