This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
#define MT make_tuple | |
void solve() { | |
int n; cin >> n; | |
vector<int> memo(n + 1, -1); | |
auto val = [&](int i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
using LL = long long int; | |
#define inc(i, n) for(int i = 0; i < (n); i++) | |
const int MOD = 1'000'000'007; | |
int b; | |
struct S { | |
vector<LL> v; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
【解説】ABC-189-F Sugoroku2 | |
注:本解説には計算誤差に関する説明はありません。 | |
《問題ページ》 | |
https://atcoder.jp/contests/abc189/tasks/abc189_f | |
《解説》 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
【解説】AtCoder Grand Contest 050 (Good Bye rng_58 Day 1) B問題「Three Coins」 | |
●問題 | |
https://atcoder.jp/contests/agc050/tasks/agc050_b | |
●解説 | |
コインの有無を反転する操作は「長さが3の区間」に対して行うことになっていますが、これは「長さが3の倍数の区間」だったとしても答えは変わらないので、そう読み替えます。すると、操作の対象となる区間は互いに交差しない(共通部分がない or 包含関係にある)と仮定しても良いことになります。これを踏まえて、次のような区間DPをします。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yukicoder No. 956 解説 | |
*問題文 | |
No.956 Number of Unbalanced - yukicoder | |
https://yukicoder.me/problems/no/956 | |
*解法 | |
数列 A に値 v が現れる個数を C(v) で表す。 | |
各 v ごとに、v が過半数となる連続部分列の個数を数える。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yukicoder No. 241 解説 | |
*問題文 | |
No.241 出席番号(1) - yukicoder | |
https://yukicoder.me/problems/no/241 | |
O(N) で解けることに言及している人が見当たらなかったので一応書いておきます。 | |
*解法 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yukicoder No. 915 解説 | |
・問題文 | |
No.915 Plus Or Multiple Operation - yukicoder | |
https://yukicoder.me/problems/no/915 | |
以下のような問題が解ければよい。 | |
初期値 0 の変数 x に対し、以下の2種類の操作が可能である。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yukicoder No. 878 解説 | |
・問題文 | |
No.878 Range High-Element Query - yukicoder | |
https://yukicoder.me/problems/no/878 | |
・記号 | |
next[i] := min{ k | k > i かつ a[k] > a[i] } | |
prev[i] := max{ k | k < i かつ a[k] > a[i] } | |
(ただし a[0] = a[N+1] = ∞ とする) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
とりあえず Kuin で何か書いてみたかったので、yuikcoder No. 568 (https://yukicoder.me/problems/no/568) を解くコードを書きました | |
解法自体は以前 C++ で書いたコード (https://yukicoder.me/submissions/204601) をほぼそのまま移植しただけです | |
一応すべてのテストケースが通ることをローカルで確認しました | |
} | |
var n: int | |
var m: int | |
var x: []int | |
var a: []int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*はじめに | |
本記事は AtCoder Grand Contest 013 の E 問題の解説です。 | |
問題文の閲覧やコードの提出はこちらから。 | |
E: Placing Squares - AtCoder Grand Contest 013 | AtCoder | |
http://agc013.contest.atcoder.jp/tasks/agc013_e | |
*執筆経緯 | |
公式の問題解説 PDF や解説放送で紹介されていたこの問題の想定解法が、 |
NewerOlder