結果
| 問題 |
No.3164 [Chery 7th Tune B] La vie en rose
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-11 11:22:41 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 555 bytes |
| コンパイル時間 | 637 ms |
| コンパイル使用メモリ | 12,032 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2025-08-11 11:22:50 |
| 合計ジャッジ時間 | 8,450 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 TLE * 1 -- * 28 |
ソースコード
from collections import deque
n = int(input())
a = list(map(int, input().split()))
q = int(input())
for _ in range(q):
x, b = map(int, input().split())
x -= 1
visited = [False] * n
queue = deque([x])
visited[x] = True
total = 0
while queue:
current = queue.popleft()
total += a[current]
for next in [current - 1, current + 1]:
if 0 <= next < n and not visited[next] and a[next] > 0:
visited[next] = True
queue.append(next)
print(total + b - a[x])