結果
| 問題 | No.607 開通777年記念 |
| コンテスト | |
| ユーザー |
💕💖💞
|
| 提出日時 | 2018-06-18 03:51:13 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 607 bytes |
| 記録 | |
| コンパイル時間 | 112 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 58,144 KB |
| 最終ジャッジ日時 | 2024-06-30 16:47:04 |
| 合計ジャッジ時間 | 4,567 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 RE * 2 TLE * 1 -- * 1 |
ソースコード
N, M = map(int, input().split(' '))
xss = []
for i in range(M):
xs = list(map(int, input().split(' ')) )
xss.append( xs )
state = xss[0]
for s in range(0, N):
for e in range(s, N+1):
sum_ = sum( state[s:e] )
if sum_ == 777:
print("YES")
exit()
for xs in xss[1:]:
state = [s+x for s, x in zip(state, xs) ]
shrink = list(filter(lambda x:x!=0 , state)) + [0]
i, j, total = 0, 1, shrink[0]
while j <= N:
if total == 777:
print("YES")
exit()
if total < 777:
total += shrink[j]
j += 1
else:
total -= shrink[i]
i += 1
print('NO')
💕💖💞