結果
| 問題 |
No.2073 Concon Substrings (Swap Version)
|
| コンテスト | |
| ユーザー |
とりゐ
|
| 提出日時 | 2022-09-16 21:54:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 136 ms / 2,000 ms |
| コード長 | 402 bytes |
| コンパイル時間 | 370 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 74,368 KB |
| 最終ジャッジ日時 | 2024-12-21 19:36:10 |
| 合計ジャッジ時間 | 5,752 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 37 |
ソースコード
from collections import defaultdict
n=int(input())
s=input()
ans=[]
for x in range(3):
y=(x+1)%3
z=(x+2)%3
cnt=[0]*3
for i in range(3*n):
if s[i]=='c' and i%3==x:
cnt[0]+=1
if s[i]=='o' and i%3==y:
cnt[1]+=1
if s[i]=='n' and i%3==z:
cnt[2]+=1
ans.append(min(cnt))
if sum(ans)==n:
if ans[0]==n:
print(n)
else:
print(n-1)
else:
print(sum(ans))
とりゐ