結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー flygonflygon
提出日時 2022-09-16 22:45:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 78,100 KB
最終ジャッジ日時 2023-08-23 16:19:10
合計ジャッジ時間 5,876 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,188 KB
testcase_01 AC 68 ms
70,932 KB
testcase_02 AC 70 ms
71,392 KB
testcase_03 AC 69 ms
71,248 KB
testcase_04 AC 68 ms
71,516 KB
testcase_05 AC 89 ms
77,600 KB
testcase_06 AC 93 ms
77,736 KB
testcase_07 AC 67 ms
71,292 KB
testcase_08 AC 82 ms
77,072 KB
testcase_09 AC 84 ms
77,320 KB
testcase_10 AC 100 ms
77,668 KB
testcase_11 AC 98 ms
77,552 KB
testcase_12 AC 69 ms
71,452 KB
testcase_13 AC 80 ms
75,864 KB
testcase_14 AC 98 ms
77,204 KB
testcase_15 AC 84 ms
76,628 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 92 ms
77,472 KB
testcase_23 AC 66 ms
71,384 KB
testcase_24 AC 75 ms
75,916 KB
testcase_25 AC 86 ms
77,332 KB
testcase_26 AC 91 ms
77,496 KB
testcase_27 AC 67 ms
71,272 KB
testcase_28 AC 89 ms
77,080 KB
testcase_29 AC 79 ms
76,488 KB
testcase_30 AC 84 ms
77,244 KB
testcase_31 AC 81 ms
76,364 KB
testcase_32 AC 78 ms
75,948 KB
testcase_33 AC 76 ms
75,884 KB
testcase_34 AC 81 ms
76,256 KB
testcase_35 AC 88 ms
77,000 KB
testcase_36 AC 79 ms
76,056 KB
testcase_37 AC 83 ms
77,172 KB
testcase_38 AC 81 ms
75,976 KB
testcase_39 AC 86 ms
77,116 KB
testcase_40 AC 86 ms
76,948 KB
testcase_41 AC 89 ms
77,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
pos = [[0]*3 for i in range(3)]
for i,c in enumerate(s):
  if c == "c":
    pos[0][i%3] += 1
  elif c == "o":
    pos[1][i%3] += 1
  elif c == "n":
    pos[2][i%3] += 1

now = 0
ans = 0

for i in range(3):
  while now % 3 != i:
    now += 1
  
  cc,oo,nn = pos[0][(0+i)%3], pos[1][(1+i)%3], pos[2][(2+i)%3]
  mn = min(cc,oo,nn)
  now += mn * 3
  ans += mn
  while now >= 3*n:
    ans -= 1
    now -= 3 

print(ans)
0