question_id
stringlengths
6
6
content
stringlengths
1
27.2k
p00923
<H1><font color="#000">Problem J: </font><span>C(O|W|A*RD*|S)* CROSSWORD</span> Puzzle</H1> <p> The first crossword puzzle was published on December 21, 1913 by Arthur Wynne. To celebrate the centennial of his great-great-grandfather's invention, John "Coward" Wynne<sup>1</sup> was struggling to make crossword puzzl...
p00470
<H1>通勀経路 </H1> <h2>問題</h2> <p> JOIさんが䜏むカナダのある郜垂は南北方向にたっすぐに䌞びる w 本の道路ず東西方向にたっすぐに䌞びる h 本の道路により碁盀の目の圢に区分けされおいる </p> <p> 南北方向の w 本の道路には西から順に 1, 2, ... , w の番号が付けられおいるたた東西方向の h 本の道路には南から順に 1, 2, ... , h の番号が付けられおいる西から i 番目の南北方向の道路ず南から j 番目の東西方向の道路が亀わる亀差点を (i, j) で衚す </p> <p> JOIさんは亀差点 (1, 1) の近くに䜏んでおり亀差点 ...
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>...
p00535
<h2>砂の城 (Sandcastle)</h2> <h2> 問題</h2> <p> JOI 君は家族ずずもに海氎济に来たさんざん泳いで泳ぎ疲れた JOI 君は次は砂浜で砂の城を䜜っお遊んだしばらくしお砂遊びにも飜きるずJOI 君は城を攟眮しおたた海に泳ぎに向かった </p> <p> JOI 君が䜜った城は砂浜のうちのある長方圢の領域に含たれおいるこの長方圢の領域は東西南北にマス目状に区切られおいる各マスはJOI 君が䜜った城の䞀郚であるマス (以䞋「城マス」ず呌ぶ) かそうでないマス (以䞋「曎地マス」ず呌ぶ) のいずれかであるそれぞれの城マスには「匷床」ず呌ばれる 1 以䞊 9 以䞋の敎...
p00165
<H1>宝くじ</H1> <p> ある囜の王様は玠数ずギャンブルが倧奜きです。この囜の通貚の単䜍はプラむムずいいたす。2007 幎 11 月 1 日珟圚のプラむムのクロス円レヌトは 9973 ずちょうど玠数になっおいたので、王様は倧喜びです。この囜では 1/101 プラむムを1サブプラむムずする補助貚幣が䜿われおいたす。 </p> <p> この囜の政府は、囜家財政の安定、囜民の嚯楜、王様の趣味を同時に満足させるこずを目的に宝くじ振興公瀟を蚭立し、宝くじ事業を始めるこずにしたした。玠数が倧奜きな王様は、玠数が話題になればそれだけで満足しお、賞金をあげたくなりたす。そこで振興公瀟は次のような宝くじを考えたした。 </p> <u...
p02158
<h1>Problem J: Rings</h1> <h2>Problem</h2> <p>ずある氎族通に䜏むむルカ君は、ゞャンプをしお$N$個のリングをくぐり抜けるずご耒矎がもらえたす。</p> <ul> <li>むルカ君は座暙$(0,0)$から飛び、$(T,0)$で着氎する。</li> <li>ゞャンプの軌道は攟物線である。</li> <li>$i$番目のリングは、ゞャンプの軌道が$(X_i,L_i)$ず$(X_i,H_i)$を結ぶ線分ず亀わるず、くぐり抜けたず刀定される。</li> <li>$1$回のゞャンプには初速ず同じだけの䜓力が必芁である。</li> </ul> <p>むルカ君は、必芁であれば䜕床でもゞャ...
p03319
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a sequence of length <var>N</var>: <var>A_1, A_2, ..., A_N</var>. Initially, this sequence is a permutation of <var>1, 2, ..., N</var>.</p> <p>On this sequence, Snuke can perform the following ...
p01324
<h1><font color="#000">Problem D:</font> 無矛盟な単䜍系</h1> <pre> 京、垓、{犟予}、穣、溝、柗、正、茉、極、恒河沙、阿僧祇、那由他、䞍可思議、無量倧数 分、厘、毛、糞、応、埮、繊、沙、塵、埃、枺、挠、暡糊、逡巡、須臟、瞬息、匟指、刹那、六埳、虚空、枅浄、阿頌耶、阿摩矅、涅槃寂静 </pre> <p>これらが䜕か分かるだろうか。これらは党お10の环乗に぀けられた数詞である。</p> <pre> 京 = 10<sup>16</sup>, 垓 = 10<sup>20</sup>, {犟予} = 10<sup>24</sup>, ç©£ = 10<sup>28</sup>, 溝 = ...
p03749
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Joisino has a bar of length <var>N</var>, which has <var>M</var> marks on it. The distance from the left end of the bar to the <var>i</var>-th mark is <var>X_i</var>.</p> <p>She will place several squa...
p01774
<h2>C: Digital Clock / デゞタル時蚈</h2> <h3>物語</h3> <p>あいずにゃんは最近颚邪を匕いおしたったあたりのだるさにベットから出られない蟛そうにしおいる姿もたたかわいい</p> <p>しかし暇で暇で仕方がないあいずにゃんは枕䞋にあるデゞタル時蚈で遊ぶ方法を考え぀いた䞋の図のようなデゞタル時蚈の光っおいる棒の本数を毎秒毎秒ただひたすらに数えるのである</p> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_HUPC2015_Digital"></img> <p>䜕時間かこの遊びを続けた頃...
p00866
<H1><font color="#000">Problem C:</font> Stopped Watches</H1> <p> In the middle of Tyrrhenian Sea, there is a small volcanic island called Chronus. The island is now uninhabited but it used to be a civilized island. Some historical records imply that the island was annihilated by an eruption of a volcano about 800 ye...
p03067
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are three houses on a number line: House <var>1</var>, <var>2</var> and <var>3</var>, with coordinates <var>A</var>, <var>B</var> and <var>C</var>, respectively. Print <code>Yes</code> if we pass ...
p03437
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given positive integers <var>X</var> and <var>Y</var>. If there exists a positive integer not greater than <var>10^{18}</var> that is a multiple of <var>X</var> but not a multiple of <var>Y</var...
p01959
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], skipTags: ["script","noscript","style","textarea","code"], processEscapes: true }}); </script> <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config...
p03964
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report shows the ratio of the current numbers of votes the two...
p02676
<span class="lang-en"> <p>Score: <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>We have a string <var>S</var> consisting of lowercase English letters.</p> <p>If the length of <var>S</var> is at most <var>K</var>, print <var>S</var> without change.</p> <p>If the length of <var>S</va...
p02226
<h2> test </h2> UnionFindバむナリ入力
p03821
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are an integer sequence <var>A_1,...,A_N</var> consisting of <var>N</var> terms, and <var>N</var> buttons. When the <var>i</var>-th <var>(1 ≩ i ≩ N)</var> button is pressed, the values of the <var...
p02733
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a chocolate bar partitioned into <var>H</var> horizontal rows and <var>W</var> vertical columns of squares.</p> <p>The square <var>(i, j)</var> at the <var>i</var>-th row from the top and the <v...
p02699
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>S</var> sheep and <var>W</var> wolves.</p> <p>If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.</p> <p>If the wolves will attack the she...
p02363
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <H1>All Pairs Shortest Path</H1> <br/> <H2>Input</H2> <p> An edge-weighted graph <var>G</var> (<var>V</var>, <var>E</var>). </p> <pre> |<var>V</var>| |<var>E</var>| <var>s<sub>0</sub></var> <var>t<sub>0</sub></var> <var>d<sub>0</sub></var> <var>s<sub>1</sub>...
p03122
<span class="lang-en"> <p>Score : <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><font color="red"><strong>Red bold fonts show the difference from C1.</strong></font></p> <p>There is an infinitely large triangular grid, as shown below. Each point with integer coordinates contains a...
p03088
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an integer <var>N</var>. Find the number of strings of length <var>N</var> that satisfy the following conditions, modulo <var>10^9+7</var>:</p> <ul> <li>The string does not contain charact...
p03572
<span class="lang-en"> <p>Score : <var>1800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Three men, A, B and C, are eating sushi together. Initially, there are <var>N</var> pieces of sushi, numbered <var>1</var> through <var>N</var>. Here, <var>N</var> is a multiple of <var>3</var>.</p> <p...
p00077
<H1>ランレングス</H1> <p> 文字列が連続した堎合、ある芏則で文字を眮き換え文字列を短くするこずができたす。たずえば、AAAA ずいう文字列の堎合、@4A ず衚珟すれば 1 文字分圧瞮されたす。この芏則で圧瞮された文字列を入力しおもずの文字列に埩元するプログラムを䜜成しおください。ただし、埩元した文字列に文字は出珟しないものずしたす。 </p> <p> たた、原文の文字列は英倧文字、英小文字、数字、蚘号であり 100 文字以内、連続する文字は 9 文字以内です。 </p> <H2>入力</H2> <p>耇数の文字列が䞎えられたす。行に぀の文字列が䞎えられたす。文字列の数は 50 を超えたせん。</p>...
p00427
<H1></H1> <p> 次のようなゲヌムを考える 1 から n たでの数が 1 ぀ず぀曞かれた n 枚のカヌドが k 組あるこれら kn 枚のカヌドをよくシャッフルよく切るこずしお k 枚ず぀の山を䜜り暪䞀列に䞊べるこのようにしおできる n 個の山の巊から i 番目のk 枚のカヌドの山を「山 i 」ず呌ぶこずにする </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_2006-yo-t5-fig_base"> </center> <br> <p> ゲヌムは山 1 から始める山の䞀番䞊のカヌド 1...
p01666
<h2>K - encode/decode</h2> <p> 以䞋の条件を党お満たす文字列Tの事を「良い」文字列ず呌ぶこずにする <ul> <li>TはABCDEFGHIの9皮類の文字列からなる</li> <li>T䞊の連続する文字は次のグラフ䞊でも隣接しおいる </ul> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_KUPC2013_graph"> <p>「良い」文字列の䟋</p> <ul> <li>BEB</li> <li>ABCDCBEFGHI</li> </ul> <p>「良い」文字列ではない䟋</p> <ul> <li>AC(...
p00974
<h3>What Goes Up Must Come Down</h3> <p> Several cards with numbers printed on them are lined up on the table. </p> <p> We'd like to change their order so that first some are in non-decreasing order of the numbers on them, and the rest are in non-increasing order. For example, (1, 2, 3, 2, 1), (1, 1, 3, 4, 5, 9, ...
p02949
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a directed graph with <var>N</var> vertices numbered <var>1</var> to <var>N</var> and <var>M</var> edges. The <var>i</var>-th edge is directed from Vertex <var>A_i</var> to Vertex <var>B_i</var...
p04034
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>We have <var>N</var> boxes, numbered <var>1</var> through <var>N</var>. At first, box <var>1</var> contains one red ball, and each of the other boxes contains one white ball.</p> <p>Snuke will perform the following <var>M</var> operations,...
p01236
<H1><font color="#000">Problem C:</font> Median Filter</H1> <p> The median filter is a nonlinear digital filter used to reduce noise in images, sounds, and other kinds of signals. It examines each sample of the input through a <i>window</i> and then emits the <i>median</i> of the samples in the win- dow. Roughly spea...
p01723
<p>むクタ君の䜏む町には<var>N</var>個の塔がある。 それぞれの塔には0から<var>N&minus;1</var>たでの異なる番号が䞎えられおおり、番号<var>i</var>の塔を塔<var>i</var>ず呌ぶ。 奜奇心旺盛なむクタ君は<var>N</var>個の塔の高さに興味を持ち、それらの倧小関係を衚す衚<var>T</var>を䜜るこずにした。 <var>T</var>は<var>N &times; N</var>個の芁玠を持ち、各芁玠<var>T<sub>i, j</sub> (0 &le; i, j &le; N &minus; 1)</var>は次のように定矩される。 </p> <ul> <li...
p00831
<H1><font color="#000">Problem E:</font> Confusing Login Names</H1> <p> Meikyokan University is very famous for its research and education in the area of computer science. This university has a computer center that has advanced and secure computing facilities including supercomputers and many personal computers conne...
p01373
<!-- begin en only --> <!--<h3><U>Divide the Cake</U></h3>--> <!-- end en only --> <!-- begin ja only --> <h3><U>ケヌキ分割問題</U></h3> <!-- end ja only --> <div> <!-- begin en only --> <p> English text is not available in this practice contest. </p> <!-- end en only --> <!-- begin ja only --> <p> むコずピコはACM博士によっお開発された人工知...
p01689
<h2>C - Dowsing Machine / ダりゞングマシヌン</h2> <h3>Story</h3> <p>䞖間ではXだずかYだずかで隒がしいけれど、これからの時代は&quot;D&quot;である。&quot;パクリンモンスタヌD&quot;は、秘密結瀟&quot;R団&quot;によっお開発された&quot;Dマシン&quot;を䜿っお&quot;Dのひず&quot;が財宝探玢を行う倧人気ゲヌムである。</p> <p>このゲヌムでは、栌子状マップのあるマスにいるDのひずが、隣接する䞊䞋巊右のマスぞの移動を繰り返し、財宝が存圚するマスぞの到達を目指す。 マップ䞊には財宝が存圚するマスが1぀だけある。 財宝が存圚す...
p00132
<h1>ゞグ゜ヌパズル</h1> <p> 子䟛から倧人たで脳トレ系パズルゲヌムが流行しおいたす。我々も遅れを取らぬよう、パズルゲヌムを䜜っおみんなで遊ぶこずにしたした。 </p> <p> 我々が考えたのはゞグ゜ヌパズルのゲヌムで、未完成の郚分を埋めるのに必芁なピヌスを遞ぶずいうものです。図 1 (a) はパズルの枠の䟋です。黒が埋たっおいる郚分、癜が未完成の郚分です。このパズルを完成するのに䜿えるピヌスが図 1 (b) のように䞎えられたす。この䞭から、枠の癜い郚分を埋めるこずができる黒いピヌスを 1 ぀以䞊遞択したす。䟋えば、図 2 の遞択䟋 1 のような組み合わせなら正解ずなりたす。䞀方、遞択䟋 2 のような組み合わ...
p00562
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>Soccer</h1> <p> You are a manager of a pr...
p00098
<H1>Maximum Sum Sequence II</H1> <p> 䞎えられた敎数の行列 </p> <pre> <var>a<sub>1,1</sub></var> <var>a<sub>1,2</sub></var> ... <var>a<sub>1,n</sub></var> <var>a<sub>2,1</sub></var> <var>a<sub>2,2</sub></var> ... <var>a<sub>2,n</sub></var> : <var>a<sub>n,1</sub></var> <var>a<sub>n,2</sub></var> ... <var>a<sub>n, n</sub></var...
p02230
UF with binary input (K = 100)
p02660
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Given is a positive integer <var>N</var>. Consider repeatedly applying the operation below on <var>N</var>:</p> <ul> <li>First, choose a positive integer <var>z</var> satisfying all of the conditions b...
p03972
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>On an <var>xy</var> plane, in an area satisfying <var>0 ≀ x ≀ W, 0 ≀ y ≀ H</var>, there is one house at each and every point where both <var>x</var> and <var>y</var> are integers.</p> <p>There are unpav...
p03421
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Determine if there exists a sequence obtained by permuting <var>1,2,...,N</var> that satisfies the following conditions:</p> <ul> <li>The length of its longest increasing subsequence is <var>A</var>.</l...
p03071
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are two buttons, one of size <var>A</var> and one of size <var>B</var>.</p> <p>When you press a button of size <var>X</var>, you get <var>X</var> coins and the size of that button decreases by <va...
p03564
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Square1001 has seen an electric bulletin board displaying the integer <var>1</var>. He can perform the following operations A and B to change this value:</p> <ul> <li>Operation A: The displayed value is...
p01559
<h1>MinimumCostPath</h1> <p>NxNの方県がある。 </p> <p><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE_mcp_grid" height="140px"><br> (N=3の堎合の図) </p> <p>隣接するマス目に移動するにはコストが1かかる。ただし、斜めに移動するこずは出来ない。 たた障害物があるマス目がM個あり、そのマスに入るこずは蚱されない。 マス(1, 1)からマス(N, N)に最小のコストで移動する方法は䜕通りあるか。 答えは倧きくなるこずがありうるので、1000000009(=10<sup>9</s...
p03134
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> Snukes lining up in a row. You are given a string <var>S</var> of length <var>N</var>. The <var>i</var>-th Snuke from the front has two red balls if the <var>i</var>-th character ...
p01109
<h3>Income Inequality</h3> <!-- end en only --> <!-- begin en only --> <p> We often compute the average as the first step in processing statistical data. Yes, the average is a good tendency measure of data, but it is not always the best. In some cases, the average may hinder the understanding of the data. </p> <p> ...
p00348
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>゜ヌト</H1> <p> 高校入孊埌、プログラミング郚に入郚したタケ子さんは...
p02375
<H1>Range Query on a Tree II</H1> <p> Write a program which manipulates a weighted rooted tree $T$ with the following operations: </p> <ul> <li>$add(v,w)$: add $w$ to all edges from the root to node $u$<br> <li>$getSum(u)$: report the sum of weights of all edges from the root to node $u$<br> </ul> <p> The give...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
p02725
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a circular pond with a perimeter of <var>K</var> meters, and <var>N</var> houses around them.</p> <p>The <var>i</var>-th house is built at a distance of <var>A_i</var> meters from the northmost...
p03837
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an undirected connected weighted graph with <var>N</var> vertices and <var>M</var> edges that contains neither self-loops nor double edges.<br/> The <var>i</var>-th <var>(1≀i≀M)</var> edge...
p01220
<H1><font color="#000">Problem E:</font> Triangles</H1> <p> There is a group that paints an emblem on the ground to invite aliens every year. You are a member of this group and you have to paint the emblem this year. </p> <p> The shape of the emblem is described as follows. It is made of <i>n</i> regular triangles wh...
p04022
<span class="lang-en"> <p>Score : <var>1100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke got positive integers <var>s_1,...,s_N</var> from his mother, as a birthday present. There may be duplicate elements.</p> <p>He will circle some of these <var>N</var> integers. Since he dislikes ...
p00962
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], skipTags: ["script","noscript","style","textarea","code"], processEscapes: true }}); </script> <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config...
p01670
<h2>D - Medical Inspection</h2> <h3>Problem Statement</h3> <p> The government has declared a state of emergency due to the MOFU syndrome epidemic in your country. Persons in the country suffer from MOFU syndrome and cannot get out of bed in the morning. You are a programmer working for the Department of Health. You...
p00431
<H1></H1> <p> 䞡端にリングの぀いた玐を考える.リングは正敎数が付いおいお,玐を区別する.玐の䞡端のリングには異なる数 <i>a</i>, <i>b</i> が付けられる.これを,[<i>a</i>, <i>b</i>] ず蚘述する.耇数の玐があり,䞀方の玐ず他方の玐のリングに付いおいる数が同じ堎合,そのリングのずころで,これらの玐を぀なげるこずができお,぀なげおできたものを鎖ず呌ぶこずにする.䟋えば,[1, 3] ず [3, 4] ずいう玐からは [1, 3, 4] ずいう鎖ができる.玐ず鎖や鎖同志も同じ敎数が付いおいるリングのずころで぀なげるこずができるものずする. </p> <p> 䟋えば,鎖 [1, 3...
p00061
<H1>Rank Checker</H1> <!-- <p> 時は2020 幎。パ゜コン甲子園 2020 の予遞結果を保存したデヌタがありたす。このデヌタには、各チヌムに振られる敎理番号ず正解数が保存されおいたす。参加者チヌム数は䞍明ですが、かなり倚い暡様です䞻催者のささやかな芁望でもありたす。正解数の倚いほうから順に 1 䜍、2 䜍 ... ず順䜍を぀けおいくこずずしたす。 </p> --> <p> 時は2020 幎。パ゜コン甲子園 2020 の予遞結果を保存したデヌタがありたす。このデヌタには、各チヌムに振られる敎理番号ず正解数が保存されおいたす。ここでは、正解数で順䜍を決定するものずし、正解数の倚いほうから順に ...
p02549
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> cells arranged in a row, numbered <var>1, 2, \ldots, N</var> from left to right.</p> <p>Tak lives in these cells and is currently on Cell <var>1</var>. He is trying to reach Cell ...
p00574
<h1>毒蛇の脱走(Snake Escaping)</h1> <p> JOI 研究所では<var>2^L</var> 匹の毒蛇を飌っおおりそれぞれ<var>0, 1, ..., 2^L - 1</var> の番号が付けられおいるすべおの毒蛇は頭から順に<var>L</var> 個の郚分に分かれおおりそれぞれの郚分は青たたは赀である毒蛇<var>i</var> に察し<var>i</var> を2進衚蚘しお<var>i =</var> $\sum_{k=1}^{L}$<var> c_k2^{L-k} (0 \leq c_k \leq 1)</var> ずおいたずき </p> <ul> <li> <var>c_k = ...
p02119
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h1>Problem I: Making Pairs</...
p00124
<h1>リヌグ戊のスコアシヌト</h1> <p> スポヌツの倧䌚にはリヌグ戊ずトヌナメント戊がありたす。サッカヌのリヌグ戊では勝・負・匕分にそれぞれ点数を付け、その勝ち点で順䜍を競いたす。勝ち点はそれぞれ勝(3点)、負(0点)、匕分(1点)です。 </p> <p> チヌム数ずリヌグ戊の成瞟を入力ずし、成瞟の良い順(勝ち点の倚い順)に䞊べ替え、チヌム名ず勝ち点を出力するプログラムを䜜成しおください。勝ち点が同点の堎合は入力順に出力しおください。 </p> <H2>Input</H2> <p> 耇数のデヌタセットが䞎えられたす。各デヌタセットは以䞋の圢匏で䞎えられたす。 </p> <pre> <var>n</var...
p01365
<H1><font color="#000">Problem G:</font> Camera Control</H1> <p> "ACM48" is one of the most popular dance vocal units in Japan. In this winter, ACM48 is planning a world concert tour. You joined the tour as a camera engineer. </p> <p> Your role is to develop software which controls the camera on a stage. For simplic...
p03358
<span class="lang-en"> <p>Score : <var>800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a tree with <var>N</var> vertices numbered <var>1</var> through <var>N</var>. The <var>i</var>-th edge connects Vertex <var>x_i</var> and <var>y_i</var>. Each vertex is painted white or black. ...
p00827
<H1><font color="#000">Problem A:</font> The Balance</H1> <p> Ms. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine. </p> <p> For example, to measure 200mg of aspirin using 300mg weights and 700mg weights, she can put one 700mg weight on the side of the medicine and three 3...
p01735
<p> Fox Ciel is developing an artificial intelligence (AI) for a game. This game is described as a game tree T with n vertices. Each node in the game has an evaluation value which shows how good a situation is. This value is the same as maximum value of child nodes’ values multiplied by -1. Values on leaf nodes are ev...
p03708
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Nukes has an integer that can be represented as the bitwise OR of one or more integers between <var>A</var> and <var>B</var> (inclusive). How many possible candidates of the value of Nukes's integer the...
p03026
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a tree with <var>N</var> vertices <var>1,2,\ldots,N</var>, and positive integers <var>c_1,c_2,\ldots,c_N</var>. The <var>i</var>-th edge in the tree <var>(1 \leq i \leq N-1)</var> connects...
p03476
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We say that a odd number <var>N</var> is <em>similar to 2017</em> when both <var>N</var> and <var>(N+1)/2</var> are prime.</p> <p>You are given <var>Q</var> queries.</p> <p>In the <var>i</var>-th query,...
p02637
<span class="lang-en"> <p>Score : <var>1500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are an integer <var>K</var> and integers <var>a_1,\dots, a_K</var>. Determine whether a sequence <var>P</var> satisfying below exists. If it exists, find the lexicographically smallest such seque...
p03925
<span class="lang-en"> <p>Score : <var>1300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a graph with <var>N</var> vertices, numbered <var>0</var> through <var>N-1</var>. Edges are yet to be added.</p> <p>We will process <var>Q</var> queries to add edges. In the <var>i</var>-th <va...
p01918
<link rel="stylesheet" href="css/description.css" type="text/css" /> <script language="JavaScript" type="text/javascript" src="js/varmath2017.js" charset="UTF-8"></script> <h2>C: 今川焌きマン - Imagawayaki Man -</h2> <h3>物語</h3> <p>今川焌きマンは、正矩のヒヌロヌである。顔は盎埄 <var>1</var> メヌトルの今川焌き䞻に小麊粉でできた生地の䞭にたっぷりず逡を詰めお焌いた食べ物であり、芋た目は円圢で...
p02267
<H1>Search I</H1> <p> You are given a sequence of <i>n</i> integers S and a sequence of different <i>q</i> integers T. Write a program which outputs C, the number of integers in T which are also in the set S. </p> <H2>Input</H2> <p> In the first line <i>n</i> is given. In the second line, <i>n</i> integers are give...
p02288
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Maximum Heap</h1> <p> A ...
p02772
<span class="lang-en"> <p>Score: <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>You are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.</p> <p...
p03860
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is going to open a contest named "AtCoder <var>s</var> Contest". Here, <var>s</var> is a string of length <var>1</var> or greater, where the first character is an uppercase English letter, and the...
p02322
<h1>Knapsack Problem with Limitations II</h1> <p>You have $N$ items that you want to put them into a knapsack. Item $i$ has value $v_i$, weight $w_i$ and limitation $m_i$.</p> <p>You want to find a subset of items to put such that:</p> <ul> <li>The total value of the items is as large as possible.</li> <li>The it...
p03499
<span class="lang-en"> <p>Score : <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a rooted tree with <var>N+1</var> vertices. The vertices are numbered <var>0</var> through <var>N</var>, and Vertex <var>0</var> is the root of the tree. The parent of Vertex <var>i</var> <va...
p03163
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> items, numbered <var>1, 2, \ldots, N</var>. For each <var>i</var> (<var>1 \leq i \leq N</var>), Item <var>i</var> has a weight of <var>w_i</var> and a value of <var>v_i</var>.</p>...
p03533
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a string <var>S</var>.</p> <p>Takahashi can insert the character <code>A</code> at any position in this string any number of times.</p> <p>Can he change <var>S</var> into <code>AKIHABARA</...
p00036
<H1>平面䞊の図圢</H1> <p> 瞊 8、暪 8 のマスからなる図 1 のような平面がありたす。 <br> <center> <table cellspacing=0 cellpadding=0> <tr><td>□</td><td>□</td><td>□</td><td>□</td><td>□</td><td>□</td><td>□</td><td>□</td></tr> <tr><td>□</td><td>□</td><td>□</td><td>□</td><td>□</td><td>□</td><td>□</td><td>□</td></tr> <tr><td>□</td><td>□</td><td>□</td>...
p00466
<H1>レシヌト </H1> <h2>問題</h2> <p> 倪郎君は10冊の本を賌入した 埌日 レシヌトをもずに䟡栌を調べようずしたが レシヌトには汚れがあり ある本の䟡栌が読み取れなかった その本の䟡栌を 10冊の総額ず他の9冊の䟡栌から蚈算するこずにした </p> <p> 䟡栌が読み取れなかった本の䟡栌を出力するプログラムを曞け なお本の䟡栌はすべお正の敎数である たた消費皎を考慮する必芁はない </p> <h2> 入力</h2> <p> 入力は耇数のデヌタセットからなる各デヌタセットは以䞋の圢匏で䞎えられる </p> <p> 各デヌタセットは10行からなり1行に1぀ず぀正の敎数...
p02908
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has permutations <var>(P_0,P_1,\cdots,P_{N-1})</var> and <var>(Q_0,Q_1,\cdots,Q_{N-1})</var> of <var>(0,1,\cdots,N-1)</var>.</p> <p>Now, he will make new permutations <var>A</var> and <var>B</var...
p00935
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> </script> <h2>Problem A Decimal Sequences</h...
p01627
<h1>Problem A: 青春18きっぷ 2013</h1> <h2>Problem Statement</h2> <p> 䌚接合宿に参加予定の高槻さんは、家が貧乏であたりお金を持っおいない。そのため、青春18きっぷを䜿甚しお、お金を節玄しようずしおいる。18きっぷは、これ1枚だけで、鈍行列車ならば1日䞭乗り攟題、改札の出入りも自由ずいう優れものである詳しい利甚ルヌルに぀いおは省略。 </p> <p> 18きっぷの魅力は、乗り換えを行う駅で、空いおいる時間を䜿っお、ご圓地のお土産等を芋おたわれる点である。圌女は、せっかくの機䌚なので、旅の途䞭でいろいろな駅を芋お回りたいず考えおいる。ただし、次の電車に乗り遅れおは困る...
p01277
<H1><font color="#000">Problem E:</font> Symmetry</H1> <p> Open Binary and Object Group organizes a programming contest every year. Mr. Hex belongs to this group and joins the judge team of the contest. This year, he created a geometric problem with its solution for the contest. The problem required a set of points f...
p00870
<H1><font color="#000">Problem G:</font> Search of Concatenated Strings</H1> <p> The amount of information on the World Wide Web is growing quite rapidly. In this information explosion age, we must survive by accessing only the Web pages containing information relevant to our own needs. One of the key technologies fo...
p01762
<h1>C : Pruning / 枝刈り</h1> <h1>Problem</h1> <p>ずにかくあ぀い。あづい君の䜏んでいる地域は今幎猛暑であった。 さらに、家の庭には 1 本の朚が生えおおり、毎日やかたしく鳎く蝉が暑さを増幅させおいるような気がする。</p> <p>庭の朚は、たさにグラフ理論でいうずころの朚のような圢をしおおり、この朚にはたくさんの蝉が止たっおいる。 蝉は、必ず枝の先端(葉)たたは枝の分かれ目(頂点)に止たる習性がある。 ただし、朚の根には 1 匹も止たるこずはない。 この朚のある枝(蟺)を切るず、それより空偎(根ず反察偎)にいる蝉を党お駆陀するこずができる。 ただし、枝を切るためには、その枝に応じた...
p01298
<H1><font color="#000">Problem F:</font> Water Tank</H1> <p> You built an apartment. The apartment has a water tank with a capacity of <i>L</i> in order to store water for the residents. The tank works as a buffer between the water company and the residents. </p> <p> It is required to keep the tank "not empty" at le...
p01332
<h1><font color="#000">Problem L:</font> Problem L: 3぀のシル゚ット</h1> <p>JAVA(Japan Aerospace Voyage Agency: 日本宇宙飛行研究機構)は、宇宙開発事業の䞀環ずしお2003幎に探査機を打ち䞊げた。 この探査機打ち䞊げの目的の䞀぀に、小惑星むシカワに接近し、その衚面物質のサンプルを採集するこずがある。 様々なアクシデントに芋舞われながらも、探査機はむシカワに到達し、そしお぀いに2010幎、地球ぞ垰還し、むシカワのサンプル詊料の入ったカプセルを回収するこずに成功した。</p> <p>東京倧孊を卒業し、JAVAに就職したきたたさ君は、こ...
p00173
<H1>お化け屋敷</H1> <p> 䌚接孊園高等孊校では、毎幎孊園祭をおこなっおいたす。その䞭でも䞀番人気はお化け屋敷です。䞀番人気の理由は、お化け屋敷をおこなうクラスが 1クラスや 2クラスではなく、9クラスがお化け屋敷をおこなうこずです。それぞれが工倫するこずより、それぞれが個性的なお化け屋敷になっおいたす。そのため、最近では近隣から倚くの来堎者が蚪れたす。 </p> <p> そこで、孊園祭実行委員䌚では、お化け屋敷の入堎料金を䞋衚のように校内で統䞀し、これにもずづき各クラスごずに入堎者総数ず収入の集蚈をおこなうこずにしたした。 </p> <p> 入堎料金衚(入堎者 1人あたりの入堎料) </p> <pre> ...
p00489
<H1>サッカヌ (Soccer) </H1> <h2> 問題</h2> <p> JOI 囜ではサッカヌが人気でありJOI リヌグずいうリヌグ戊が毎週行われおいる </p> <p> JOI リヌグには N 個のチヌムが所属しおいお1 から N たでの番号が぀けられおいるすべおの組み合わせの詊合がちょうど䞀床ず぀行われる぀たり <nobr>N × (N - 1) / 2</nobr> 詊合が行われる各詊合の勝敗はそれぞれのチヌムの埗点で決たる勝ったチヌムの勝ち点は 3 点であり負けたチヌムの勝ち点は 0 点である匕き分けの堎合䞡チヌムの勝ち点は 1 点である順䜍は各チヌムの獲埗した勝ち...
p00523
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1> バヌムクヌヘン(Baumkuchen) </H1...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
p02709
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> children standing in a line from left to right. The activeness of the <var>i</var>-th child from the left is <var>A_i</var>.</p> <p>You can rearrange these children just one time ...
p01826
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> </script> <h2>Problem I: Live Programming </...
p00364
<H1>Bange Hills Tower</H1> <p> A project is underway to build a new viewing tower in Bange town called “Bange Hills Tower” whose selling point will be the gorgeous view of the entire main keep of Wakamatsu Castle from top to bottom. Therefore, the view line from the top of the tower must reach the bottom of the keep w...
p02359
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>The Maximum Number of Customers</H1> <p> ...
p03118
<span class="lang-en"> <p>Score : <var>2718</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a very long bench. The bench is divided into <var>M</var> sections, where <var>M</var> is a very large integer.</p> <p>Initially, the bench is vacant. Then, <var>M</var> people come to the ben...
p01125
<h1>Mysterious Gems</h1> <p> 宇宙暊 1603〜1867 幎人々はその時代のこずを EDO 時代ず呌ぶEDO ずは圓時最先端の宇宙航行技術Enhanced Driving Operation のこずであり、1603 幎に Dr.Izy によっお開発された </p> <p> あなたは宇宙冒険家であり宇宙を飛び回っお様々な惑星を冒険しおいたその冒険の途䞭であなたはずおも䞍思議な惑星を発芋したその惑星には至るずころに䞃色に茝く䞍思議な宝石が萜ちおいたあなたはその惑星ぞの降䞋を詊みようず考えたが重倧な問題のためにそれは䞍可胜であるこずがわかったその惑星の空気には人間が觊れただけで...