結果

問題 No.2021 Not A but B
ユーザー U SU S
提出日時 2022-07-29 23:03:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,292 bytes
コンパイル時間 1,630 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 90,232 KB
最終ジャッジ日時 2023-09-26 22:38:08
合計ジャッジ時間 6,221 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
73,760 KB
testcase_01 AC 108 ms
73,776 KB
testcase_02 AC 105 ms
73,748 KB
testcase_03 AC 104 ms
73,852 KB
testcase_04 AC 104 ms
73,856 KB
testcase_05 AC 102 ms
73,776 KB
testcase_06 AC 103 ms
73,812 KB
testcase_07 AC 104 ms
73,804 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 135 ms
89,456 KB
testcase_28 AC 135 ms
89,500 KB
testcase_29 AC 135 ms
90,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys
# sys.setrecursionlimit(10**7)
# input = sys.stdin.readline
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
def mps(A):return [tuple(map(str, input().split())) for _ in range(A)]
def stoi(LIST):return list(map(int,LIST))
def itos(LIST):return list(map(str,LIST))
def atoi(LIST): return [ord(i)-ord("a") for i in LIST]
def Atoi(LIST): return [ord(i)-ord("A") for i in LIST]
def bitA(X,A):return X & 1<<A == 1<<A
import math
import bisect
import heapq
import time
from copy import copy as cc
from copy import deepcopy as dc
from itertools import accumulate, product
from collections import Counter, defaultdict, deque
def ceil(U,V):return (U+V-1)//V
def modf1(N,MOD):return (N-1)%MOD+1
inf = int(1e18)+20
mod = int(1e9+7)

n = int(input())
s = input()
ans = 0
if n == 2:
    print(1)
    exit()
if n == 3:
    u = set()
    u.add(s[0]+"BB")
    u.add("BB"+s[2])
    print(len(u))
    exit()
t = list("AA"+s+"A")
ans = 0
pre = list(t[:4])
for i in range(1,len(t)-3):
    u = t[i:i+4]
    u[1] = "B"
    u[2] = "B"
    # print(pre)
    # print(u)
    if pre[1:] != u[:3]:ans += 1
    pre = u
if "".join(t).count("BB") >= 1:a = "".join(t).count("BB")-1
else:a = 0
print(ans-a)


0