結果

問題 No.607 開通777年記念
ユーザー itsy68itsy68
提出日時 2022-09-23 18:12:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 242 ms / 2,000 ms
コード長 862 bytes
コンパイル時間 766 ms
コンパイル使用メモリ 86,548 KB
実行使用メモリ 80,832 KB
最終ジャッジ日時 2023-08-23 20:58:59
合計ジャッジ時間 3,602 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
76,744 KB
testcase_01 AC 120 ms
76,672 KB
testcase_02 AC 124 ms
76,720 KB
testcase_03 AC 121 ms
76,716 KB
testcase_04 AC 120 ms
76,888 KB
testcase_05 AC 121 ms
76,884 KB
testcase_06 AC 119 ms
76,916 KB
testcase_07 AC 167 ms
80,256 KB
testcase_08 AC 120 ms
76,900 KB
testcase_09 AC 139 ms
80,104 KB
testcase_10 AC 135 ms
79,964 KB
testcase_11 AC 242 ms
80,832 KB
testcase_12 AC 226 ms
80,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import combinations, permutations, product, accumulate, groupby
from collections import defaultdict, deque, Counter
from functools import reduce
import heapq
import bisect
import math
import copy

sys.setrecursionlimit(10 ** 9)
input = lambda: sys.stdin.readline().rstrip()
INF = float("inf")
MOD = 10 ** 9 + 7
# DFS
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')

N, M = map(int, input().split())
TRAIN = [0] * N
ans = False
for _ in range(M):
    L = list(map(int, input().split()))
    for i in range(N):
        TRAIN[i] += L[i]
    passenger = 0
    que = deque()
    for i in range(N):
        passenger += TRAIN[i]
        que.append(TRAIN[i])
        while passenger > 777:
            passenger -= que.popleft()
        if passenger == 777:
            ans = True
if ans:
    print('YES')
else:
    print('NO')
0