結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
84,100 KB
testcase_01 AC 131 ms
84,100 KB
testcase_02 AC 129 ms
84,100 KB
testcase_03 AC 131 ms
84,096 KB
testcase_04 AC 132 ms
84,096 KB
testcase_05 AC 205 ms
117,828 KB
testcase_06 AC 206 ms
117,828 KB
testcase_07 AC 132 ms
84,104 KB
testcase_08 AC 176 ms
94,880 KB
testcase_09 AC 196 ms
111,032 KB
testcase_10 AC 218 ms
117,828 KB
testcase_11 AC 217 ms
117,828 KB
testcase_12 AC 131 ms
84,100 KB
testcase_13 AC 166 ms
89,056 KB
testcase_14 AC 211 ms
113,408 KB
testcase_15 AC 176 ms
91,412 KB
testcase_16 AC 169 ms
99,172 KB
testcase_17 AC 130 ms
84,096 KB
testcase_18 AC 150 ms
88,912 KB
testcase_19 AC 171 ms
98,728 KB
testcase_20 AC 163 ms
95,708 KB
testcase_21 AC 161 ms
94,496 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 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
権限があれば一括ダウンロードができます

ソースコード

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の数数えて
    それの最小のやつ
    '''
    
    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
    
    print(min(c0,o1,n2)+min(o0,n1,c2)+min(n0,c1,o2))
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0