AtCoderProblems 4

隙間時間にちょこちょこ
難易度Easyでチマチマやってます


https://atcoder.jp/contests/abc139/tasks/abc139_c
変数名適当なの、ちょっと直したほうがいいかしら…

N=int(input())
A=list(map(int,input().split()))
bef=99999999999999
count=0
max=0
for i in range(N):
  l=A.pop()
  if l >= bef:
    count +=1
  else:
    count=0
  if max <= count:
    max=count
  bef=l
print(max)


https://atcoder.jp/contests/abc118/tasks/abc118_b
少し複雑にしてしまった気がする、もう少しシンプルになるかも?

N,M=map(int,(input().split()))
k=list(map(int,input().split()))[1:]
for i in range(N-1):
  A=list(map(int,input().split()))[1:]
  l=[]
  for j in k:
    if j in A:
      l.append(j)
  k=l
print(len(k))

以上