結果
| 問題 | 
                            No.3110 Like CPCTF?
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-04-20 10:58:46 | 
| 言語 | JavaScript  (node v23.5.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,120 bytes | 
| コンパイル時間 | 432 ms | 
| コンパイル使用メモリ | 8,100 KB | 
| 実行使用メモリ | 44,708 KB | 
| 最終ジャッジ日時 | 2025-04-20 10:58:49 | 
| 合計ジャッジ時間 | 2,305 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 3 | 
| other | RE * 16 | 
ソースコード
def count_cpctf_substrings(s):
    n = len(s)
    count = 0
    
    # 5つの位置を選ぶすべての組み合わせを考える
    for i in range(n):
        for j in range(i+1, n):
            for k in range(j+1, n):
                for l in range(k+1, n):
                    for m in range(l+1, n):
                        # 選んだ5文字
                        chars = [s[i], s[j], s[k], s[l], s[m]]
                        
                        # CPCTF的かどうかを判定
                        # 1. 1文字目と3文字目が等しい
                        if chars[0] == chars[2]:
                            # 2. それ以外の文字の組み合わせはすべて異なる
                            if chars[0] != chars[1] and chars[0] != chars[3] and chars[0] != chars[4] and \
                               chars[1] != chars[2] and chars[1] != chars[3] and chars[1] != chars[4] and \
                               chars[2] != chars[3] and chars[2] != chars[4] and \
                               chars[3] != chars[4]:
                                count += 1
    
    return count