結果
| 問題 |
No.2738 CPC To F
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 23:58:47 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 845 bytes |
| コンパイル時間 | 1,488 ms |
| コンパイル使用メモリ | 81,276 KB |
| 実行使用メモリ | 71,548 KB |
| 最終ジャッジ日時 | 2025-04-16 00:00:20 |
| 合計ジャッジ時間 | 2,701 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 WA * 17 |
ソースコード
n = int(input())
s = input().strip()
marked = [False] * n
original_count = 0
# Find all original CPCTF and mark their CPC parts
for i in range(len(s) - 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_count += 1
marked[i] = True
marked[i+1] = True
marked[i+2] = True
additional_count = 0
# Check each CPC in the original string
for j in range(len(s) - 2):
if s[j] == 'C' and s[j+1] == 'P' and s[j+2] == 'C':
# Check if any part of this CPC is marked
if marked[j] or marked[j+1] or marked[j+2]:
continue
# Check if preceded by CPCT
if j >= 4:
if s[j-4] == 'C' and s[j-3] == 'P' and s[j-2] == 'C' and s[j-1] == 'T':
additional_count += 1
print(original_count + additional_count)
lam6er