| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 1024 MB | 28 | 13 | 12 | 44.444% |
There are $N$ cards in a row. Each card has a red front side and a blue back side. An integer $R_i$ is written on the red side of the $i$-th card, and an integer $B_i$ is written on the blue side. Initially, every card is facing either red side up or blue side up.
An operation on a range $[l, r]$ is defined as follows:
You need to process the following $Q$ queries:
1 i — Flip the $i$-th card.2 i k — Change the value on the red side of the $i$-th card to $k$.3 i k — Change the value on the blue side of the $i$-th card to $k$.4 l r T — Calculate the sum of the numbers on the face-up sides in the range $[l, r],ドル when the operation has been applied to this range $T$ times. The state of the cards does not change as a result of this query.The first line contains a single integer $N,ドル the number of cards.
The second line contains a string $s$ of length $N,ドル consisting of characters R and B. The $i$-th character of $s$ denotes the initial side of the $i$-th card (R for red side up, B for blue side up).
The third line contains $N$ integers $R_1, R_2, \cdots, R_N$ — the values on the red sides of the cards.
The fourth line contains $N$ integers $B_1, B_2, \cdots, B_N$ — the values on the blue sides of the cards.
The fifth line contains a single integer $Q,ドル the number of queries.
Each of the next $Q$ lines describes a query of one of the four types as described above.
For each query of type 4ドル,ドル output a single integer, the calculated sum for the specified range.
5 RRRRR 1 2 3 2 1 5 4 3 4 5 4 4 1 5 1 4 1 5 2 1 2 4 1 4 1
13 11 8
8 RBRBRBRB 451 79 882 122 1289 242 2459 262 697 1082 1888 3070 225 410 751 1089 11 1 5 4 1 6 10121 1 3 2 6 803 3 3 741 4 2 7 11104 1 5 3 8 690 2 5 137 3 6 148 4 3 8 20915
7187 5810 6333
University > KAIST > KAIST ICPC Mock Competition > 2025 KAIST 15th ICPC Mock Competition D번
University > MIT > The MIT Programming Contest > 2025-26 > MIT Team Contest 2 D번