0w1

Entries from 2016-03-09 to 1 day

ABC 17 C - ハイスコア ( Imosu or Segment Tree )

C: ハイスコア - AtCoder Beginner Contest 017 | AtCoder Basically we would like to find the element that is covered with the least cost. It is intuitive to use segment tree, but actually we could use imosu algorithm to maintain the differen…

ABC 15 D - 高橋くんの苦悩 ( 01Knapsack DP )

D: 高橋くんの苦悩 - AtCoder Beginner Contest 015 | AtCoder ただのナップサック。一回しか使えないという条件があれば、枚挙の順序は逆にして同じものが複数回更新に使われないように注意すること。 #include <bits/stdc++.h> using namespace std; const int MAXW = 1e4</bits/stdc++.h>…

ABC 14 D - 閉路 ( Doubling LCA )

D: 閉路 - AtCoder Beginner Contest 014 | AtCoder A small practice for doubling LCA. #include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; const int MAXQ = 1e5 + 5; const int LGN = 20; // 2 ^ 19 > 1e5 int n; vector<int> G[ MAXN ]; // connects</int></bits/stdc++.h>…

ABC 14 C - AtColor ( Imosu + Discretization )

C: AtColor - AtCoder Beginner Contest 014 | AtCoder Problem Statement: Given n ranges [ a[ i ], b[ i ] ], find the maximum covered count of any point. We can use imosu algorithm, where we maintain the value of difference for two adjacent v…

ABC 13 D - 阿弥陀 ( Doubling )

D: 阿弥陀 - AtCoder Beginner Contest 013 | AtCoder Without the variable D, we can simulate the process by swapping the numbers where edges exist, since making an edge on the bottom is equivalent to swapping the index of the two lines. We c…