QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#13268. 区间本质不同子串

统计

题目描述

给定字符串 $S$,$q$ 次询问,每次给出 $l,r(1 \leq l \leq r \leq |S|)$,你需要求出 $S[l:r]$ 本质不同的子串数量。

输入格式

输入的第一行包含一个字符串 $S$。

接下来一行包含一个整数 $q$。

接下来 $q$ 行,每行两个整数 $l,r$,描述一组询问。

输出格式

输出 $q$ 行,每行一个整数,表示答案。

样例数据

样例 1 输入

helloeveryonenationalolympiadininformaticswilltakeplaceinaugustgoodlucktoeveryonebythewaythisisejudgecontestadministrationsystem
5
1 58
18 46
35 57
25 40
55 56

样例 1 输出

1662
420
267
129
3

样例 2 输入

browseprivatelyexplorefreelydefendyourselfagainsttrackingandsurveillancecircumventcensorship
5
1 30
15 45
20 60
30 70
40 80

样例 2 输出

447
476
830
832
832

样例 3

见下发文件

子任务

对于所有数据,$1 \leq |S| \leq 2 \times 10^5, 1 \leq q \leq 2 \times 10^5$。

  • Subtask 1(5 Points): $|S|,q \leq 50$
  • Subtask 2(20 Points): $q \leq 50$
  • Subtask 3(26 Points): $S$ 中只含有 ab
  • Subtask 4(23 Points): $|S| \leq 2 \times 10^4, q \leq 4 \times 10^4$
  • Subtask 5(26 Points): 没有额外的限制。
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.