Educational Codeforces Round 15
はい。
http://codeforces.com/contest/702
A. Maximum Increase
ざっくりと大意
・厳密に増加している部分の最長はいくつか??
Python2
n=int(raw_input()) l=map(int,raw_input().split()) ans=chk=1 tmp=-1 for i in l: if tmp==-1: pass elif i>tmp: chk+=1 else: chk=1 tmp=i ans=max(ans,chk) print ans
特に工夫せず前の値と比較していれば大丈夫だと思う。
B. Powers of Two
ざっくりと大意
・2つの数の和が2の累乗であるようなものがいくつあるか。
Python2
n=int(raw_input()) #chk=set([2**i for i in range(36)]) chk=[2**i for i in range(36)] l=map(int,raw_input().split()) d={} for a,i in enumerate(l): if i in d: d[i].add(a) else: d[i]=set([a]) ans=0 for a,i in enumerate(l): for j in chk: if j-i in d: ans+=len(set([k for k in d[j-i] if k>a])) elif max(d)<j-i: break print ans
setとかちょいちょい試したけどもTLE解決せず。。あとで。