結果
| 問題 |
No.3110 Like CPCTF?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-20 10:59:07 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,120 bytes |
| コンパイル時間 | 331 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2025-04-20 10:59:09 |
| 合計ジャッジ時間 | 1,714 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 16 |
ソースコード
def count_cpctf_substrings(s):
n = len(s)
count = 0
# 5つの位置を選ぶすべての組み合わせを考える
for i in range(n):
for j in range(i+1, n):
for k in range(j+1, n):
for l in range(k+1, n):
for m in range(l+1, n):
# 選んだ5文字
chars = [s[i], s[j], s[k], s[l], s[m]]
# CPCTF的かどうかを判定
# 1. 1文字目と3文字目が等しい
if chars[0] == chars[2]:
# 2. それ以外の文字の組み合わせはすべて異なる
if chars[0] != chars[1] and chars[0] != chars[3] and chars[0] != chars[4] and \
chars[1] != chars[2] and chars[1] != chars[3] and chars[1] != chars[4] and \
chars[2] != chars[3] and chars[2] != chars[4] and \
chars[3] != chars[4]:
count += 1
return count