# ABC 32 C - 列 ( Crawling / log() / Segment Tree )

C: 列 - AtCoder Beginner Contest 032 | AtCoder Crawling. O( n ). #include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; const int MAXK = 1e9 + 9; typedef long long ll; int n, k; int s[ MAXN ]; void solve(){ if( count( s, s + n, 0 ) ){ pr</bits/stdc++.h>…

# ABC 27 D - ロボット ( Adhoc )

D: ロボット - AtCoder Beginner Contest 027 | AtCoder 各Mについて右、左のどちらにすすむかをいちいち決めるとやばい。そもそもそれを早くする方法もあまり考えられない。しかしよく考えると、右に移動と決めたら、移動しないと比べて全体的に 右にある +…

# ABC 29 D - 1 ( 桁DP )

D: 1 - AtCoder Beginner Contest 029 | AtCoder 桁DP は応用が利くなぁー（満足） #include <bits/stdc++.h> using namespace std; const int MAXN = 1e9 + 9; const int MAXP = 10; typedef unsigned long long ull; #define rep( i, a ) for(int i = 0; i < (int)( a ); </bits/stdc++.h>…

# ABC 27 C - 倍々ゲーム ( Game theory, Adhoc )

C: 倍々ゲーム - AtCoder Beginner Contest 027 | AtCoder abc027 from AtCoder Inc. www.slideshare.net ちょっと面白かった。説明はスライドの図を見た方がわかりやすい。こういったアプローチは幾つか選択肢木を描いて考察した方がでやすいですね。 #incl…

# ABC 22 D - Big Bang ( Geometry, Centroid )

http://abc022.contest.atcoder.jp/tasks/abc022_d Problem Statement: Given n ≤ 1e5 points in a 2D plane, it is then rotated, moved by the whole picture, and enlarged p times from its center. Find p. There are a few ways to solve this problem…

# ABC 22 C - Blue Bird ( Floyd Warshall )

C: Blue Bird - AtCoder Beginner Contest 022 | AtCoder Problem Statement: Given a graph of n ≤ 300 nodes and some edges, find the minimum weight sum of a cycle that starts from 1, goes to some other nodes and end in 1. Basically, we will be…

# ABC 9 D - 漸化式 ( Fast matrix multiplication + XOR / AND property )

D: 漸化式 - AtCoder Beginner Contest 009 | AtCoder I was surprised that this could be matrix multiplication as well. Abc009 from AtCoder Inc. www.slideshare.net According to the slides, when the operation has property of 0, commutative rul…

# ABC 23 D - 射撃王 ( Binary search )

D: 射撃王 - AtCoder Beginner Contest 023 | AtCoder Search for the minimum height that is possible. Judge by the deadline, which should be pre-calculated and sorted. #include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; const int MAXH = </bits/stdc++.h>…

# CFR 631 E. Product Sum ( Convex hull trick DP )

Problem - E - Codeforces pekempeyさんの記事と公式の editorialよりいい解釈はないと思うのでとりあえず。 pekempey.hatenablog.com Editorial Codeforces Round #344 (Div. 2) - Codeforces For this problem, we will consider convex hull trick. There…

# ABC 21 C - 正直者の高橋くん ( Dijkstra + DP )

C: 正直者の高橋くん - AtCoder Beginner Contest 021 | AtCoder 経路数の計算、dijkstra を一回やって disをたどりながら dpするだけだね。 #include <bits/stdc++.h> using namespace std; const int MAXN = 100 + 2; const int MAXM = 200 + 2; const int MOD = 1e9 + 7;</bits/stdc++.h>…