結果
| 問題 |
No.607 開通777年記念
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-26 15:44:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 218 ms / 2,000 ms |
| コード長 | 538 bytes |
| コンパイル時間 | 286 ms |
| コンパイル使用メモリ | 82,248 KB |
| 実行使用メモリ | 77,184 KB |
| 最終ジャッジ日時 | 2025-03-26 15:44:22 |
| 合計ジャッジ時間 | 2,380 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
def has_subarray(arr, target):
prefix_set = {0}
current_sum = 0
for num in arr:
current_sum += num
if (current_sum - target) in prefix_set:
return True
prefix_set.add(current_sum)
return False
n, m = map(int, input().split())
current_sums = [0] * n
found = False
for _ in range(m):
a = list(map(int, input().split()))
for j in range(n):
current_sums[j] += a[j]
if has_subarray(current_sums, 777):
found = True
break
print("YES" if found else "NO")
lam6er