結果

問題 No.607 開通777年記念
ユーザー Konton7Konton7
提出日時 2019-05-24 01:18:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 634 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 11,908 KB
実行使用メモリ 10,484 KB
最終ジャッジ日時 2023-10-17 11:45:11
合計ジャッジ時間 2,358 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 29 ms
10,136 KB
testcase_04 RE -
testcase_05 AC 29 ms
10,136 KB
testcase_06 AC 29 ms
10,136 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 516 ms
10,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = [ int(v) for v in input().split() ]
train = [ 0 for i in range(n) ]


def passenger_check(inlist):
	global n
	start, end = 0, 0
	passenger_sum = 0
	check = 0
	for i in range(2*n):
		if end == n and start == n:
			break
		if passenger_sum < 777:
			passenger_sum += inlist[end]
			end += 1
		elif passenger_sum > 777:
			passenger_sum -= inlist[start]
			start += 1
		if passenger_sum == 777:
			check = 1
			break

	return check

ans = "NO"
for i in range(m):
	station = [ int(v) for v in input().split() ]
	train = [ (train[j] + station[j]) for j in range(n) ]
	if passenger_check(train) == 1:
		ans = "YES"
		break
print(ans)
0