結果
| 問題 | No.2073 Concon Substrings (Swap Version) |
| コンテスト | |
| ユーザー |
lilictaka
|
| 提出日時 | 2022-09-18 23:12:35 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 509 bytes |
| 記録 | |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 109,872 KB |
| 最終ジャッジ日時 | 2026-05-28 12:15:42 |
| 合計ジャッジ時間 | 4,732 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 17 WA * 20 |
ソースコード
from collections import defaultdict
N = int(input())
S = list(input())
cnt = [defaultdict(int) for _ in range(3)]
for i,s in enumerate(S):
cnt[i%3][s] +=1
a = min(cnt[0]['c'],cnt[1]['o'],cnt[2]['n'])
b = min(cnt[0]['o'],cnt[1]['n'],cnt[2]['c'])
c = min(cnt[0]['n'],cnt[1]['c'],cnt[2]['o'])
tmp = 0
if a >0:
tmp +=1
if b > 0:
tmp +=1
if c > 0:
tmp =+1
if tmp==3:
ans = min(a+b+c,N-2)
elif tmp ==2:
ans = min(a+b+c,N-1)
elif tmp == 1:
ans = min(a+b+c,N)
else:
ans = 0
print(ans)
lilictaka