luogu#P16375. [IATI 2026] Evilution

    ID: 16554 远端评测题 1500ms 1024MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>交互题2026IATI(保加利亚/东欧)

[IATI 2026] Evilution

Problem Description

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\texttt{A}, C\texttt{C}, G\texttt{G}, and T\texttt{T} in their DNA with their corresponding strings of length at least 2\textbf{at least 2}: SAS_\texttt{A}, SCS_\texttt{C}, SGS_\texttt{G}, and STS_\texttt{T}. There will be many fights over many days, and so the Good Guys need to make QQ different queries consisting of three numbers -- KiK_i, LiL_i, and RiR_i. For each query, you need to report four numbers, corresponding to the number of A\texttt{A}s, C\texttt{C}s, G\texttt{G}s, and T\texttt{T}s in the closed interval [Li;Ri][L_i; R_i] of the Bad Guys' DNA on the KiK_i-th day.

Implementation details

You should implement the function solve\texttt{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
 )
  • S0S_0: the Bad Guys' DNA on the 00-th day.
  • SACGTS_\texttt{ACGT}: the 44 strings $S_\texttt{A}, S_\texttt{C}, S_\texttt{G}, S_\texttt{T}$.
  • KK: vector of QQ non-negative integers, the ii-th of which is KiK_i.
  • LL: vector of QQ non-negative integers, the ii-th of which is LiL_i.
  • RR: vector of QQ non-negative integers, the ii-th of which is RiR_i.

This function is called exactly once for each test case. It has to return a vector of QQ 44-element vectors -- the number of A\texttt{A}s, C\texttt{C}s, G\texttt{G}s, and T\texttt{T}s in the corresponding queries.

Input Format

Input format:

  • line 11 to 55: $S_0, S_\texttt{A}, S_\texttt{C}, S_\texttt{G}, S_\texttt{T}$.
  • line 66: QQ -- the number of queries.
  • line 77 to 7+(Q1)7+(Q-1): KiK_i, LiL_i, RiR_i.

Output Format

Output format:

  • line ii -- the numbers returned by the ii-th call.
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
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

Hint

Explanation of the sample

The Bad Guys' DNA for the 00-th, 11-st, and 22-nd day is as follows:

  • TAG\tt TAG
  • CGCTGTCCT\tt CGCTGTCCT
  • CGTCCTCGTCGCCCTCGCCGTCGTCGC\tt CGTCCTCGTCGCCCTCGCCGTCGTCGC

Constraints

  • 2S1052 \le S \le 10^5, where $S = \max(|S_0|, |S_\texttt{A}|, |S_\texttt{C}|, |S_\texttt{G}|, |S_\texttt{T}|)$
  • Is is guaranteed that all letters in the strings are A\texttt{A}, C\texttt{C}, G\texttt{G}, T\texttt{T}.
  • 1Q1041 \le Q \le 10^4
  • 0Ki10180 \le K_i \le 10^{18} for all 0iQ10 \le i \le Q-1
  • 0LiRi10180 \le L_i \le R_i \le 10^{18} for all 0iQ10 \le i \le Q-1
  • It is guaranteed that for all queries there exist letters with indices from LiL_i to RiR_i.

Subtasks

Subtask Points Required subtasks SS QQ KiK_i Other constraints
00 - -- The sample test.
11 77 00 5\le 5 100\le 100 10\le 10 --
22 66 010-1 6\le 6 104\le 10^4
33 1313 020-2 103\le 10^3 50\le 50
44 1010 030-3 105\le 10^5
55 1515 040-4 2×103\le 2 \times 10^3
66 77 - 1018\le 10^{18} Li=Ri=0L_i = R_i = 0.
77 1717 030-3 103\le 10^3 --
88 2525 070-7 105\le 10^5

The points for a given subtask are obtained only if all the tests for it and the required subtasks are successfully passed.