Codeforces Round #359 (Div.2)
はい。
http://codeforces.com/contest/686
A. Free Ice Cream
ざっくりと大意
・最初のアイスの量はxでクエリはn件ある。+は入庫で在庫が増えて、-は販売で在庫が減る、、はずだが在庫が足りない場合は減らない。
・最終の在庫の量と、在庫が足りずに販売できなかった回数を出力する。
Python2
n,x=map(int,raw_input().split()) ans=chk=0 ans=x for i in range(n): o,d=map(str,raw_input().split()) tmp=int(d) if o=='+': ans+=tmp else: if tmp>ans: chk+=1 else: ans-=tmp print ans,chk
はい。シミュレートするしか無いと思う。
B. Little Robber Girl's Zoo
ざっくりと大意
・数列aに対して\(a_r\)と\(a_l\)でl-r+1が偶数になる区間を選ぶ。
・その区間でlとl+1が、l+2とl+3が、r-1とrがスワップされる。
・あとで、、、