結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー buey_tbuey_t
提出日時 2023-03-15 17:25:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,340 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,640 KB
実行使用メモリ 117,828 KB
最終ジャッジ日時 2023-10-18 12:28:23
合計ジャッジ時間 8,485 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
84,104 KB
testcase_01 AC 133 ms
84,104 KB
testcase_02 AC 132 ms
84,100 KB
testcase_03 AC 132 ms
84,104 KB
testcase_04 AC 133 ms
84,104 KB
testcase_05 AC 206 ms
117,828 KB
testcase_06 AC 208 ms
117,828 KB
testcase_07 AC 131 ms
84,108 KB
testcase_08 AC 176 ms
95,184 KB
testcase_09 AC 194 ms
111,032 KB
testcase_10 AC 218 ms
117,828 KB
testcase_11 AC 219 ms
117,828 KB
testcase_12 AC 130 ms
84,104 KB
testcase_13 AC 167 ms
89,060 KB
testcase_14 AC 212 ms
113,408 KB
testcase_15 AC 179 ms
91,860 KB
testcase_16 AC 172 ms
99,112 KB
testcase_17 AC 132 ms
84,104 KB
testcase_18 AC 151 ms
88,920 KB
testcase_19 AC 170 ms
98,684 KB
testcase_20 AC 164 ms
95,708 KB
testcase_21 AC 162 ms
94,572 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 184 ms
107,404 KB
testcase_31 AC 161 ms
91,532 KB
testcase_32 AC 157 ms
89,152 KB
testcase_33 AC 158 ms
90,240 KB
testcase_34 AC 156 ms
89,992 KB
testcase_35 AC 166 ms
93,744 KB
testcase_36 AC 157 ms
90,408 KB
testcase_37 AC 163 ms
93,328 KB
testcase_38 AC 158 ms
89,996 KB
testcase_39 AC 178 ms
104,500 KB
testcase_40 AC 168 ms
93,548 KB
testcase_41 AC 180 ms
104,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    try:
        import pypyjit
        pypyjit.set_param('max_unroll_recursion=-1')
    except:
        pass
    try:
        import sys
        sys.setrecursionlimit(10**7)
    except:
        pass
    from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
    from heapq import heapify, heappop, heappush
    from bisect import bisect_left, bisect_right
    from copy import deepcopy
    import copy
    import random
    from collections import deque,Counter,defaultdict
    from itertools import permutations,combinations
    from decimal import Decimal,ROUND_HALF_UP
    #tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
    from functools import lru_cache, reduce
    #@lru_cache(maxsize=None)
    from operator import add,sub,mul,xor,and_,or_,itemgetter
    INF = 10**18
    mod1 = 10**9+7
    mod2 = 998244353
    
    #DecimalならPython
    
    
    '''
    これもスワップか
    3で割った余りみたいなのが大事そう
    回数の最小値はいらないから
    %3 = 0
    %3 = 1
    %3 = 2
    でc,o,nの数数えて
    それの最小のやつ
    
    concononc で落ちる
    猶予がないとダメって感じか
    '''
    
    N = int(input())
    S = list(input())
    
    c0 = 0
    o0 = 0
    n0 = 0
    for i in range(0,3*N,3):
        if S[i] == 'c':
            c0 += 1
        elif S[i] == 'o':
            o0 += 1
        elif S[i] == 'n':
            n0 += 1
    
    c1 = 0
    o1 = 0
    n1 = 0
    for i in range(1,3*N,3):
        if S[i] == 'c':
            c1 += 1
        elif S[i] == 'o':
            o1 += 1
        elif S[i] == 'n':
            n1 += 1
    
    c2 = 0
    o2 = 0
    n2 = 0
    for i in range(2,3*N,3):
        if S[i] == 'c':
            c2 += 1
        elif S[i] == 'o':
            o2 += 1
        elif S[i] == 'n':
            n2 += 1
    
    a = min(c0,o1,n2)
    b = min(o0,n1,c2)
    c = min(n0,c1,o2)
    
    ls = [a,b,c]
    ls.sort()
    if ls[0] == ls[1] == 0:
        print(ls[2])
    else:
        if (a+b+c)*3+2 > 3*N:
            print(a+b+c-1)
        else:
            print(a+b+c)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0