結果

問題 No.607 開通777年記念
ユーザー Kozuma
提出日時 2018-01-19 16:25:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 536 ms / 2,000 ms
コード長 410 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-24 12:04:27
合計ジャッジ時間 2,415 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

def densya():
	N, M = map(int, input().split())
	a = [0 for _ in range(N)]

	isEnd = False

	for i in range(M):
		b = list(map(int, input().split()))
		a = [a[j] + b[j] for j in range(N)]
		
		sum = 0
		left = 0
		for right in range(N):
			sum += a[right]
			while sum > 777:
				sum = sum - a[left]
				left += 1
			if sum == 777:
				isEnd = True

	return isEnd

if densya():
	print("YES")
else:
	print("NO")
0