結果
問題 | No.1104 オンライン点呼 |
ユーザー | maspy |
提出日時 | 2020-07-03 23:07:33 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 752 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 11,880 KB |
実行使用メモリ | 24,824 KB |
最終ジャッジ日時 | 2023-10-17 06:08:22 |
合計ジャッジ時間 | 6,049 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
10,144 KB |
testcase_01 | AC | 300 ms
24,380 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 30 ms
10,144 KB |
testcase_05 | AC | 30 ms
10,144 KB |
testcase_06 | AC | 30 ms
10,144 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 600 ms
24,824 KB |
testcase_10 | AC | 31 ms
10,144 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 205 ms
19,068 KB |
testcase_16 | AC | 276 ms
21,760 KB |
testcase_17 | AC | 164 ms
16,700 KB |
testcase_18 | AC | 211 ms
18,804 KB |
testcase_19 | AC | 251 ms
21,672 KB |
testcase_20 | AC | 271 ms
22,516 KB |
testcase_21 | AC | 271 ms
22,584 KB |
testcase_22 | AC | 230 ms
20,416 KB |
testcase_23 | AC | 183 ms
18,204 KB |
testcase_24 | AC | 97 ms
13,476 KB |
testcase_25 | AC | 31 ms
10,144 KB |
testcase_26 | AC | 32 ms
10,144 KB |
testcase_27 | AC | 31 ms
10,144 KB |
ソースコード
import sys from heapq import heappush, heappop read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K = map(int, readline().split()) A = [0] + list(map(int, readline().split())) B = [0] + list(map(int, readline().split())) if N == 1: print(0) exit() q = [(A[1] + B[2], 2)] done = [0] * (N + 1) done[1] = 1 ans = 0 while q: t, j = heappop(q) if done[j]: continue if j in (N - 1, N): ans = max(ans, t) done[j] = 1 # j+1 への伝搬 if j < N: t1, j1 = t + A[j] + B[j + 1], j + 1 heappush(q, (t1, j1)) # j+2 への伝搬 if j < N - 1: t1, j1 = t + A[j] + B[j + 2] + K, j + 2 heappush(q, (t1, j1)) print(ans)