torus711 のアレ

主に競技プログラミングの問題について書きます.PC 以外だと数式が表示されないかもしれないです

TopCoder

TopCoder, Single Round Match 654, Division 1, Level 1 : SquareScores

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13694&rd=16318 問題概要 文字列 について,その文字列の得点を次のように定める インデックスの対 であって,部分文字列 がただ一種類の文字から成るようなものの個数 今,文字列 が与え…

TopCoder, Single Round Match 654, Division 2, Level 1 : SquareScoresDiv2

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13700&rd=16318 問題概要 文字列 について,その文字列の得点を次のように定める インデックスの対 であって,部分文字列 がただ一種類の文字から成るようなものの個数 文字列 が与えられ…

グラフ]TopCoder, Single Round Match 654, Division 2, Level 2 : OneEntrance

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13698&rd=16318 問題概要 頂点数 の木が与えられる.木の情報はそれぞれ 要素からなる二つの配列 によって与えられ,各 に対し,辺 が存在することを表す.また,頂点 が一つ指定される.…

TopCoder, Single Round Match 653, Division 1, Level 1 : CountryGroupHard

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13688&rd=16317 問題概要 何人かの人が一列に並んでいる.人々は,出身が同じ人同士は連続した位置に座っていることが分かっている.それぞれの人に対し,「同じ出身の人は何人いるか」と…

TopCoder, Single Round Match 653, Division 1, Level 2 : Singing

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13680&rd=16317 問題概要 Alice と Bob は 2 人で歌を歌おうとしている.曲に出現し得る音階は の整数で(低い方から高い方へ)番号付けされている.Alice に出すことのできる音は区間 内…

TopCoder, Single Round Match 653, Division 2, Level 1 : CountryGroup

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13687&rd=16317 問題概要 何人かの人が一列に並んでいる.人々は,出身が同じ人同士は連続した位置に座っていることが分かっている.それぞれの人に対し,「同じ出身の人は何人いるか」と…

TopCoder, Single Round Match 653, Division 2, Level 2 : RockPaperScissorsMagicEasy

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13686&rd=16317 問題概要 Alice と Bob が複数回に渡ってじゃんけんをする.各ラウンドで,相手に勝利したプレイヤーが 1 ポイントを得る. 今,各ラウンドで Bob が出す手は分かっている…

TopCoder, Single Round Match 653, Divisino 2, Level 3 : SingingEasy

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13685&rd=16317 問題概要 Alice と Bob はある歌を歌おうとしている.今,歌に表れる音階を の整数で表す(値が音の高さを表す).また,歌おうとしている曲は配列 で表される. Alice と…

TopCoder, Single Round Match 652, Divisino 2, Level 1 : ValueOfString

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13678&rd=16316 問題概要 英小文字からなる文字列 が与えられる.また, 番目(1-based)のアルファベットに値 を割り当てる.各文字の値を などと表記する. 更に, の値を次のように定…

