五月天青色头像情侣网名,国产亚洲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ó)家法律
凌云县| 宁远县| 柯坪县| 湘西| 辽源市| 桂东县| 乌恰县| 井陉县| 霞浦县| 古丈县| 临泽县| 阜城县| 无锡市| 霍山县| 禹州市| 梧州市| 罗平县| 永春县| 乐安县| 平度市| 鱼台县| 茶陵县| 丰原市| 宽甸| 藁城市| 广德县| 平阳县| 延吉市| 尤溪县| 大连市| 徐水县| 高雄县| 山阳县| 井研县| 万年县| 东辽县| 朝阳市| 普洱| 自贡市| 昌邑市| 克什克腾旗|