#P12565. [UTS 2024] Big

    ID: 12375 Type: RemoteJudge 3500ms 512MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>2024UOI(乌克兰)

[UTS 2024] Big

题目描述

You are given two integers, aa and bb. You concatenate all the numbers in the range [a,b][a, b] in an order that produces the largest possible number, xx.

You are given qq queries of the form: kk --- what is the kk-th digit of xx?

The digits of xx are 00-indexed, starting with the most significant one.

It is guaranteed that the length of xx will be at least k+1k + 1.

输入格式

The first line contains two integers aa and bb (0<ab10170 < a \leq b \leq 10^{17}).

The second line contains one integer qq (1q51041 \leq q \leq 5 \cdot 10^4).

The third line contains qq integers k1,k2,,kqk_1, k_2, \dots, k_q (0ki210180 \leq k_i \leq 2 \cdot 10^{18}), representing the queries. It is guaranteed that all answers exist.

输出格式

The only line of the output should contain a string of length qq, where the ii-th character will be the answer to the ii-th query.

8 13
4
0 3 8 9
9310

提示

  • (44 points): ba7b - a \leq 7;
  • (44 points): len(a)=len(b)len(a) = len(b);
  • (1010 points): ba100000b - a \leq 100000
  • (3333 points): q30q \leq 30;
  • (2323 points): q1000q \leq 1\,000;
  • (1616 points): q10000q \leq 10\,000;
  • (1010 points): no further restrictions.