question_id
stringlengths
6
6
content
stringlengths
1
27.2k
p02066
<h2>G: トレジャーハンター (Treasure Hunter)</h2> <h3>問題</h3> <p>財宝の山が <var>N</var> 個あり、それぞれの山は <var>1</var> から <var>N</var> までで番号づけられている。<var>i</var> 番目の山には価値 <var>p_i</var> のお宝が眠っており、このお宝はその山に訪れた時点で得ることができる。一度お宝を得るとその山からはお宝がなくなってしまうので、お宝はそれぞれ一度しか得ることはできない。</p> <p>異なる山に移動するには必ず道を利用しなければならない。山と山の間には合計 <var>N-1</var> 本の道があり、<v...
p02088
<h2>A: Union Ball</h2> <h3>Problem Statement</h3> <p>There are <var>N</var> balls in a box. The <var>i</var>-th ball is labeled with a positive integer <var>A_i</var>.</p> <p>You can interact with balls in the box by taking actions under the following rules:</p> <ul> <li> If integers on balls in the box are all odd...
p02572
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are <var>N</var> integers <var>A_1,\ldots,A_N</var>.</p> <p>Find the sum of <var>A_i \times A_j</var> over all pairs <var>(i,j)</var> such that <var>1\leq i &lt; j \leq N</var>, modulo <var>(10^9+...
p02122
<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 L: RMQ 2</h1> <h...
p03699
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are taking a computer-based examination. The examination consists of <var>N</var> questions, and the score allocated to the <var>i</var>-th question is <var>s_i</var>. Your answer to each question w...
p03363
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have an integer sequence <var>A</var>, whose length is <var>N</var>.</p> <p>Find the number of the non-empty <strong>contiguous</strong> subsequences of <var>A</var> whose sums are <var>0</var>. Note...
p03733
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>In a public bath, there is a shower which emits water for <var>T</var> seconds when the switch is pushed.</p> <p>If the switch is pushed when the shower is already emitting water, from that moment it wi...
p02821
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi has come to a party as a special guest. There are <var>N</var> ordinary guests at the party. The <var>i</var>-th ordinary guest has a <em>power</em> of <var>A_i</var>.</p> <p>Takahashi has dec...
p03226
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a sequence of <var>N</var> integers: <var>A_1,A_2,...,A_N</var>.</p> <p>Find the number of permutations <var>p_1,p_2,...,p_N</var> of <var>1,2,...,N</var> that can be changed to <var>A_1,A...
p04019
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip. At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <...
p03676
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an integer sequence of length <var>n+1</var>, <var>a_1,a_2,...,a_{n+1}</var>, which consists of the <var>n</var> integers <var>1,...,n</var>. It is known that each of the <var>n</var> inte...
p02964
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a sequence of <var>N \times K</var> integers: <var>X=(X_0,X_1,\cdots,X_{N \times K-1})</var>. Its elements are represented by another sequence of <var>N</var> integers: <var>A=(A_0,A_1,\cdots,A_...
p00959
<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...
p02437
<h1>Priority Queue</h1> <p> Priority queue is a container of elements which the element with the highest priority should be extracted first. </p> <p> For $n$ priority queues $Q_i$ ($i = 0, 1, ..., n-1$) of integers, perform a sequence of the following operations. </p> <ul> <li>insert($t$, $x$): Insert $x$ to $...
p02067
<style type="text/css"> blockquote { font-family: Menlo, Monaco, "Courier New", monospace; display: block; margin: 10px 0 10px 30px; font-size: 16px; line-height: 18px; white-space: pre; white-space: pre-wrap; word-break: break-all; word-wrap: ...
p01562
<h1>Area Folding</h1> <p> You are given one polygonal line, which is a collection of line segments. Your task is to calculate the sum of areas enclosed by the polygonal line. </p> <p> A point is defined to be &quot;enclosed&quot; if and only if the point is unreachable without crossing at least one line segment from ...
p01098
<h3>Deciphering Characters</h3> <p> Image data which are left by a mysterious syndicate were discovered. You are requested to analyze the data. The syndicate members used characters invented independently. A binary image corresponds to one character written in black ink on white paper. </p> <p> Although you found...
p01132
<h1><font color="#000000">Problem B:</font> Make Purse Light</h1> <p> Mr. Bill は店で買い物をしている。 彼の財布にはいくらかの硬貨(10 円玉、50 円玉、100 円玉、500 円玉)が入っているが、彼は今この小銭をできるだけ消費しようとしている。 つまり、適切な枚数の硬貨によって品物の代金を払うことで、釣り銭を受け取った後における硬貨の合計枚数を最小にしようとしている。 </p> <p> 幸いなことに、この店の店員はとても律儀かつ親切であるため、釣り銭は常に最適な方法で渡される。 したがって、例えば 1 枚の 500 ...
p00373
<H1>Aerial Photos</H1> <p> Hideyo has come by two aerial photos of the same scale and orientation. You can see various types of buildings, but some areas are hidden by clouds. Apparently, they are of the same area, and the area covered by the second photograph falls entirely within the first. However, because they wer...
p00689
<h1> Spiral Footrace </h1> <p> Let us enjoy extraordinary footraces at an athletic field. Before starting the race, small flags representing checkpoints are set up at random on the field. Every runner has to pass all the checkpoints one by one in the spiral order specified below. The starting point is the southwest c...
p01831
<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>Line Gimmick</h2> <p> You are ...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
p00236
<H1>宇宙人のメッセージ</H1> <p> 宇宙人 Mr.X は地球への来星記念として、地球人に向けてのメッセージを残しました。 Mr.X がメッセージを残す場所に選んだのは古代遺跡として有名な"トロンコ遺跡"でした。 ここはいろいろな大きさの碁盤のマス目に、奇抜な石像が無造作に配置されている不思議な場所でした。 </p> <p> Mr.X は、メッセージとして、石像が置かれていない全てのマス目を一度だけ通る、単一の閉曲線を描きました。Mr.X はとても賢く、このような閉曲線を描くことが可能な碁盤であれば必ず閉曲線を描き、メッセージを残しました。しかし、石像の配置によっては、閉曲線を描くことが不可能な碁盤もあり、そ...
p03949
<span class="lang-en"> <p>Score : <var>800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a tree with <var>N</var> vertices. The vertices are numbered <var>1, 2, ..., N</var>. The <var>i</var>-th (<var>1 ≦ i ≦ N - 1</var>) edge connects the two vertices <var>A_i</var> and <var>B_i</v...
p01974
<h1>A: 鳩ノ巣原理</h1> <h2>問題</h2> <p> $N$ 個の相違なる自然数 $a_i$ が与えられる。与えられた自然数から相違なる自然数を選び、ペアを作ることにした。 作ることができるペアのうち、値の差が $N - 1$ の倍数であるペアを一つ出力せよ。 </p> <p> なお、そのようなペアは必ず存在する。 </p> <h2>制約</h2> <ul> <li>$2 \le N \le 1000$</li> <li>$1 \le a_i \le 1000$</li> <li>$a_i\neq a_j \ (i \neq j)$</li> </ul> <h2>入力:</h2> <p> $N$<br> $a...
p00666
<H1>Problem H: World domination</H1> <p> 世界征服を企む悪の組織、なんてものは、古今東西フィクションノンフィクションを問わず、いろんな所にいるものだが、一体彼らは何のために世界征服をしようとしたのだろうか。そんなことをふと考えてしまうのは、私もまた、世界征服を企てているからであった。私が世界征服を目論む理由はただ一つ、私がロボット工学の分野で世界一優秀であることを世界に示すためである。征服したあとの世界になど興味はない、そこらへんの犬にでもくれてやっても構わないのだ。 </p> <p> 誠に遺憾だが、それはつまり、私よりも優秀であるとされている研究者がいる、ということだ。その人物には心...
p01427
<script type="text/javascript" src="./varmath.js" charset="UTF-8"></script> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE_logo" width="400"><br> <i>〜魔女からこの世界を守るため<i>キュゥべえ</i>と共に戦う 5 人の魔法少女達の物語〜</i> </center> <h1>問題 A</h1> <h2>問題文</h2> 薔薇園の魔女 GERTRUD は幅 <var>W</var> メートル,高さ <var>H</var> メート...
p01077
<h1>Problem F: Curling Puzzle</h1> <h2>Problem</h2> <p> カーリングのストーンを移動させて、ゴールのマスにストーンをぴったり重ねるパズルゲームがある。詳しいルールは次のとおりである。 </p> <p> フィールドは<var>H</var>&times;<var>W</var>のマスからなり、はじめにいくつかのマスにストーンが置かれている。 ゴールのマスは1つだけ存在して、はじめからゴールのマスにストーンが置かれていることはない。 また、フィールドは外壁で囲まれており、途中でストーンがフィールドの外へ飛び出してしまうことはない。 </p> <p> プレイヤーは1手ごとにストーン...
p01759
<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> <p> 太郎君は Vongress と呼ばれるゲームが大好...
p03764
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>On a two-dimensional plane, there are <var>m</var> lines drawn parallel to the <var>x</var> axis, and <var>n</var> lines drawn parallel to the <var>y</var> axis. Among the lines parallel to the <var>x</...
p02876
<span class="lang-en"> <p>Score : <var>1100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have <var>N</var> balance beams numbered <var>1</var> to <var>N</var>. The length of each beam is <var>1</var> meters. Snuke walks on Beam <var>i</var> at a speed of <var>1/A_i</var> meters per seco...
p01309
<h1><font color="#000">Problem G:</font> 挨拶の多い本屋さん</h1> <p> なつめは大のねこ好きである。なつめはある日、いつも親しくしている野良ねこたちから、ねこたちが開いている不思議な本屋に行こうと誘われた。その本屋ではたくさんのねこの写真が載った本が売られていると聞き、なつめは喜んでついていくことにした。 </p> <p> なつめは知らなかったのだが、ねこたちに連れられていった本屋は全国にチェーン店を持つ有名店であった。その店ではしっかりとした店員用マニュアルが用意されており、どの店舗でも店員の行動が統一されている。以下はそのマニュアルからの抜粋である。 </p> <ol> ...
p03334
<span class="lang-en"> <p>Score : <var>800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set <var>S</var> of points in a coordinate plane is a <em>good set</em> when <var>S</var> satisfies both of the following c...
p02175
<h1>A: 不思議な植物</h1> <h2>問題</h2> <p> あるところに不思議な $X$ [cm] の植物が生えている. この植物は以下の不思議な性質を持っている. </p> <ul> <li> この植物に "nobiro" と声を掛けると, その植物は $A$ [cm] 成長する. </li> <li> この植物に "tidime" と声を掛けると, その植物は $B$ [cm] 成長する. </li> <li> この植物に "karero" と声をかけると, その植物は $0$ [cm] になる. </li> </ul> <p> ただし, この植...
p00148
<H1>キャンディーとクラス旗</H1> <p> 3年C組では、平成19年11月10日の体育祭で使用する「クラス旗」を、将来のクラス会の時にも使うことにしました。そこで「クラス旗」を保管する生徒を決めるために、先生が先日差し入れてくれた大量のキャンディーを使って次のようなゲームを行うことにしました。 </p> <ul> <li>各生徒は生徒番号の順に1個ずつキャンディーを取ります。</li> <li>一巡してもキャンディーが残っていたら、最初の生徒番号の人から順々にキャンディーを取り続けます。</li> <li>最後のキャンディーを取った人が「クラス旗」を保管する生徒になります。</li> </ul> <p> 3年C組の...
p00518
<H1>問題 4: 部活のスケジュール表 (Schedule) </H1> <br/> <h2>問題</h2> <p> IOI 高校のプログラミング部には,J 君と O 君と I 君の 3 人の部員がいる. プログラミング部では,部活のスケジュールを組もうとしている. </p> <p> 今,N 日間の活動のスケジュールを決めようとしている. 各活動日のスケジュールとして考えられるものは,各部員については活動に参加するかどうかの 2 通りがあり,部としては全部で 8 通りある. 部室の鍵はただ 1 つだけであり,最初は J 君が持っている. 各活動日には,その日の活動に参加する部員のうちのいずれか 1 人が鍵を持っている必要...
p02030
<h2>A: 情報検索 / Information Search</h2> <h3>問題</h3> <p>ポスティングリストとは、検索語と出現文書 ID の対応関係を持たせたリストである。例えば</p> <ul> <li>北海道: 1, 2, 4, 9</li> <li>観光: 1, 3, 4, 7</li> </ul> <p>などである。</p> <p>上記のポスティングリストから、and 検索をすると、ID 1, 4 の文書がヒットし、or 検索をすると、ID 1, 2, 3, 4, 7, 9 がヒットする。</p> <p>ここで and 検索とは「どちらのリストにも含まれる要素を列挙する」ことであり、 or 検索とは...
p02460
<h1>Map: Delete</h1> <p> For a dictionary $M$ that stores elements formed by a pair of a string key and an integer value, perform a sequence of the following operations. Note that <u>each key in $M$ must be unique</u>. </p> <ul> <li>insert($key$, $x$): Insert an element formed by a pair of $key$ and $x$ to $M$...
p03621
<span class="lang-en"> <p>Score : <var>1700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You have two strings <var>A = A_1 A_2 ... A_n</var> and <var>B = B_1 B_2 ... B_n</var> of the same length consisting of <var>0</var> and <var>1</var>. The number of <var>1</var>'s in <var>A</var> and <...
p02933
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You will be given an integer <var>a</var> and a string <var>s</var> consisting of lowercase English letters as input.</p> <p>Write a program that prints <var>s</var> if <var>a</var> is not less than <va...
p02899
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Takahashi is a teacher responsible for a class of <var>N</var> students.</p> <p>The students are given distinct student numbers from <var>1</var> to <var>N</var>.</p> <p>Today, all the students entered...
p03271
<span class="lang-en"> <p>Score : <var>1200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a permutation of <var>1,2,...,N</var>: <var>p_1,p_2,...,p_N</var>. Determine if the state where <var>p_i=i</var> for every <var>i</var> can be reached by performing the following operatio...
p01866
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>B: ハミン...
p00774
<h3>Chain Disappearance Puzzle</h3> <p> We are playing a puzzle. An upright board with <i>H</i> rows by 5 columns of cells, as shown in the figure below, is used in this puzzle. A stone engraved with a digit, one of 1 through 9, is placed in each of the cells. When three or more stones in horizontally adjacent cell...
p02749
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>We have a tree with <var>N</var> vertices. The vertices are numbered <var>1</var> to <var>N</var>, and the <var>i</var>-th edge connects Vertex <var>a_i</var> and Vertex <var>b_i</var>.</p> <p>Takahash...
p00324
<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> サイバースペースにあるアイヅ国はワカマツ国...
p02319
<H1>0-1 Knapsack Problem II</H1> <br/> <p> You have <var>N</var> items that you want to put them into a knapsack. Item <var>i</var> has value <var>v<sub>i</sub></var> and weight <var>w<sub>i</sub></var>. </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 lar...
p03158
<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> cards. The <var>i</var>-th card has an integer <var>A_i</var> written on it. For any two cards, the integers on those cards are different.</p> <p>Using these cards, Takahashi and ...
p01165
<H1><font color="#000">Problem C:</font> Disarmament of the Units</H1> <p> This is a story in a country far away. In this country, two armed groups, ACM and ICPC, have fought in the civil war for many years. However, today October 21, reconciliation was approved between them; they have marked a turning point in their...
p03508
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an undirected graph <var>G</var>. <var>G</var> has <var>N</var> vertices and <var>M</var> edges. The vertices are numbered from <var>1</var> through <var>N</var>, and the <var>i</var>-th e...
p01535
<h1> Markup language has Declined</h1> <h2> E: マークアップ言語は衰退しました</h2> <p> わたしたち人類がゆるやかな衰退を迎えて,はや数世紀. すでに地球は”ぷろぐらまー”のものだったりします. 平均身長170センチで7頭身,高い知能を持ち,こーでぃんぐが大好きなぷろぐらまーさんたち. わたしは,そんなぷろぐらまーさんと人との間を取り持つ重要な職,国際公務員の” えすいー ”となり,故郷のニブンキの里に帰ってきました. 祖父の年齢でも現役でできる仕事なのだから,さぞや楽なのだろうとこの職を選んだのですが…. </p> <p> ある日,ぷろぐらまーさんたちが渡してくれたのは,2...
p01020
<h1>Problem E: Lonely Adventurer</h1> <p> 13歳の誕生日の祝いに少年Gは父親と一緒に船旅に出ていた。しかし航海の途中、不運にも船が嵐に見舞われて船が転覆してしまう。彼が目を覚ますと、そこは無人島だった。冒険家の父親の影響もあり、彼はこの状況にひるむ事なく、無人島でサバイバル生活をすることを決意した。動物を倒して肉を焼いたり、木の実を採取することで食いつなぎ、大木の下で野宿をすることでなんとか生き延びることができた。しかし、どうやら最近島の様子がおかしいようだ。動物たちは皆奇妙な行動を取るし、これは何か悪い事の予兆なのかもしれない。早くこの島から脱出せねば。 </p> <p> とはい...
p01470
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], skipTags: ["script","noscript","style","textarea","code"], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?conf...
p01923
<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> <h3>JAG 模擬予選練習会</h3> <p>ACM-I...
p00631
<H1><font color="#000000">Problem 05:</font> Split Up!</H1> <p> 勇者ポン太とその親友同じく勇者ゴン太は、これから壮大な冒険へと出発するために、それぞれ仲間を求めてルイーダの酒場へやって来ました。酒場には、冒険に出たくてうずうずしている武闘家や僧侶、魔法使いがたくさん居ます。 </p> <p> 心やさしいゴン太はポン太を気遣い、「先に仲間を選んでいいよ。」と言いました。 </p> <p> 一方、ポン太もゴン太が心配でなりません。「いや、君が先に選んでいいよ。」と言い返しました。 </p> <p> お互い譲り合いが続き、ついにルイーダがこう提案しました。「じゃあ...
p00261
<H1>アカ・ベコと40人の盗賊</H1> <p> 40 人の盗賊から逃れようとしているアカ・ベコは、A 市の街中で道に迷ってしまった。アカ・ベコは新しいアジトがあるB 市に行きたいのだが地図を盗賊に盗まれてしまった。 </p> <p> 盗賊の一人であるコボー氏はアカ・ベコに同情し、気の毒に思っていた。そこで、密かにアカ・ベコに、「あなたがB 市に行くお手伝いをしたいが、仲間にばれない様にしなければならないので、直接道順を教えたいが教えることができない。しかし、あなたの質問には答えられる。」と伝言を送った。 </p> <p> コボー氏は、「○○という道順はどうか。」という質問をアカ・ベコから受け取ると、それがA 市からB...
p01889
<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>Compressed Formula</h2> <p> Y...
p02533
<h2>Problem 9999</h2> <p> これはテスト問題です。 This is test problem. Compute A + B. </p>
p02163
<h1>Problem B: How old are you</h1> <h2>Problem</h2> <p> 胡散臭いマジシャンがマジックを披露するようです。<br> <br> 「さて、1つの好きな整数を思い浮かべてください。」<br> あなたは、頭の中に自分の数え年を思い浮かべることにしました。<br> <br> マジシャンはクエリを $N$ 回投げてきました。<br> 各クエリは、以下のうちのどれかです。<br> </p> <ol type="1"> <li>「今思い浮かべている数に、 $x$ を掛けてください。」</li> <li>「今思い浮かべている数に、 $x$ を足してください。」</li> <li>「今思い浮かべ...
p03322
<span class="lang-en"> <p>Score : <var>1200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>In Takahashi's mind, there is always an integer sequence of length <var>2 \times 10^9 + 1</var>: <var>A = (A_{-10^9}, A_{-10^9 + 1}, ..., A_{10^9 - 1}, A_{10^9})</var> and an integer <var>P</var>.</p> ...
p03288
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>A programming competition site <em>AtCode</em> regularly holds programming contests.</p> <p>The next contest on AtCode is called ABC, which is rated for contestants with ratings less than <var>1200</var...
p02860
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are a positive integer <var>N</var> and a string <var>S</var> of length <var>N</var> consisting of lowercase English letters.</p> <p>Determine whether the string is a concatenation of two copies o...
p03772
<span class="lang-en"> <p>Score : <var>2000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke received an integer sequence <var>a</var> of length <var>2N-1</var>.</p> <p>He arbitrarily permuted the elements in <var>a</var>, then used it to construct a new integer sequence <var>b</var> of ...
p03267
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an integer <var>L</var>. Construct a directed graph that satisfies the conditions below. The graph may contain multiple edges between the same pair of vertices. It can be proved that such ...
p00918
<H1><font color="#000">Problem E: </font>Dragon's Cruller</H1> <p> Dragon's Cruller is a sliding puzzle on a torus. The torus surface is partitioned into nine squares as shown in its development in Figure E.1. Here, two squares with one of the sides on the development labeled with the same letter are adjacent to each...
p02925
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><var>N</var> players will participate in a tennis tournament. We will call them Player <var>1</var>, Player <var>2</var>, <var>\ldots</var>, Player <var>N</var>.</p> <p>The tournament is round-robin for...
p03637
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a sequence of length <var>N</var>, <var>a = (a_1, a_2, ..., a_N)</var>. Each <var>a_i</var> is a positive integer.</p> <p>Snuke's objective is to permute the element in <var>a</var> so that the ...
p02476
<h2>Remainder of Big Integers</h2> <p> Given two integers $A$ and $B$, compute the remainder of $\frac{A}{B}$. </p> <h3>Input</h3> <p> Two integers $A$ and $B$ separated by a space character are given in a line. </p> <h3>Output</h3> <p> Print the remainder in a line. </p> <h3>Constraints</h3> <ul> <li>$0...
p02026
<h2>L: スギ (Demon's Cedar)</h2> <p>月の瀬さんは悪魔らしいことをするため、街じゅうの樹木をスギの木に変えて、人々を花粉症で困らせることにした。</p> <p>樹木は $N$ 種類存在する。$i$ 種類目の樹木の天界でのランクは $A_i$、魔界でのランクは $B_i$ である。また、$1$ 種類目の樹木はスギである。</p> <p>月の瀬さんは、次の操作を何度でも行うことができる。</p> <ul> <li>天界で、種類 $i$ の樹木を種類 $j$ に変える。これには $|A_i - A_j|$ の時間がかかる。</li> <li>魔界で、種類 $i$ の樹木を種類 $j$ に変え...
p01523
<h1>D - 権力</h1> <h2>問題文</h2> <p> 10号館とはとある大学にある建物で,J研究科のメンバーが日夜研究に勤しんでいる施設である. </p> <p> 10号館は建物が古いことで有名であったが,今年ついに改装されることになった. 改装工事終了後は綺麗な環境で研究が出来ると皆が期待していたある日, K研究科の一部が,改装工事終了後の10号館の部屋を侵略するという知らせが届いた. </p> <p> もしK研究科に10号館の部屋が侵略されれば,その部屋で活動していたJ研究科のメンバーはこれまた建物が古いことで知られる2号館に移動する必要がある. 何とか阻止しなければならないので,J...
p01173
<H1><font color="#000">Problem C:</font> Dig or Climb</H1> <p> Benjamin Forest VIII is a king of a country. One of his best friends Nod lives in a village far from his castle. Nod gets seriously sick and is on the verge of death. Benjamin orders his subordinate Red to bring good medicine for him as soon as possible. ...
p01489
<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 D: IkaNumber </h2> <...
p00332
<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> 「西暦」は西洋から輸入された概念ですが、日本には暦...
p00762
<h1>Biased Dice</h1> <!-- end en only --> <!-- begin en only --> <p> Professor Random, known for his research on randomized algorithms, is now conducting an experiment on biased dice. His experiment consists of dropping a number of dice onto a plane, one after another from a fixed position above the plane. The dic...
p01870
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>F: リレー...
p00298
<h1>力持ち</h1> <p> 力持ちたちが集う力持ち学園がありました。力持ち学園の運動会では、力持ちたちが隊列を組んで行進します。 </p> <p> 力持ちたちは常に自分たちの力を誇示したい一方で、彼らの大半は自分で歩きたくありません。そこで彼らの一部が一番下になり、その上に大勢の人を縦一列に持ちあげて歩くことで、実際に歩く人数を減らそうと考えました。 </p> <p> はじめに、<var>N</var> 人の力持ちは地面の上に横一列に並んでいて、それぞれ左側から 1,2,3,..., <var>N</var> と通し番号で呼ばれています。通し番号 <var>i</var> の力持ちの体重は <var>w<sub>i<...
p00277
<H1>プログラミングコンテスト</H1> <p> 白虎大学では毎年プログラミングコンテストが開催されています。チームの総数をNとしたとき、チームには1からNのチームIDがそれぞれ割り当てられています。コンテストは全てのチームの得点が0の状態から開始し、L秒間連続して行われます。 </p> <p> 今年のコンテストは、テレビで中継されることになりました。コンテストの間テレビに映るのは、その時点で最も得点の高いチームだけです。ただし、該当するチームが複数いるときは、その中でチームIDの一番小さいチームが映ります。映すべきチームが変わると、瞬時にカメラが切り替わります。 </p> <p> あなたはコンテストのログを入手しまし...
p00627
<H1><font color="#000000">Problem 01:</font> Kyudo: A Japanese Art of Archery</H1> <p> 伊藤くんは高校入学後弓道部に入部しました。はじめは的に矢が届かず大苦戦していましたが、高校1年の秋になんとか的まで矢が届くくらいまで上達しました。 </p> <p> そんなある日先輩加藤くんから「弓道の近的競技に出場してみないか?」と提案が、、。 伊藤くんは初めての大会にチャレンジする気満々です。 </p> <p> 近的競技とは、1回に4本行射(矢を射つ)し、そのうち的に当たった数(的中数)を記録します。これを複数回繰り返し、的中数の合計を競います。 ...
p01935
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h...
p03908
<span class="lang-en"> <p>Score : <var>1500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>The currency used in Takahashi Kingdom is <em>Myon</em>. There are <var>1</var>-, <var>10</var>-, <var>100</var>-, <var>1000</var>- and <var>10000</var>-Myon coins, and so forth. Formally, there are <v...
p01466
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <H1>World Trip</H1> <p> Kita_masa is planning a trip around the world. This world has <var>N</var> countries and the country <var>i</var> has <var>M_i</var> cities. Kita_masa wants to visit every city exactly once, and return back to the starting city. </p> ...
p01036
<h1>Problem J: Yu-kun Likes To Play Darts</h1> <h2>Background</h2> <p> 会津大学付属幼稚園はプログラミングが大好きな子供が集まる幼稚園である。園児の一人であるゆう君は、プログラミングと同じくらいダーツが大好きだ。 そんなゆう君は最近ダーツにはまっていたが、普通のダーツに飽きてしまったため独自のダーツボードを作ることにした。 </p> <p> ダーツについては<a href="http://ja.wikipedia.org/wiki/ダーツ">ダーツ</a>を参照。 </p> <h2>Problem</h2> <p> ゆう君が考えたダーツの内容は以下の通りだ。 ...
p02837
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> people numbered <var>1</var> to <var>N</var>. Each of them is either an <em>honest</em> person whose testimonies are always correct or an <em>unkind</em> person whose testimonies ...
p03725
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi is locked within a building.</p> <p>This building consists of <var>H×W</var> rooms, arranged in <var>H</var> rows and <var>W</var> columns. We will denote the room at the <var>i</var>-th row a...
p01718
<h1>問題 G : Perm Query </h1> <h2>問題文</h2> <p> <var>\{1,&thinsp; 2,&thinsp; …&thinsp;,&thinsp; N\}</var>の順列 <var>(p(1),&thinsp; p(2),&thinsp; …&thinsp;,&thinsp; p(n))</var> が与えられる. <var>(l_i,&thinsp; r_i)</var> からなるクエリが <var>Q</var> 個与えられるので,各クエリに対して以下の擬似コードによる処理結果を出力せよ. </p> <ol> <li><var>ret &thinsp; := &thinsp; 0<...
p03375
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>In "Takahashi-ya", a ramen restaurant, basically they have one menu: "ramen", but <var>N</var> kinds of toppings are also offered. When a customer orders a bowl of ramen, for each kind of topping, he/sh...
p01348
<H1><font color="#000">Problem J: </font> Cruel Bingo</H1> <p> Bingo is a party game played by many players and one game master. Each player is given a bingo card containing <i>N</i><sup>2</sup> different numbers in a <i>N</i> &times; <i>N</i> grid (typically <i>N</i> = 5). The master draws numbers from a lottery one...
p00109
<H1>Smart Calculator</H1> <p> Your task is to write a program which reads an expression and evaluates it. </p> <ul> <li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li> <li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul...
p02134
<h1>Problem K: Move on Ice</h1> <h2>Problem</h2> <p> ペンギンのフロロは無限に広い氷の上のマス($sx$,$sy$)にいる。<br> マス($tx$,$ty$)に穴があり、そこから水に入ることができる。<br> 氷の上に$n$個の氷の塊があり、それぞれマス($x_i$,$y_i$)にある。<br> </p> <p> フロロは上下左右の4方向に移動できる。<br> 氷の上は滑りやすいので、移動すると氷の塊にぶつかるまで動き続ける。<br> 氷の塊にぶつかると氷の塊のあるマスの1マス手前で止まる。<br> 穴のマスを通過することで穴に入ることができる。<br> </p> <p> フロ...
p00559
<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>Foehn Phenomena</h1> <p> In the Kingdom ...
p02564
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a directed graph with <var>N</var> vertices and <var>M</var> edges, not necessarily simple. The <var>i</var>-th edge is oriented from the vertex <var>a_i</var> to the vertex <var>b_i</var>...
p02071
<style type="text/css"> blockquote { font-family: Menlo, Monaco, "Courier New", monospace; display: block; margin: 10px 0 10px 30px; font-size: 16px; line-height: 18px; white-space: pre; white-space: pre-wrap; word-break: break-all; word-wrap: ...
p02421
<H1>Card Game</H1><br> <p> Taro and Hanako are playing card games. They have <var>n</var> cards each, and they compete <var>n</var> turns. At each turn Taro and Hanako respectively puts out a card. The name of the animal consisting of alphabetical letters is written on each card, and the bigger one in lexicograph...
p02972
<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> empty boxes arranged in a row from left to right. The integer <var>i</var> is written on the <var>i</var>-th box from the left <var>(1 \leq i \leq N)</var>.</p> <p>For each of the...
p03660
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Fennec and Snuke are playing a board game.</p> <p>On the board, there are <var>N</var> cells numbered <var>1</var> through <var>N</var>, and <var>N-1</var> roads, each connecting two cells. Cell <var>a_...
p03230
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an integer <var>N</var>. Determine if there exists a tuple of subsets of <var>\{1,2,...N\}</var>, <var>(S_1,S_2,...,S_k)</var>, that satisfies the following conditions:</p> <ul> <li>Each o...
p02708
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have <var>N+1</var> integers: <var>10^{100}</var>, <var>10^{100}+1</var>, ..., <var>10^{100}+N</var>.</p> <p>We will choose <var>K</var> or more of these integers. Find the number of possible values ...
p00735
<h1><font color="#000000">Problem B: </font>Monday-Saturday Prime Factors</h1> <!-- end en only --> <p> Chief Judge's log, stardate 48642.5. We have decided to make a problem from elementary number theory. The problem looks like finding all prime factors of a positive integer, but it is not. </p> <!-- end en only -->...
p01827
<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 J: Black Company </h2>...
p02358
<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>Union of Rectangles</H1> <p> Given a set...