結果
| 問題 |
No.2073 Concon Substrings (Swap Version)
|
| コンテスト | |
| ユーザー |
lilictaka
|
| 提出日時 | 2022-09-18 23:12:35 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 509 bytes |
| コンパイル時間 | 346 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 104,856 KB |
| 最終ジャッジ日時 | 2024-12-22 01:47:29 |
| 合計ジャッジ時間 | 5,011 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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