結果
| 問題 |
No.2073 Concon Substrings (Swap Version)
|
| コンテスト | |
| ユーザー |
sapphire__15
|
| 提出日時 | 2022-08-25 14:35:20 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 526 bytes |
| コンパイル時間 | 116 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 44,456 KB |
| 最終ジャッジ日時 | 2024-12-21 17:55:41 |
| 合計ジャッジ時間 | 30,034 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 31 WA * 6 |
ソースコード
from collections import defaultdict
from functools import reduce
from numpy import roll
def main():
N = int(input())
S = input()
CON = "con"
buff = [defaultdict(lambda: 0) for _ in range(3)]
for i, j in enumerate(S):
buff[i%3][j] += 1
cnt = [reduce(min,
map(lambda x, y: x[y],
roll(buff, i), CON))
for i in range(3)]
if cnt == N:
print(N)
else:
print(min(sum(cnt), N-1))
if __name__ == '__main__':
main()
sapphire__15