Logo
(追記) (追記ここまで)

19018번 - Border 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB212216.667%

문제

You are given a string $S[1 \ldots n]$. We denote its substrings as $S[l \ldots r],ドル and when $l > r,ドル such substring is defined to be an empty string. Let $$f(i, j) = \max \left\{k~|~0 \leq k \leq j-i,~S[i \ldots i+k-1] = S[j-k+1 \ldots j]\right\} \text{.}$$

Output $\sum\limits_{1 \leq i < j \leq n} f(i, j)$.

The string $S$ is generated in the following way. The values $n$ and $\mathit{seed}$ are the parameters of the generator.

long long seed;
for (int i = 1; i <= n; i++) {
 seed = (seed * 13331 + 23333) % 1000000007;
 s[i] = 'a' + (seed & 1);
}

입력

The first line contains two integers: $n$ and $\mathit{seed}$ (1ドル \leq n \leq 10^6,ドル 0ドル \leq \mathit{seed} \leq 10^9 + 6$).

출력

Output the answer.

제한

예제 입력 1

10 233333

예제 출력 1

50

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2018 > Day 8: Yuhao Du Contest 5, Grand Prix of Zhejiang B번

Contest > Open Cup > 2018/2019 Season > Stage 1: Grand Prix of Zheijang B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /