結果
| 問題 |
No.3110 Like CPCTF?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-18 21:18:18 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 539 bytes |
| コンパイル時間 | 192 ms |
| コンパイル使用メモリ | 12,032 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2025-04-18 21:18:21 |
| 合計ジャッジ時間 | 1,992 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 6 WA * 10 |
ソースコード
from itertools import combinations
def is_cpctf_like(s):
# s: 文字列 長さ5
return (
s[0] == s[2] and
s[1] != s[0] and
s[3] != s[0] and
s[4] != s[0] and
len({s[1], s[3], s[4]}) == 3
)
def count_cpctf_like_subsequences(S):
N = len(S)
count = 0
for indices in combinations(range(N), 5):
sub = ''.join(S[i] for i in indices)
if is_cpctf_like(sub):
count += 1
return count
# 例:
S = input().strip()
print(count_cpctf_like_subsequences(S))