結果
問題 |
No.2073 Concon Substrings (Swap Version)
|
ユーザー |
|
提出日時 | 2022-09-17 21:59:14 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 528 bytes |
コンパイル時間 | 335 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 64,640 KB |
最終ジャッジ日時 | 2024-12-22 00:59:31 |
合計ジャッジ時間 | 3,927 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 25 WA * 12 |
ソースコード
N = int(input()) NN = N * 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)