結果
| 問題 |
No.3110 Like CPCTF?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-19 11:24:15 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 196 ms / 2,000 ms |
| コード長 | 432 bytes |
| コンパイル時間 | 380 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2025-04-19 11:24:18 |
| 合計ジャッジ時間 | 2,772 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
from itertools import combinations
def is_cpctf(sub):
return (
sub[0] == sub[2] and len(set([sub[0], sub[1], sub[2], sub[3], sub[4]])) == 4
)
def count_cpctf_strings(N, S):
count = 0
for indices in combinations(range(N), 5):
sub = ''.join(S[i] for i in indices)
if is_cpctf(sub):
count += 1
return count
N = int(input())
S = input().strip()
print(count_cpctf_strings(N, S))