結果
| 問題 | 
                            No.1535 五七五
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kokatsu
                         | 
                    
| 提出日時 | 2023-01-14 22:06:23 | 
| 言語 | D  (dmd 2.109.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 206 ms / 2,000 ms | 
| コード長 | 671 bytes | 
| コンパイル時間 | 2,441 ms | 
| コンパイル使用メモリ | 211,080 KB | 
| 実行使用メモリ | 30,092 KB | 
| 最終ジャッジ日時 | 2024-06-22 17:18:40 | 
| 合計ジャッジ時間 | 5,649 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
import std;
void main() {
    int N, a, b, c;
    readf("%d\n%d %d %d\n", N, a, b, c);
    auto S = readln.chomp.split;
    auto L = [0] ~ S.map!(x => x.length.to!int).array;
    auto C = L.cumulativeFold!"a + b".array;
    auto A = C.assumeSorted;
    int res;
    foreach (i; 0 .. N) {
        int x = C[i] + a;
        auto lba = A.lowerBound(x+1);
        if (lba.empty || lba.back != x) continue;
        int y = x + b;
        auto lbb = A.lowerBound(y+1);
        if (lbb.empty || lbb.back != y) continue;
        int z = y + c;
        auto lbc = A.lowerBound(z+1);
        if (lbc.empty || lbc.back != z) continue;
        ++res;
    }
    res.writeln;
}
            
            
            
        
            
kokatsu