結果
問題 | No.607 開通777年記念 |
ユーザー | 💕💖💞 |
提出日時 | 2018-06-18 03:51:13 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 607 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 10,796 KB |
実行使用メモリ | 48,700 KB |
最終ジャッジ日時 | 2023-09-13 06:39:27 |
合計ジャッジ時間 | 6,670 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
8,256 KB |
testcase_01 | AC | 16 ms
7,804 KB |
testcase_02 | AC | 16 ms
8,332 KB |
testcase_03 | AC | 15 ms
8,300 KB |
testcase_04 | AC | 15 ms
7,904 KB |
testcase_05 | AC | 16 ms
8,192 KB |
testcase_06 | AC | 16 ms
8,316 KB |
testcase_07 | RE | - |
testcase_08 | AC | 16 ms
7,908 KB |
testcase_09 | RE | - |
testcase_10 | AC | 23 ms
8,568 KB |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
ソースコード
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')