結果
| 問題 | No.2073 Concon Substrings (Swap Version) |
| コンテスト | |
| ユーザー |
taiga0629kyopro
|
| 提出日時 | 2022-09-16 21:41:53 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 130 ms / 2,000 ms |
| コード長 | 326 bytes |
| 記録 | |
| コンパイル時間 | 1,019 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 108,032 KB |
| 最終ジャッジ日時 | 2026-05-28 09:20:21 |
| 合計ジャッジ時間 | 5,982 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 37 |
ソースコード
n=int(input())
s=list(input())
from _collections import defaultdict
cnt=defaultdict(int)
for i in range(3*n):
cnt[i%3,s[i]]+=1
ans=0
nokori=3*n
for j in range(3):
res=min(cnt[j,"c"],cnt[(j+1)%3,"o"],cnt[(j+2)%3,"n"])
while nokori-3*res<0 and res>0:res-=1
ans+=res
nokori-=3*res
nokori-=1
print(ans)
taiga0629kyopro