RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00335

Divljak

Unrated 레이팅 미적용
난이도
4s
시간 제한
768MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(5^{th}\) round, January \(17^{th}\) 2015
Nowadays, there are a lot of unusual people. We won’t go into details, but instead focus on a certain
type, to us personally the most interesting people. Of course, we’re talking about barbarians!
There are a lot of barbarians, but only a few of them are truly important. This story has \(N\) important
barbarians, denoted with integers from 1 to \(N\). Each of them has their own stone tablet with their
word written on it, consisting of only lowercase letters of the English alphabet.
Our barbarians are playing an interesting game with their good friend Tarzan.
The game is played in \(Q\) rounds. There are two round types and each is determined by Tarzan:
\(1^{st}\) type: Tarzan shows the word \(P\) to the barbarians.
\(2^{nd}\) type: Tarzan asks the barbarian denoted with \(S\) the following question: “Out of all the words
I’ve shown you so far, how many of them are such that the word on your stone tablet is
their consecutive substring?”
Given the fact that the barbarians go wild a lot and aren’t really able to pay attention and keep up
with what’s happening in the game, they need your help. Help the barbarians answer each of Tarzan’s
questions correctly.

제약

In test cases worth 50% of total points, it will hold \(N\) ⩽20 000.
\(5^{th}\) round, January \(17^{th}\) 2015

입력 형식

The first line of input contains the integer \(N\) (1 ⩽\(N\)\(10^{5}\)), the number of barbarians.
Each of the following \(N\) lines contains a single word consisting of only lowercase letters of the English
alphabet, the \(i\)^{th} word corresponding to the word on the stone tablet of barbarian denoted with \(i\).
After that, the integer \(Q\) (1 ⩽\(Q\)\(10^{5}\)) follows, the number of rounds in the game.
The following \(Q\) lines describe the round of the game, the \(i\)^{th} line describing the \(i\)^{th} round of the game.
Each line will contain the integer \(O\). In the case when \(O\) is equal to 1, it denotes the first type of
alphabet.
In the case when \(O\) is equal to 2, it denotes the second type of round and the number \(S\) (1 ⩽\(S\)\(N\))
follows in the same line, the label of the barbarian whom Tarzan asked the question.
The total length of all words written on the barbarians’ stone tablets will not exceed \(2 \cdot 10^{6}\).
The total length of all words that Tarzan shows the barbarians will not exceed \(2 \cdot 10^{6}\).

출력 형식

For each round of a different form, output a single line. The \(i\)^{th} line must contain the correct answer
to Tarzan’s question in the \(i\)^{th} round of type 2.

예제 1
입력
3
a
bc
abc
3
1 abca
2 1
2 3
7
abba
bbaa
b
bbaa
abba
a
ba
7
1 aaabbabbaab
2 7
1 baabaaa
1 aabbbab
2 3
1 aabba
2 3
출력
output
1
1
1
3
4
설명

Clarification of the first example: The only word Tarzan has shown is abca.
The answer to the first
question is, of course, 1 because the word a is a substring of the word abca. The answer to the second question
is also 1 because the word abc is a substring of the word abca.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2014/2015 Contest 5

평가 및 의견

Divljak

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Divljak

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8