結果
| 問題 |
No.2738 CPC To F
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 23:57:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 792 bytes |
| コンパイル時間 | 225 ms |
| コンパイル使用メモリ | 81,912 KB |
| 実行使用メモリ | 87,880 KB |
| 最終ジャッジ日時 | 2025-04-15 23:58:49 |
| 合計ジャッジ時間 | 2,314 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 WA * 17 |
ソースコード
n = int(input())
s = input().strip()
original_positions = set()
# Find all original CPCTF substrings
for i in range(n - 4):
if s[i] == 'C' and s[i+1] == 'P' and s[i+2] == 'C' and s[i+3] == 'T' and s[i+4] == 'F':
original_positions.add(i)
original = len(original_positions)
cpc_positions = []
# Find all CPC substrings
for i in range(n - 2):
if s[i] == 'C' and s[i+1] == 'P' and s[i+2] == 'C':
cpc_positions.append(i)
additional = 0
# Check each CPC for potential new CPCTF
for i in cpc_positions:
if i - 4 >= 0:
if s[i-4] == 'C' and s[i-3] == 'P' and s[i-2] == 'C' and s[i-1] == 'T':
# Check if this CPC is part of any original CPCTF
if i not in original_positions:
additional += 1
print(original + additional)
lam6er