問題一覧 > 通常問題

No.1535 Go-Shichi-Go (5-7-5)

レベル : / AI推定難易度 : 700 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 82
作問者 : とりゐ / テスター : 57tggx logx 👑 qand Re_menal2 ゅゅ
お気に入りにしたユーザー ProblemId : 6474 / 自分の提出
問題文最終更新日: 2021-06-07 15:41:57
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
ゅゅちゃんお誕生日コンテスト (順位表) の他の問題:

Problem Statement

Yuyu-chan loves finding and pointing out $a$-$b$-$c$.
There are now $N$ strings. The $i$-th string is $S_i$. How many $a$-$b$-$c$ can Yuyu-chan find among them?
Here, an $a$-$b$-$c$ is a pair $(L,R)\ (1\leq L\lt R\leq N)$ satisfying the following. ($len(S_i)$ denotes the length of the string $S_i$.)

  • There exist integers $i,j\ (L\lt i\lt j \leq R)$ satisfying $\displaystyle \sum _{k=L}^{i-1} len(S_k)=a, \sum _{k=i}^{j-1} len(S_k)=b, \sum _{k=j}^{R} len(S_k)=c$.

Input

$N$
$a\ b\ c$
$S_1\ S_2\ \ldots\ S_N$

  • $N,a,b,c$ are integers
  • $3\leq N \leq 5\times 10^5$
  • $1\leq a,b,c \leq 10^6$
  • $S_i\ (1\leq i\leq N)$ consists of lowercase English letters only
  • $1\leq len(S_i) \leq 10\ (1\leq i\leq N)$

  • Output

    Print a newline at the end.

    Sample

    Sample 1
    Input
    12
    5 7 5
    kaeru pyoko pyoko mi pyoko pyoko awasete pyoko pyoko mu pyoko pyoko
    
    Output
    5

    The following $5$ are $5$-$7$-$5$.

  • pyoko / pyoko mi / pyoko $(L=2,R=5)$
  • pyoko / mi pyoko / pyoko $(L=3,R=6)$
  • pyoko / awasete / pyoko $(L=6,R=8)$
  • pyoko / pyoko mu / pyoko $(L=8,R=11)$
  • pyoko / mu pyoko / pyoko $(L=9,R=12)$
  • Sample 2
    Input
    9
    1 2 3
    y u k i c o d e r
    
    Output
    4

    The following $4$ are $1$-$2$-$3$.

  • y / u k / i c o
  • u / k i / c o d
  • k / i c / o d e
  • i / c o / d e r
  • Sample 3
    Input
    5
    5 7 5
    samidare wo atsumete hayashi mogamigawa
    Output
    0

    提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。