結果

問題 No.607 開通777年記念
ユーザー daleksprinterdaleksprinter
提出日時 2018-08-16 13:10:34
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,478 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 45 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 39,040 KB
最終ジャッジ日時 2024-04-09 20:44:51
合計ジャッジ時間 4,024 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,812 KB
testcase_01 AC 9 ms
6,944 KB
testcase_02 AC 9 ms
6,940 KB
testcase_03 AC 10 ms
6,940 KB
testcase_04 AC 10 ms
6,944 KB
testcase_05 AC 10 ms
6,940 KB
testcase_06 AC 9 ms
6,944 KB
testcase_07 AC 209 ms
8,320 KB
testcase_08 AC 11 ms
6,940 KB
testcase_09 AC 25 ms
6,940 KB
testcase_10 AC 17 ms
6,940 KB
testcase_11 AC 1,420 ms
39,040 KB
testcase_12 AC 1,478 ms
38,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,raw_input().split())

arr = [map(int,raw_input().split()) for i in range(m)]

for i in range(1,m):
	for j in range(n):
		arr[i][j] = arr[i-1][j] + arr[i][j]

for i in range(m):
	l = 0
	r = 0

	ans = arr[i][l]

	while l < n :
		if ans == 777:
			print 'YES'
			quit()

		if r + 1 < n and ans + arr[i][r+1] <= 777:
			r += 1
			ans += arr[i][r]

		else :
			ans -= arr[i][l]
			l += 1
			

print 'NO'


0