← All problemsSign in

Pizzeria Queries

CSESRange QueriesOpen on judge ↗

There are n buildings on a street, numbered 1,2,\dots,n. Each building has a pizzeria and an apartment. The pizza price in building k is p_k. If you order a pizza from building a to building b, its price (with delivery) is p_a+|a-b|. Your task is to process two types of queries: - The pizza price p_k in building k becomes x. - You are in building k and want to order a pizza. What is the minimu

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start