結果
| 問題 | No.2738 CPC To F | 
| コンテスト | |
| ユーザー |  lam6er | 
| 提出日時 | 2025-04-15 23:54:28 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 792 bytes | 
| コンパイル時間 | 239 ms | 
| コンパイル使用メモリ | 82,240 KB | 
| 実行使用メモリ | 88,144 KB | 
| 最終ジャッジ日時 | 2025-04-15 23:55:25 | 
| 合計ジャッジ時間 | 2,152 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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)
            
            
            
        