Pls help me with this problem

Revision en1, by PUSSY_LICKING_LOLI_69, 2023-12-16 06:05:09

Given an array A of size n and a permutation P. You have 4 types of queries:

1 l r v: A[p[i]]+=v with all l<=i<=r

2 l r: calculate sum of all A[i] with all l<=i<=r

3 x y: swap P[x] and P[y]

4 k: roll back A and P to right before the kth query

Here's the link the the original problem(Vietnamese) if you're interested: https://oj.vnoi.info/problem/olp_sc23_pquery

I'll be looking forward to your answers. Thank you :D

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English PUSSY_LICKING_LOLI_69 2023-12-18 07:20:43 199
en2 English PUSSY_LICKING_LOLI_69 2023-12-16 06:12:38 52
en1 English PUSSY_LICKING_LOLI_69 2023-12-16 06:05:09 465 Initial revision (published)