1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

緑によるABC394振り返り

Last updated at Posted at 2025-02-26

はじめに

投稿サボってごめんなさい(X使えるようになって浮かれてる)

ユーザ名 hidehico
コンテスト名 鹿島建設プログラミングコンテスト2025(AtCoder Beginner Contest 394)
順位 4264th / 12405
パフォーマンス 806
レーティング 933 → 920 (-13) :(

えーはい、回文の性質を完全に忘れていました
ABCDの早解きにも失敗してこのようなザマです

コンテスト中どうだったか

開始3秒

acc newを実行

開始54秒

AをAC

開始 2分22秒

BをAC

開始 16分

CをAC
問題文を誤読して時間をロスした

開始 30分

1ペナ食ってDをAC
こちらも、解法がなかなか思い浮ばず時間をロスした

時間が過ぎていく

回文がずっと頭をグルグルしたけど、結局EをACできず、コンテスト終了
こんな感じでした

使っているライブラリ

docstringを大幅に強化したぐらいです

そんじゃ一問ずつ感想書きますか

A問題

置き換えるか、個数の数だけ2をprint

後日vimでACした

ACコード(ライブラリ抜粋、vimもあります)

S = s()

print("2" * S.count("2"))
:%s/[^2]//g
ZZ

B問題

普通にソートした

ACコード(ライブラリ抜粋)

N = ii()
A = li(N, s)
L = []

for a in A:
    L.append((a, len(a)))

L.sort(key=lambda x: x[1])

for l in L:
    print(l[0], end="")

print()

C問題

WAは、ACとなるので、絶対に後ろ側にAは移動しないと言い換えられる
なので、逆順ループでACできた

ACコード(ライブラリ抜粋)

S = list(s())

for i in reversed(range(1, len(S))):
    if S[i] == "A" and S[i - 1] == "W":
        S[i] = "C"
        S[i - 1] = "A"

print("".join(S))

D問題

SortedSetと、DFSでACした
もうちょっと簡単なやり方がありそう

ACコード(ライブラリ抜粋)

S = s()
ans = len(S)
D = {"(": ")", "[": "]", "<": ">", ")": None, "]": None, ">": None}
nokori = SortedList([])

for i in range(len(S)):
    nokori.add(i)

L = []

for i in range(len(S) - 1):
    if D[S[i]] == S[i + 1]:
        L.append((i, i + 1))

while L:
    a, b = L.pop()
    ans -= 2
    na, nb = nokori.index(a) - 1, nokori.index(b) + 1

    if len(nokori) and na >= 0 and nb < len(nokori):
        na, nb = nokori[na], nokori[nb]

        if D[S[na]] == S[nb]:
            L.append((na, nb))

    nokori.discard(a)
    nokori.discard(b)

YN(ans == 0)

E問題

s + 回文 + sは回文という事に気づけなかったのが敗因

最後に

なんかひどかったですね(僕の結果が)
まあレートの被害はそこまでないし、まあいっか、ていうとこです

次回は頑張ります

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?