はまやんはまやんはまやん

hamayanhamayan's blog

2017-11-01から1ヶ月間の記事一覧

Restoration of string [Codeforces Round #445 Div1 B]

http://codeforces.com/contest/889/problem/BN個の文字列がある。 この文字列に対して、以下の条件を満たす文字列を構築せよ。 全ての部分列について、出現回数を考える その中で出現回数が最大の部分文字列を全て集めると与えられた文字列を全て含む集合と…

Chef and Subarray Queries [CodeChef November Challenge 2017 F]

https://www.codechef.com/NOV17/problems/CSUBQN個の配列Aがあり、以下のクエリに答える。 「1 x y」 x番目の要素をyにする 「2 l r」 部分列[l,r]の中の任意の部分列の最大値が[L,R]である組み合わせ数を答える

Chef Hates Palindromes [CodeChef November Challenge 2017 D]

https://www.codechef.com/NOV17/problems/CHEFHPAL以下を満たす、N文字の文字列を構築する。 A種類の文字からなる(小さい方から順に使う) 回分である任意の部分文字列の長さが最小 回分である任意の部分文字列の長さの最小値と共に答えよ

Periodic Palindrome Construction [CodeChef November Challenge 2017 C]

https://www.codechef.com/NOV17/problems/PERPALIN以下の条件を満たす長さNの文字列を構築せよ。 無理なら"impossible" 'a'と'b'の両方の文字から成る(どちらかはダメ) 全体として回文である i番目と(i-P)番目の文字が等しい

Chef goes Left Right Left [CodeChef November Challenge 2017 B]

https://www.codechef.com/NOV17/problems/CLRLN人いる。i番目の人のレートはA[i]である。 最後の人は自分で、レートはRである。 N人で順番に二分探索のようなことをする。 i番目より大きいならば、左に。 小さいならば、右に移る。 矛盾するならNO,矛盾しな…

Villages and Tribes [CodeChef November Challenge 2017 A]

https://www.codechef.com/NOV17/problems/VILTRIBE N文字の'A','B','.'からナなる文字列がある。 AはAの領地、BはBの領地である。 それ以外は、Aに挟まれていればAの領地、Bに挟まれていればBの領地となる。 Aの総領地、Bの総領地数を答えよ。A..A..B...B -…

Petya and Catacombs [Codeforces Round #445 Div1 A]

http://codeforces.com/contest/889/problem/AN+1個の配列Tがある。 T[0] = 0で他は与えられている。 この時、以下の条件を満たす配列Aを構築する。 N + 1個の要素から成る 全てのiについて i あるiについてA[i] = A[j]を満たす最大のjがあるなら、T[i] = j…

ctypes objects containing pointers cannot be pickled とは

注意!この記事は題のエラーの意味を説明するだけで、実際の解決まで至っていない 症状 def test(x): print "Run " + str(x) if __name__ == '__main__': pool = Pool() res = pool.apply_async(test, (Solver(),)) res.wait() Solverクラスはこの検証器のPy…

Pythonのmultiprocessingでapply_asyncが動かない

症状 def test(x): print "Run " + str(x) if __name__ == '__main__': pool = Pool() res = pool.apply_async(test, (0)) res.wait() これを実行すると、test関数は実行されない。 解決法 res = pool.apply_async(test, (0)) を res = pool.apply_async(tes…

登山 [yukicoder No.595]

https://yukicoder.me/problems/no/595

ABS [AtCoder Regular Contest 085 D]

https://beta.atcoder.jp/contests/arc085/tasks/arc085_b

HSI [AtCoder Regular Contest 085 C]

https://beta.atcoder.jp/contests/arc085/tasks/arc085_a

壊れた宝物発見機 [yukicoder No.594]

https://yukicoder.me/problems/no/594

4進FizzBuzz [yukicoder No.593]

https://yukicoder.me/problems/no/593

括弧の対応 (2) [yukicoder No.592]

https://yukicoder.me/problems/no/592

Falling Leaves [CSAcademy #56 B]

https://csacademy.com/contest/round-56/task/falling-leaves/N枚の葉っぱがある。 i番目の葉っぱは、(X[i], Y[i])の座標にあり、毎秒S[i]の速さでy軸逆方向に落ちる。 猫は毎秒Cの速さで原点からx軸方向に移動する。 この時、t=[0,T-1]秒間待ってから出発…

Nested Segments [CSAcademy #56 A]

https://csacademy.com/contest/round-56/task/nested-segments/[L[i],R[i]]の区間がN個ある。 この内、最低1つでも他の区間にネストされている区間は何個あるか。区間iが区間jにネストされているのは、L[j]

Find Path Union [CSAcademy #56 D]

https://csacademy.com/contest/round-56/task/find-path-union/無限に続く完全二分木がある。 N個の数がある。 この数全てと頂点1を結ぶパスを着色する。 着色される辺は何本か。 ただし、TLとMLが少し厳しい

Find Edge List [CSAcademy #56 C]

https://csacademy.com/contest/round-56/task/find-edge-list/statement/N頂点M辺の無向グラフの隣接配列が与えられる。 このとき、隣接配列が与えられたものになるように辺の順番を適切に並べて答えよ。 rep(i,0,M) { int x, y; cin >> x >> y; E[x].push_…

Finite Encyclopedia of Integer Sequences [AtCoder Regular Contest 084 E]

https://beta.atcoder.jp/contests/arc084/tasks/arc084_c

Small Multiple [AtCoder Regular Contest 084 D]

https://beta.atcoder.jp/contests/arc084/tasks/arc084_b

Snuke Festival [AtCoder Regular Contest 084 C]

https://beta.atcoder.jp/contests/arc084/tasks/arc084_a

Around Square [AtCoder Beginner Contest 077 B]

https://beta.atcoder.jp/contests/abc077/tasks/abc077_b

Rotation [AtCoder Beginner Contest 077 A]

https://beta.atcoder.jp/contests/abc077/tasks/abc077_a

Counting Even [yukicoder No.589]

https://yukicoder.me/problems/no/589

空白と回文 [yukicoder No.588]

https://yukicoder.me/problems/no/588

七対子 [yukicoder No.587]

https://yukicoder.me/problems/no/587

ダブルブッキング [yukicoder No.586]

https://yukicoder.me/problems/no/586

Matrix Palindromes [CSAcademy #55]

https://csacademy.com/contest/round-55/task/matrix-palindromes/縦N,横Mのアルファベット小文字から成る行列がある。 最低何セル変更することで、以下の条件を満たすような行列が作れるか。 全ての行が回文 少なくともK個の列が回文 N,M≦10^5

Build the Fence [CSAcademy #55]

https://csacademy.com/contest/round-55/task/build-the-fence/N本の棒があり、長さがそれぞれ分かっている。 この棒を切ることで、K本の長さが同じ棒を用意する。 用意できる最長の長さは?N≦10^5 K≦10^14