結果

問題 No.3757 Happy End
コンテスト
ユーザー 昼のご飯
提出日時 2026-10-09 21:26:41
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 1,376 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 255 ms
コンパイル使用メモリ 81,260 KB
実行使用メモリ 80,452 KB
最終ジャッジ日時 2026-10-09 21:26:53
合計ジャッジ時間 5,101 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 47
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from collections.abc import Iterable
from fractions import Fraction
from functools import cache
from heapq import heappop, heappush
from itertools import (
    combinations,
    combinations_with_replacement,
    groupby,
    permutations,
    product,
    repeat,
    chain,
)
import io
import math
import string
import sys
import time
import operator

# ===== 設定・制限解除 =====
# fmt: off
sys.setrecursionlimit(2 * 10**6)
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
input = sys.stdin.readline
def print(*args, sep=" ", end="\n"):
    sys.stdout.write(sep.join(map(str, args)) + end)
# fmt: on

# ===== 定数・リスト =====
LOW = list(string.ascii_lowercase)  # 小文字 a-z の文字列リスト
UPP = list(string.ascii_uppercase)  # 大文字 A-Z の文字列リスト
NUM = list(string.digits)  # 数字 0-9 の文字列リスト
INF = float("inf")
# MOD = 998244353
# MOD = 10**9 + 7
DIR4 = [(0, 1), (0, -1), (1, 0), (-1, 0)]
DIR8 = [(-1, 1), (0, 1), (1, 1), (-1, 0), (1, 0), (-1, -1), (0, -1), (1, -1)]
DIR9 = DIR8 + [(0, 0)]
flag, ans, cnt = False, 5, 0

# ===== Go Writing =====
N = int(input())
S = input()
A = "HAPPY"
S[:-5].replace(A, ",")
ans += S.count(",")

for i in range(1, 6):
    if S[-1 * i] == A[i - 1]:
        ans -= 1
0