結果
問題 | No.2073 Concon Substrings (Swap Version) |
ユーザー | roaris |
提出日時 | 2022-09-16 22:41:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 72 ms / 2,000 ms |
コード長 | 616 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 69,468 KB |
最終ジャッジ日時 | 2024-12-21 22:00:30 |
合計ジャッジ時間 | 3,785 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 37 |
ソースコード
import sys input = sys.stdin.readline from collections import * N = int(input()) S = input()[:-1] c = [0, 0, 0] o = [0, 0, 0] n = [0, 0, 0] for i in range(3*N): if S[i]=='c': c[i%3] += 1 elif S[i]=='o': o[i%3] += 1 elif S[i]=='n': n[i%3] += 1 ans = 0 now = 0 for _ in range(min(c[0], o[1], n[2])): if now+3<=3*N: now += 3 ans += 1 now += 1 for _ in range(min(c[1], o[2], n[0])): if now+3<=3*N: now += 3 ans += 1 now += 1 for _ in range(min(c[2], o[0], n[1])): if now+3<=3*N: now += 3 ans += 1 print(ans)