結果
| 問題 | 
                            No.3110 Like CPCTF?
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-04-19 02:02:28 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 75 ms / 2,000 ms | 
| コード長 | 306 bytes | 
| コンパイル時間 | 359 ms | 
| コンパイル使用メモリ | 82,736 KB | 
| 実行使用メモリ | 76,160 KB | 
| 最終ジャッジ日時 | 2025-04-19 02:02:31 | 
| 合計ジャッジ時間 | 2,492 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 16 | 
ソースコード
import itertools
import sys
input = sys.stdin.readline
N = int(input())
S = input().strip()
ans = 0
for l in itertools.combinations(range(N), 5):
    tmp = set()
    if S[l[0]]==S[l[2]]:
        for i in l:
            s = S[i]
            tmp.add(s)
        if len(tmp)==4:
            ans += 1
print(ans)