The Good Guys plan to beat the Bad Guys by shooting them with ionizing radiation. To calibrate their weapons, the Good Guys need to know the composition of some interval of the Bad Guys’ DNA. The Bad Guys are not just bad – they’re evil – and so, they evolve every day by replacing each of the letters A, C, G, and T in their DNA with their corresponding strings of length at least 2: and . There will be many fights over many days, and so the Good Guys need to make different queries consisting of three numbers – and . For each query, you need to report four numbers, corresponding to the number of As, Cs, Gs, and Ts in the closed interval of the Bad Guys’ DNA on the -th day.
Implementation details
You should implement the function solve:
std::vector<std::vector<long long>> solve(
std::string S_0,
std::vector<std::string> S_ACGT,
std::vector<long long> K,
std::vector<long long> L,
std::vector<long long> R
)
- : the Bad Guys' DNA on the -th day;
- : the strings ;
- : vector of non-negative integers, the -th of which is ;
- : vector of non-negative integers, the -th of which is ;
- : vector of non-negative integers, the -th of which is ;
This function is called exactly once for each test case. It has to return a vector of 4-element vectors - the number of As, Cs, Gs and Ts in the corresponding queries.
Constraints and clarifications
- , where
- It is guaranteed that all letters in the strings are
A,C,G,T. - for all
- for all
- It is guaranteed that for all queries there exist letters with indices from to .
| Subtask | Points | Required subtasks | Other constraints | |||
|---|---|---|---|---|---|---|
| 0 | 0 | - | - | - | - | The sample test. |
| 1 | 7 | 0 | - | |||
| 2 | 6 | 0-1 | - | |||
| 3 | 13 | 0-2 | - | |||
| 4 | 10 | 0-3 | - | |||
| 5 | 15 | 0-4 | - | |||
| 6 | 7 | - | . | |||
| 7 | 17 | 0-3 | - | |||
| 8 | 25 | 0-7 | - |
Example
stdin
TAG
TGT
CGT
CCT
CGC
10
1 3 3
2 2 5
0 0 2
0 2 2
0 0 2
1 8 8
0 1 1
1 0 5
0 0 1
1 2 7
stdout
0 0 0 1
0 2 0 2
1 0 1 1
0 0 1 0
1 0 1 1
0 0 0 1
1 0 0 0
0 2 2 2
1 0 0 1
0 3 1 2
Explanation
The Bad Guys’ DNA for the -th, -st, and -nd day is as follows:
TAGCGCTGTCCTCGTCCTCGTCGCCCTCGCCGTCGTCGC
Sample grader
Input format:
- line to : .
- line : – the number of queries.
- line to : .
Output format:
- line – the numbers returned by the -th call.