結果

問題 No.3110 Like CPCTF?
ユーザー ぽん🍊
提出日時 2025-04-19 02:00:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 477 ms
コンパイル使用メモリ 82,772 KB
実行使用メモリ 76,952 KB
最終ジャッジ日時 2025-04-19 02:00:57
合計ジャッジ時間 2,480 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 9)
n = int(input())
s = [v for v in input()]

lis = []
def dfs(l: list[str], idx: int):
    if len(l) == 5:
        lis.append(l)
        return
    for i in range(idx + 1, n):
        if len(l) == 2 and s[i] != l[0]:
            continue
        
        if len(l) == 1 or len(l) > 2:
            if s[i] in l:
                continue
        dfs(l + [s[i]], i)

for i in range(n):
    dfs([s[i]], i)

print(len(lis))
0