2017-03-14から1日間の記事一覧

Codeforces #403 C. Andryusha and Colored Balloons

方針 解けなかったので他の人の解答をみた。 #include <iostream> #include <vector> #include <set> using namespace std; set<int> c[200010]; vector<int> g[200010], p(200010, 0), a(200010, 0); void dfs(int cur, int pre) { if(pre != -1) { while(c[pre].count(p[pre])) p[pre]++; a[</int></int></set></vector></iostream>…

AGC011_B Colorful Creatures

方針 昇順にソートして、それぞれの累積和を計算しておく。すると、i番目の生き物が他のすべての生き物と合体するためには、0<=i<=n-2について(0から始まるインデックス基準)、(i番目の累積和)*2 >= (i+1番目の生物の大きさ)を満たしている必要がある。逆…

AGC011_A Airport Bus

方針 やるだけなのにやけに時間がかかった。自分はアルゴリズム云々の前に、こういう基本的なプログラムの挙動に対する直感がかけているのかも? #include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; int main() { ll n, c, k; cin ></algorithm></vector></iostream>…