2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【競技プログラミング】AtCoder Beginner Contest 381問題_解法イメージ

Last updated at Posted at 2025-06-07

既存投稿一覧ページへのリンク

一覧ページ

雑記

最近、コーディングが出来なくなって来たので、AtCoderの感が鈍らないよう、Youtubeの解説動画見ながら解き方を確認。
夏が近づくと、めっちゃ忙しくなる・・・というより、今年ももう6月であることに驚きと絶望を感じてます。

C問題解法アプローチ

例1

//1/2221121/1222/2/122/1/211111/222
という文字列(長さ35)が与えられた場合
15708.png

/を区切りとして、連続する文字数をカウントする

15710.png

/を区切りとして、連続する文字数をカウントする

15710.png

条件を満たすように/の次に2が続く解答候補を見つける

15711.png

条件を満たすように/の次に2が続く解答候補を見つける

15711.png

候補の中から問題文の条件を満たす文字列を探し、最大長のものを解答とする。

15712.png

この方針でコーディングすれば解ける感じか。(TLEするかどうかは別として)

D問題解法アプローチ

求めるのは、下図のように1122数列の最大長
2N8GneIT2yihyd35.png

アプローチは、2つ飛びの尺取法

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?