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