TopCoder, Single Round Match 652, Division 2, Level 2 : ThePermutationGameDiv2

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13679&rd=16316[ 問題概要 整数 が与えられる. の順列をランダムに 1 つ選び とする.また,関数 を次のように定義する. ; どの順列が として選ばれていても となる の内,最小のものを…

TopCoder, Single Round Match 652, Division 1, Level 1 : ThePermutationGame

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13229&rd=16316 問題概要 Division 2, Level 2 とほぼ同一.ただし,こちらは答えを として, を求める.

TopCoder, Single Round Match 650, Division 2, Level 3 : TheKingsRoadsDiv2

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13667&rd=16314 問題概要 正整数 と,頂点数・辺数が共に の無向グラフが与えられる.辺の情報は 2 つの配列 で与えられ,各 に対し,2 頂点 を結ぶ辺が存在する. このグラフから辺を 1 …

TopCoder, Single Round Match 650, Division 2, Level 1 : TaroJiroDividing

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13672&rd=16314 問題概要 2 つの正整数 のそれぞれに対し,次の操作を行う. 操作対象になった値を と書くことにすると, を紙に書き下す が奇数ならば,操作を終了する を で置き換える …

TopCoder, Single Round Match 650, Division 2, Level 2 : TaroFillingAStringDiv2

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13668&rd=16314 問題概要 'A', 'B', '?' からなる文字列 が与えられる.この文字列中の '?' を 'A' まては 'B' に(独立に)置き換えることを考える. 文字列の "ugliness"(醜さ)を,文…

TopCoder, Single Round Match 650, Division 1, Level 1 : TaroFillingAStringDiv1

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13669&rd=16314 問題概要 'A', 'B' の 2 種類の文字からなる, 文字の文字列を考える.今,文字列の長さ及びいくつかの位置の文字は決まっていて,各 に対して, 文字目の文字は である.…

TopCoder, Single Round Match 649, Division 2, Level 1 : DecipherabilityEasy

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13658&rd=16313 問題概要 2 つの文字列 が与えられる. から 1 文字を削除することで, を作ることができるか?

TopCoder, Single Round Match 649, Division 2, Level 2 : CartInSupermarketEasy

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13659&rd=16313 問題概要 一列に連結された 個のショッピングカートがある.次の 2 種類の操作を繰り返し適用して,全てのカートをできるだけ早く消し去りたい. それぞれの列を,より短…

TopCoder, Single Round Match 649, Division 2, Level 3 : XorSequenceEasy

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13657&rd=16313 問題概要 Division 1, Level 2 とほぼ同一. が直接与えられ, である点が異なる.

TopCoder, Single Round Match 649, Division 1, Level 1 : Decipherability

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13656&rd=16313 問題概要 文字列 と正整数 が与えられる. から 文字を削除して得られる文字列が与えられたとき,削除された文字の位置を一意に特定できるか否か,求めよ.

TopCoder, Sinle Round Match 649, Division 1, Level 2 : XorSequence

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13249&rd=16313 問題概要 整数列 と正整数 が与えられる.ここで, は 2 の冪乗であり, の要素は全て 未満である. 今,一つの整数 を選んで, の各要素を とのビットごとの排他的論理和…

TopCoder, Single Round Match 648, Division 2, Level 3 : ABC

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13645&rd=16312 問題概要 二つの正整数 が与えられる.次の条件を満たす文字列 を 1 つ求めよ.存在しない場合は空文字列で示せ. は 文字からなり, である. 整数の順序対 であって, …

TopCoder, Single Round Match 648, Division 2, Level 1 : KitayutaMart2

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13650&rd=16312 問題概要 ある店ではりんごを売っている.このりんごの値段は,買う個数を増やす毎に,1 つ目は ,2 つ目は ,3 つ目は というように値段が上がっていく.一般的に書くと…

TopCoder, Single Round Match 648, Division 2, Level 2 : Fragile2

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13648&rd=16312 問題概要 頂点の(連結とは限らない)単純無向グラフが与えられる.グラフは の文字の行列 として与えられる. が 'Y' のとき,2 頂点 を結ぶ辺が存在することを表し,'N'…

TopCoder, Single Round Match 648, Division 1, Level 1 : AB

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13642&rd=16312 問題概要 二つの正整数 が与えられる.次の条件を満たす文字列 を 1 つ求めよ.存在しない場合は空文字列で示せ. は 文字からなり, を構成する各文字は 'A' または 'B' …

TopCoder, Single Round Match 647, Division 2, Level 1 : PeacefulLine

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13632&rd=16279 問題概要 何人かの生徒を直線状に並べたい.生徒を並べたとき,隣り合う生徒の年齢が同じ場合,お喋りを初めてしまって迷惑になることが知られている. 今,並べたい生徒…

TopCoder, Single Round Match 647, Division 2, Level 2 : TravellingSalesmanEasy

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13631&rd=16279 問題概要 個の街があり,その内の幾つかの街に商品を売りに行く.商品の情報は 2 つの配列 で与えられ, 番の商品は,街 で売ることができて,そのときの利益が であるこ…

TopCoder, Single Round Match 647, Division 1, Level 1 : BuildingTowersEasy

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13634&rd=16279 問題概要 直線上に 個のビルを建てたい.ビルは,端から順に で番号付けられる.ビルの高さには制約があり,その内の 1 つは 要素の 2 つの配列 で説明される.高さの制約…

TopCoder, Single Round Match 647, Division 1, Level 2 : CtuRobots

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13595&rd=16279 問題概要 何体かのロボットが売られていて, 番のロボットの価格は ,燃料タンクの容量は である.購入時に燃料タンクは満タンの状態になっている.これらのロボットの内…

TopCoder, Single Round Match 646, Division 2, Level 1 : TheConsecutiveIntegersDivTwo

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13626&rd=16278 問題概要 整数の集合があり,その要素は配列 により与えられる.この集合に対し,ある 1 つの要素を選んでその値を 1 増やすまたは 1 減らす操作を任意回数できる. 整数 …

TopCoder, Single Round Match 646, Division 2, Level 2 : TheGridDivTwo

問題文 http://community.topcoder.com/stat?c=problem_statement&pm=13628&rd=16278 問題概要 今,無限に広い 2 次元空間の原点にいる.1 回の移動では 4 近傍(上下左右)のいずれかの方向に距離 1 移動することができる. 平面上のいくつかの座標はブロッ…