2022-03-01から1ヶ月間の記事一覧
尺取り法のめも import sys input = sys.stdin.readline n = int(input()) a = list(map(int,input().split())) s = sum(a)/10 a += a now = [0,0] f = False for i in a: if now[0] < s: now[0] += i elif now[0] == s: f = True break else: v = now[1] fo…
bit全探索、横の列を固定して、縦ごとに見る、defaultdict の操作、などのメモ import sys input = sys.stdin.readline from collections import deque, defaultdict h,w = map(int,input().split()) s = [list(map(int,input().split())) for i in range(h)…