結果
問題 |
No.2073 Concon Substrings (Swap Version)
|
ユーザー |
![]() |
提出日時 | 2022-09-16 22:58:57 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 363 bytes |
コンパイル時間 | 388 ms |
コンパイル使用メモリ | 82,236 KB |
実行使用メモリ | 104,884 KB |
最終ジャッジ日時 | 2024-12-21 22:28:13 |
合計ジャッジ時間 | 5,243 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 25 WA * 12 |
ソースコード
import collections N = int(input()) S = list(input()) C = [collections.Counter() for _ in range(3)] for i,c in enumerate(S): C[i%3][c]+=1 v1 = min(C[0]['c'],C[1]['o'],C[2]['n']) v2 = min(N-1,min(C[0]['o'],C[1]['n'],C[2]['c'])) v3 = min(N-1,min(C[0]['n'],C[1]['c'],C[2]['o'])) print(max(v1,v2,v3,min(v1+v2,N-2),min(v2+v3,N-2),min(v3+v1,N-2),min(v1+v2+v3,N-3)))