結果
問題 |
No.2073 Concon Substrings (Swap Version)
|
ユーザー |
|
提出日時 | 2022-09-17 21:58:37 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 525 bytes |
コンパイル時間 | 294 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 65,664 KB |
最終ジャッジ日時 | 2024-12-22 00:59:27 |
合計ジャッジ時間 | 4,383 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 5 |
other | RE * 37 |
ソースコード
N = int(input()) NN *= 3 S = input() dat = [[0] * 3 for _ in range(3)] for i in range(NN): j = i % 3 if S[i] == "c": dat[j][0] += 1 elif S[i] == "o": dat[j][1] += 1 elif S[i] == "n": dat[j][2] += 1 ans = 0 """ for i in range(3): ans += min(dat[i][0],dat[(i+1)%3][1],dat[(i+2)%3][2]) """ ans += min(dat[0][0],dat[1][1],dat[2][2]) t = min(dat[1][0],dat[2][1],dat[0][2]) if t == N: t -= 1 ans += t t = min(dat[2][0],dat[0][1],dat[1][2]) if t == N: t -= 1 ans += t print(ans)