結果

問題 No.3110 Like CPCTF?
ユーザー Kevgen
提出日時 2025-04-18 21:42:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2025-04-18 21:42:02
合計ジャッジ時間 2,065 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input().strip()

if n < 5:
    print(0)
else:
    from itertools import combinations
    count = 0
    for indices in combinations(range(n), 5):
        c0 = s[indices[0]]
        c1 = s[indices[1]]
        c2 = s[indices[2]]
        c3 = s[indices[3]]
        c4 = s[indices[4]]
        if c0 == c2:
            if c1 != c0 and c3 != c0 and c4 != c0:
                if c1 != c3 and c1 != c4 and c3 != c4:
                    count += 1
    print(count)
0