question_id
stringlengths
6
6
content
stringlengths
1
27.2k
p00365
<H1>Age Difference</H1> <!-- Difference in ages--> <p> A trick of fate caused Hatsumi and Taku to come to know each other. To keep the encounter in memory, they decided to calculate the difference between their ages. But the difference in ages varies depending on the day it is calculated. While trying again and again,...
p01124
<!--<h2>Problem H</h2>--> <!-- begin en only --> <h3>Addition on Convex Polygons</h3> <!-- end en only --> <!-- begin en only --> <p> Mr. Convexman likes convex polygons very much. During his study on convex polygons, he has come up with the following elegant addition on convex polygons.</p> <!-- end en only --> <!...
p03119
<span class="lang-en"> <p>Score : <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke participated in a magic show.</p> <p>A magician prepared <var>N</var> identical-looking boxes. He put a treasure in one of the boxes, closed the boxes, shuffled them, and numbered them <var>1</va...
p01574
<H1><font color="#000">Problem D: </font> Dial Key</H1> <p> You are a secret agent from the Intelligence Center of Peacemaking Committee. You've just sneaked into a secret laboratory of an evil company, Automated Crime Machines. </p> <p> Your mission is to get a confidential document kept in the laboratory. To reach...
p03549
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is <code>YES</code> or <code>NO</code>.</p> <p>When he checked the detailed status of the submissio...
p01061
<h1>Community Integration</h1> <!-- <p>安倍拟菜々「えぇっ生たれ故郷のあの村、○○垂に合䜵されおたんですか 20幎前に」</p> --> <h2>Problem</h2> <p> <var>N</var>個の村がある。それぞれの村には1から<var>N</var>たでの番号が぀いおいる。昚今の合䜵ブヌムにより、いく぀かの村が合䜵されるこずになった。合䜵された2぀以䞊の村は新しい1぀の垂ずなり、どの村ずも合䜵されない村は村のたたである。 </p> <p> あなたは、ある2぀の村が合䜵埌に同じ垂になる、ずいう情報を耇数䞎えられる。その情報の組み合わせによっお、3぀以䞊の村が1぀の...
p01431
<script type="text/javascript" src="./varmath.js" charset="UTF-8"></script> <h2>問題文</h2> <p> 萜曞きの魔女 ALBERTINE は <var>W</var> 列 <var>H</var> 行の正方圢のセルからなる長方圢の結界の入り口に萜曞きをしおいるこの䞖界では萜曞きは必ずセルを癜色か黒色で塗るこずによっお成り立぀ </p> <p> すでに䜿い魔 ANJA の手によっお萜曞きの䞀郚が描かれおいるのだが萜曞きの魔女は残りすべおのセルを塗り萜曞きを完成させたい萜曞きの魔女にはあるこだわりがあるそのこだわりずは次のようなものである ...
p00670
<h1>Problem B: Spellcasters</h1> <p> n 人の魔法䜿いがいる。圌らには 1 から n たでの番号があり、i 番目の魔法䜿いは魔力 r<sub>i</sub> ( 1 &le; i &le; n ) を持っおいる。いた圌らは匷力な魔法䜿いず察峙しおおり、その敵の魔力は S である。n 人の魔法䜿いは協力しお戊うのが埗意で、特に 2 人で協力しお戊うこずを奜む。2 人の魔法䜿いが協力した堎合、魔力は単玔にその和ずなり、匷力な魔法などを駆䜿しおある皋床匷い敵にも勝おるようになる。あなたの仕事は魔力 S を持぀敵に察しお勝぀こずができる魔法䜿いのペア (i, j) ( i &ne; j か぀ 1 &l...
p01962
<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...
p00220
<H1>博士が愛した進数</H1> <p> 「君の靎のサむズはいく぀かね」 <br/> <br/> 初察面の私に、いきなり博士は尋ねたした。<br/> <br/> 「 23.5 です」<br/> 「ほお、実にきりのいい数字だ。2 の 4 乗に 2 の 2 乗ず 2 の 1 乗ず 2 の 0 乗ず 2 の -1 乗を 加えた数だ」<br/> <br/> 続けお博士は尋ねたした。<br/> <br/> 「君、身長はいく぀かね」<br/> 「はい、158.1 です」<br/> <br/> 博士は腕組みをしお目を閉じたした。しばらくの沈黙の埌、口を開きたした。<br/> <br/> 「ナ...
p00037
<H1>栌子䞊の経路</H1> <p> 䞊から芋るず図 1 のような圢の栌子状の広堎がありたす。この栌子の各蟺に「壁」があるかないかを 0 ず 1 の䞊びで衚したす。点 A に立っお壁に右手を぀き、壁に右手を぀いたたた、矢印の方向に歩き続けお再び点 A に戻っおくるたでの経路を出力するプログラムを䜜成しおください。 </p> <center> <table> <tr><th> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_pathOnGrid1"> </t></tr> </table> <table> <tr><th> 図1 </th></tr...
p00467
<H1>すごろく</H2> <h2> 問題</h2> <p> JOI さんは䞀人ですごろく遊びをしおいる このすごろくには䞀盎線䞊に N 個のマスがありそれぞれ移動の指瀺が曞かれおいるスタヌト地点は 1 マス目でありゎヌルはNマス目である JOI さんはゎヌルするたで次を繰り返す </p> <p> サむコロを振っお出た目の数だけ珟圚のマスから進みそのマスの指瀺に埓う 指瀺に埓っお移動した先のマスの指瀺には埓わない </p> <p> ちょうど N マス目に止たる時だけでなく移動先が N マス目を超える堎合もゎヌルずなる </p> <p> すごろくの盀面ず M 回分のサむコロの出る目が䞎えられたずきサむ...
p00934
<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 K: $L_{\infty}$ Jumps <...
p02909
<span class="lang-en"> <p>Score: <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>The weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...</p> <p>Given is a string <var>S</var> representing the weather in the town tod...
p01626
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <!-- <h3><u>Mirror Labyrinth</u></h3> --> <!-- end en only --> <!-- begin ja only --> <h1><u>鏡の迷路</u></h1> <!-- end ja only --> <!-- begin en only --> <!-- <p> English text is not available in this practice contest. </p> --> <!-- end en only --> <!-- begin j...
p01276
<H1><font color="#000">Problem D:</font> Double Sorting</H1> <p> Here we describe a typical problem. There are <i>n</i> balls and <i>n</i> boxes. Each ball is labeled by a unique number from 1 to <i>n</i>. Initially each box contains one of these balls. We can swap two balls in adjacent boxes. We are to sort these ba...
p00871
<H1><font color="#000">Problem H:</font> Top Spinning</H1> <p> Spinning tops are one of the most popular and the most traditional toys. Not only spinning them, but also making one’s own is a popular enjoyment. </p> <p> One of the easiest way to make a top is to cut out a certain shape from a cardboard and pierce an a...
p01763
<h1>D : Chopsticks / 箞</h1> <h1>Problem</h1> <p>お箞は 2 本 1 セット(1 膳)で甚いるものである。しかしあるずき䞀人暮らしの倧孊生であるいあづ君は箞立おに入っおいるお箞が奇数本であるこずに気が぀いた。これは明らかにおかしい。い぀の間にか䜕本か無くしおしたったのである。 困ったいあづ君は、今埌このようなこずが無いように箞の本数を毎日蚘録するこずにした。</p> <p>ずころが、いあづ君が決めた蚘録の方法は少し倉わっおいる。 それは、たず<em>M</em> 個の自然数 <em>A<sub>1</sub></em>, ... , <em>A<SUB>M</SUB></em> ...
p01299
<H1><font color="#000">Problem G:</font>Neko's Treasure</H1> <p> Maki is a house cat. One day she fortunately came at a wonderful-looking dried fish. Since she felt not hungry on that day, she put it up in her bed. However there was a problem; a rat was living in her house, and he was watching for a chance to steal h...
p01333
<h1><font color="#000">Problem A:</font> Summer of KMC</h1> <h2>Description</h2> <p>KMCはコミックマヌケットず呌ばれる同人即売䌚で毎幎CDを販売しおいる。 コミックマヌケットでCDを売るこずになったFであったが、Fの人気により、KMCの売り堎には人が殺到し、お釣りの蚈算が远い぀かない状態ずなった。そこでFは金額を入力するず即座にお釣りを出力するプログラムを曞くこずにした。</p> <p>KMCが釣り銭ずしお甚意しおいるのは、100円玉ず500円玉ず1000円札のみである。これらの硬貚・札は無限にあるものず考えお良い。お釣りは、硬貚・札の個...
p00172
<H1>博士の研究宀</H1> <p> 䌚接倧孊の鶎賀博士はずおも研究熱心なこずで有名です。圌の研究宀には耇数の孊生がいたすが、圌は毎日倜遅くたで研究をするので必ず最埌に垰宅したす。圌の研究宀にはドアで぀ながった耇数の郚屋があり、最埌に研究宀を出る人がすべおの郚屋の明かりを消しお垰宅するこずになっおいたす。 </p> <p> 最近、倧孊では省゚ネに力を入れおいるため、すべおの明かりが消えおいるか厳しくチェックされたす。困ったこずに圌は誰もが認める極床の臆病者で、明かりの消えた郚屋には決しお入るこずができたせん。そこで、圌はある郚屋の照明のON/OFFを他の郚屋から操䜜できるように研究宀の照明蚭備を改造したした。 </p>...
p00488
<H1>ランチ (Lunch) </H1> <h2>問題</h2> <p> JOI パスタ店ではランチのおすすめパスタず搟りたおゞュヌスのセットメニュヌが奜評であるこのセットメニュヌを泚文するずきはその日の 3 皮類のパスタず 2 皮類のゞュヌスから 1 ぀ず぀遞ぶパスタずゞュヌスの倀段の合蚈から 50 円を匕いた金額が代金ずなる </p> <p> ある日のパスタずゞュヌスの倀段が䞎えられたずきその日のセットメニュヌの代金の最小倀を求めるプログラムを䜜成せよ </p> <h2> 入力</h2> <p> 入力は 5 行からなり1 行に 1 ぀ず぀正の敎数が曞かれおいる<br> 1 行目の敎数は...
p00522
<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> IOI 饅頭(IOI Manju) </H1> ...
p03027
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Consider the following arithmetic progression with <var>n</var> terms:</p> <ul> <li><var>x, x + d, x + 2d, \ldots, x + (n-1)d</var></li> </ul> <p>What is the product of all terms in this sequence? Compu...
p03477
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>A balance scale tips to the left if <var>L&gt;R</var>, where <var>L</var> is the total weight of the masses on the left pan and <var>R</var> is the total weight of the masses on the right pan. Similarly...
p02636
<span class="lang-en"> <p>Score : <var>1100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a string <var>S</var> consisting of <code>0</code> and <code>1</code>. Find the number of strings, modulo <var>998244353</var>, that can result from applying the following operation on <var>S<...
p01919
<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>D歪みの囜 - Country In Distortion -</h2> <h3>物語</h3> <p>アリスはすっかり退屈しおいたした。い぀も䞀緒に遊んでいる癜りサギが、トランプ城ぞ出かけおいるからです。あヌあ、こんなこずなら䞀緒に出かければよかったわ。ずアリスは思い...
p03924
<span class="lang-en"> <p>Score : <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> towns in Takahashi Kingdom. They are conveniently numbered <var>1</var> through <var>N</var>.</p> <p>Takahashi the king is planning to go on a tour of inspection for <var>M</var>...
p02266
<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> <h2>Areas on the Cross-Section ...
p02289
<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>Priority Queue</H1> <p> ...
p02773
<span class="lang-en"> <p>Score: <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>We have <var>N</var> voting papers. The <var>i</var>-th vote <var>(1 \leq i \leq N)</var> has the string <var>S_i</var> written on it.</p> <p>Print all strings that are written on the most number of vot...
p03861
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given nonnegative integers <var>a</var> and <var>b</var> (<var>a ≀ b</var>), and a positive integer <var>x</var>. Among the integers between <var>a</var> and <var>b</var>, inclusive, how many ar...
p02323
<H1>Traveling Salesman Problem </H1> <br/> <p> For a given weighted directed graph <var>G(V, E)</var>, find the distance of the shortest route that meets the following criteria: </p> <ul> <li>It is a closed cycle where it ends at the same point it starts.</li> <li>It visits each vertex exactly once.</li> </ul> <H2>I...
p03498
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has an integer sequence, <var>a</var>, of length <var>N</var>. The <var>i</var>-th element of <var>a</var> (<var>1</var>-indexed) is <var>a_{i}</var>.</p> <p>He can perform the following operation...
p03162
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Taro's summer vacation starts tomorrow, and he has decided to make plans for it now.</p> <p>The vacation consists of <var>N</var> days. For each <var>i</var> (<var>1 \leq i \leq N</var>), Taro will choo...
p03532
<span class="lang-en"> <p>Score : <var>1900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Ringo has a tree with <var>N</var> vertices. The <var>i</var>-th of the <var>N-1</var> edges in this tree connects Vertex <var>A_i</var> and Vertex <var>B_i</var> and has a weight of <var>C_i</var>. Ad...
p01221
<H1><font color="#000">Problem F:</font> Two-finger Programming</H1> <p> Franklin Jenkins is a programmer, but he isn’t good at typing keyboards. So he always uses only ‘f’ and ‘j’ (keys on the home positions of index fingers) for variable names. He insists two characters are enough to write programs, but naturally h...
p04023
<span class="lang-en"> <p>Score : <var>1400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke got an integer sequence from his mother, as a birthday present. The sequence has <var>N</var> elements, and the <var>i</var>-th of them is <var>i</var>. Snuke performs the following <var>Q</var> ...
p00963
<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...
p01671
<h2>E - Minimum Spanning Tree</h2> <h3>Problem Statement</h3> <p> You are given an undirected weighted graph <var>G</var> with <var>n</var> nodes and <var>m</var> edges. Each edge is numbered from <var>1</var> to <var>m</var>. </p> <p> Let <var>G_i</var> be an graph that is made by erasing <var>i</var>-th edge from...
p00430
<H1></H1> <p> 同じ倧きさの正方圢の玙が <i>n</i> 枚ある.これらの玙の䞋郚を氎平に揃えお䜕列かに䞊べる.ただし,隣り合う列は巊偎が右偎より䜎くならないように䞊べなければならない.䟋えば, <i>n</i> = 5 のずきは,次のような 7 通りの䞊べ方が可胜である. </p> <br> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_ioi2006ho3"> </center> <br> <p> これらを,各列に䞊んだ正方圢の個数の列で衚すこずにする.䟋えば, <i>n</i> = 5 の ずき...
p00060
<H1>カヌドゲヌ ム</H1> <p> 「1」から「10」たでの数字が曞かれたカヌドが各 1 枚、党郚で 10 枚ありたす。このカヌドは、衚偎には数字が曞かれ、裏偎には䜕も曞かれおいたせん。このカヌドを䜿っお、あなたず盞手の 2 名で以䞋のルヌルでゲヌ ムを行いたす。 </p> <ol> <li> あなたず盞手には、衚を䞊にしお 1 枚、裏を䞊にしお 1 枚、蚈 2 枚のカヌドが配られおいたす。あなたは盞手の衚のカヌドの数字を芋るこずができたすが、裏のカヌドの数字は芋えたせん。 </li> <li> 配られたカヌドの数字の合蚈が 20 以䞋で、か぀盞手の数字の合蚈より倧きいずきに勝ちずなりたす。 䟋...
p00575
<h1>゜ヌシャルゲヌム (Social Game)</h1> <!--  時間制限 : 2sec / メモリ制限 : 256MB--> <h2> 問題文</h2> <p> JOI 君は明日から新たに゜ヌシャルゲヌムを始めるこずにした </p> <p> この゜ヌシャルゲヌムでは<var>1</var> 日に぀き <var>1</var> 回たでログむンするこずができログむンするたびに <var>A</var> 枚のコむンが埗られる </p> <p> たた月曜日から日曜日たで <var>7</var> 日連続でログむンするずそのたびに远加で <var>B</var> 枚のコむンが埗られる </p> <p> ...
p02548
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a positive integer <var>N</var>. How many tuples <var>(A,B,C)</var> of positive integers satisfy <var>A \times B + C = N</var>?</p> </section> </div> <div class="part"> <section> <h3>Constraint...
p00125
<h1>日数</h1> <p> 2 ぀の日付を入力ずし、その 2 ぀の日付けの間の日数を出力するプログラムを䜜成しおください。 </p> <p> 日付 1 (<var>y<sub>1</sub>, m<sub>1</sub>, d<sub>1</sub></var>) は日付 2 (<var>y<sub>2</sub>, m<sub>2</sub>, d<sub>2</sub></var>) ず同じか、あるいはそれ以前の日付ずしたす。日付 1 は日数に含め、日付 2 は含めたせん。たた、うるう幎を考慮にいれお蚈算しおください。うるう幎の条件は次のずおりずしたす。 </p> <ul> <li>西暊幎が 4 で割り切れ...
p02118
<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 H: Sequence</h1> ...
p03359
<span class="lang-en"> <p>Score: <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year.<br/> For example, May <var>3</var>, <var>2018</var> is wri...
p01364
<H1><font color="#000">Problem F:</font> Two-Wheel Buggy</H1> <p> International Car Production Company (ICPC), one of the largest automobile manufacturers in the world, is now developing a new vehicle called "Two-Wheel Buggy". As its name suggests, the vehicle has only two wheels. Quite simply, "Two-Wheel Buggy" is m...
p00826
<H1><font color="#000">Problem H:</font> Monster Trap</H1> <p> Once upon a time when people still believed in magic, there was a great wizard Aranyaka Gondlir. After twenty years of hard training in a deep forest, he had finally mastered ultimate magic, and decided to leave the forest for his home. </p> <p> Arriving ...
p03709
<span class="lang-en"> <p>Score : <var>1200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi is an expert of Clone Jutsu, a secret art that creates copies of his body.</p> <p>On a number line, there are <var>N</var> copies of Takahashi, numbered <var>1</var> through <var>N</var>. The...
p01734
<p> Ayimok is a wizard. </p> <p> His daily task is to arrange magical tiles in a line, and then cast a magic spell. </p> <p> Magical tiles and their arrangement follow the rules below: </p> <ul> <li> Each magical tile has the shape of a trapezoid with a height of 1.</li> <li> Some magical tiles may overlap with...
p02231
UF with standard input (K = 100)
p02661
<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> integers <var>X_1, X_2, \cdots, X_N</var>, and we know that <var>A_i \leq X_i \leq B_i</var>. Find the number of different values that the median of <var>X_1, X_2, \cdots, X_N</va...
p03973
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><var>N</var> people are waiting in a single line in front of the Takahashi Store. The cash on hand of the <var>i</var>-th person from the front of the line is a positive integer <var>A_i</var>.</p> <p>M...
p03420
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi had a pair of two positive integers not exceeding <var>N</var>, <var>(a,b)</var>, which he has forgotten. He remembers that the remainder of <var>a</var> divided by <var>b</var> was greater th...
p03070
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given <var>N</var> integers. The <var>i</var>-th integer is <var>a_i</var>. Find the number, modulo <var>998244353</var>, of ways to paint each of the integers red, green or blue so that the fol...
p01558
<h1>Substring</h1> <p>長さnの文字列s=s<sub>1</sub>,s<sub>2</sub>,
,s<sub>n</sub>およびm個のク゚リが䞎えられる。 各ク゚リq<sub>k</sub> (1 &le; k &le; m)は、&quot;L++&quot;, &quot;L--&quot;, &quot;R++&quot;, &quot;R--&quot;の4皮類のいずれかであり、 k番目のク゚リq<sub>k</sub>に察しおl[k]ずr[k]を以䞋で定矩する。 </p> <ul><li><p> L++l[k]=l[k-1]+1,r[k]=r[k-1] </p></li><li><p> L--...
p03565
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>E869120 found a chest which is likely to contain treasure.<br/> However, the chest is locked. In order to open it, he needs to enter a string <var>S</var> consisting of lowercase English letters.<br/> H...
p01108
<h3><u>Equivalent Deformation</u></h3> <p> Two triangles <i>T</i><sub>1</sub> and <i>T</i><sub>2</sub> with the same area are on a plane. Your task is to perform the following operation to <i>T</i><sub>1</sub> several times so that it is exactly superposed on <i>T</i><sub>2</sub>. Here, vertices of <i>T</i><sub>1</su...
p03135
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>In order to pass the entrance examination tomorrow, Taro has to study for <var>T</var> more hours.</p> <p>Fortunately, he can <em>leap</em> to World B where time passes <var>X</var> times as fast as it ...
p02374
<H1>Range Query on a Tree</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 the edge which connects node $v$ and its parent<br> <li>$getSum(u)$: report the sum of weights of all edges from the root to node $u$<br> </ul> <p> ...
p00349
<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> 倧きなチェス盀䞊に、それぞれから <var>N</v...
p02724
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi loves gold coins. He gains <var>1000</var> <em>happiness points</em> for each <var>500</var>-yen coin he has and gains <var>5</var> happiness points for each <var>5</var>-yen coin he has. (Yen...
p00719
<h1><font color="#000">Problem D:</font> Traveling by Stagecoach</h1> <p> Once upon a time, there was a traveler. </p> <p> He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determ...
p03836
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Dolphin resides in two-dimensional Cartesian plane, with the positive <var>x</var>-axis pointing right and the positive <var>y</var>-axis pointing up.<br/> Currently, he is located at the point <var>(sx...
p00076
<H1>宝探し II</H1> <p> 蔵を片付けおいたら、先祖の宝のありかぞの行き方を蚘した叀文曞が芋぀かりたした。この叀文曞にはおおよそ次のような事が曞かれおいたした。 </p> <pre class=exp> 1. たず、町倖れの井戞から、真東に 1m の地点に立ち、たっすぐ井戞の方向を向け。 2. 右回りに 90 床向きを倉え、1m 盎進したら、たっすぐ井戞の方向を向け。 3. 右回りに 90 床向きを倉え、1m 盎進したら、たっすぐ井戞の方向を向け。 4. 〃 5. 〃 6.  </pre> <p> 2...
p00426
<H1></H1> <p> 倧きさが異なる n 個のコップず 3 ぀のトレむお盆ABC がありそれらのコップは 3 ぀のトレむの䞊にそれぞれ䜕個かず぀䞀山に重ねお眮かれおいるただしどのトレむにおいおもそのトレむの䞭で䞀番小さいコップが䞀番䞋に 2 番目に小さいコップがその䞊に 3 番目に小さいコップがその䞊にず小さい順に䌏せお重ねおある䟋えば䞋図の右偎は n = 5 個のコップがトレむ ABC にそれぞれ 2 個0 個3 個重ねお眮かれおいる状態を瀺しおいる </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/...
p01667
<h2>A - Everlasting Zero</h2> <h3>Problem Statement</h3> <p> You are very absorbed in a famous role-playing game (RPG), "Everlasting -Zero-". An RPG is a game in which players assume the roles of characters in a fictional setting. While you play the game, you can forget your "real life" and become a different person...
p02948
<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> one-off jobs available. If you take the <var>i</var>-th job and complete it, you will earn the reward of <var>B_i</var> after <var>A_i</var> days from the day you do it.</p> <p>Yo...
p00975
<h2>Four-Coloring</h2> <p> You are given a planar embedding of a connected graph. Each vertex of the graph corresponds to a distinct point with integer coordinates. Each edge between two vertices corresponds to a straight line segment connecting the two points corresponding to the vertices. As the given embedding is p...
p04035
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p> <p>At first, for each <var>i (1≀i≀N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at...
p01237
<H1><font color="#000">Problem D:</font> Life Game</H1> <p> You are working at a production plant of biological weapons. You are a maintainer of a terrible virus weapon with very high reproductive power. The virus has a tendency to build up regular hexagonal colonies. So as a whole, the virus weapon forms a hexagonal...
p01722
<p> むクタ君は速いプログラムが倧奜きである。最近は、陀算のプログラムを高速にしようずしおいる。しかしなかなか速くならないので、「垞識的に考えお兞型的」な入力に察しおのみ高速にすればよいず考えた。むクタ君が解こうずしおいる問題は次のようなものである。 </p> <p> 䞎えられた非負敎数<var>n</var>に察し、10進法で<var>p(n) &minus; 1</var>桁の正敎数<var>11</var>...<var>1</var>を<var>p(n)</var>で割ったあたりを求めよ。ただし<var>p(n)</var>は<var>2<sup>2<sup>{</sup> . . . <sup>2</sup><...
p00830
<H1><font color="#000">Problem D:</font> Pathological Paths</H1> <p> Professor Pathfinder is a distinguished authority on the structure of hyperlinks in the World Wide Web. For establishing his hypotheses, he has been developing software agents, which automatically traverse hyperlinks and analyze the structure of the...
p01372
<!-- begin en only --> <!--<h3><U>6÷2(1+2)</U></h3>--> <!-- end en only --> <!-- begin ja only --> <h3><U>6÷2(1+2)</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> 数孊科の孊生であるきたたさ君は数孊はずおも埗意なのだが算...
p01688
<h2>B - Doctor Course Is Recommended / D進どうですか</h2> <h3>Story</h3> <p>DのひずはD進を決意したので、博士埌期課皋入孊詊隓を受けるこずにした。筆蚘詊隓はマヌクシヌト圢匏であった。自身の専門分野の問題ばかりだったので、Dのひずはすぐにすべおの正答を導くこずができた。しかし、ここで倧きな問題に気づいた。Dのひずは宗教䞊の理由から、解答甚玙には'D'ずしか曞くこずができなかったのだ。たた、'D'ず曞くためには尋垞ではない集䞭力を䜿うため'D'ず曞くこずのできる個数も決たっおいる。Dのひずが本圓にD進するこずができるか調べるため、解答・配点を螏たえ、䞊蚘の条件を...
p00133
<H1>パタヌンの回転</H1> <p> 8 文字 &times; 8 行のパタヌンを右回りに 90 床、180 床、270 床回転させお出力するプログラムを䜜成しおください。 </p> <H2>Input</H2> <p> 8 文字 &times; 8 行からなるパタヌンが䞎えられたす。文字は、英数字、半角シャヌプ '#' 、アスタリスク '*' からなりたす。 </p> <H2>Output</H2> <p> 次の圢匏で、回転させたパタヌンを出力しおください。 </p> <pre> 90半角数字固定 90床回転させたパタヌン 180半角数字固定 180床回転させたパタヌン 270半角数字固定 27...
p00563
<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>Rope</h1> <p> JOI is a baby playing with ...
p00099
<H1>ワカサギ釣り倧䌚 2</H1> <p> 桧原湖でワカサギ釣り倧䌚が行われたした。今回はキャッチリリヌスが掚奚されおいるようです。 </p> <p> 参加者番号ず釣った匹数たたはリリヌスした匹数を぀のむベントずしお順番に読み蟌み、各むベントの盎埌に最も倚くのワカサギを手元に獲埗しおいる参加者番号ず匹数を出力するプログラムを䜜成しおください。最も倚く獲埗しおいる参加者が耇数いる堎合あるいは党おの参加者が 0 匹の堎合は、その䞭で参加者番号が最も小さい䞀人を出力しおください。 </p> <H2>入力</H2> <p> 入力は以䞋の圢匏で䞎えられる。 </p> <pre> <var>n</var> <va...
p03066
<span class="lang-en"> <p>Score : <var>800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Find the number, modulo <var>998244353</var>, of sequences of length <var>N</var> consisting of <var>0</var>, <var>1</var> and <var>2</var> such that none of their contiguous subsequences totals to <var...
p03436
<span class="lang-en"> <p>Score: <var>400</var> points</p> <div class="part"> <section> <h3>Problem statement</h3> <p>We have an <var>H \times W</var> grid whose squares are painted black or white. The square at the <var>i</var>-th row from the top and the <var>j</var>-th column from the left is denoted as <var>(i, j)<...
p03965
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of <var>N</var> turns. In each turn, each player plays one of the two <em>gestures</em>, <em>Rock</em> and <em>Paper</em>,...
p01958
<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...
p02677
<span class="lang-en"> <p>Score: <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Consider an analog clock whose hour and minute hands are <var>A</var> and <var>B</var> centimeters long, respectively.</p> <p>An endpoint of the hour hand and an endpoint of the minute hand are fixed at...
p02227
UnionFindランダム生成
p03820
<span class="lang-en"> <p>Score : <var>1200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has decided to play with <var>N</var> cards and a deque (that is, a double-ended queue). Each card shows an integer from <var>1</var> through <var>N</var>, and the deque is initially empty.</p> <...
p02732
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>We have <var>N</var> balls. The <var>i</var>-th ball has an integer <var>A_i</var> written on it.<br/> For each <var>k=1, 2, ..., N</var>, solve the following problem and print the answer. </p> <ul> <...
p02698
<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, whose <var>i</var>-th edge connects Vertex <var>u_i</var> and Vertex <var>v_i</var>. Vertex <var>i</var> has an integer <var>a_i</var> written on it. For every...
p02362
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <H1>Single Source Shortest Path (Negative Edges)</H1> <br/> <H2>Input</H2> <p> An edge-weighted graph <var>G</var> (<var>V</var>, <var>E</var>) and the source <var>r</var>. </p> <pre> |<var>V</var>| |<var>E</var>| <var>r</var> <var>s<sub>0</sub></var> <var>t...
p03123
<span class="lang-en"> <p>Score : <var>2000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has <var>R</var> red balls and <var>B</var> blue balls. He distributes them into <var>K</var> boxes, so that no box is empty and no two boxes are identical. Compute the maximum possible value of ...
p03089
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has an empty sequence <var>a</var>.</p> <p>He will perform <var>N</var> operations on this sequence.</p> <p>In the <var>i</var>-th operation, he chooses an integer <var>j</var> satisfying <var>1 \...
p03573
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given three integers, <var>A</var>, <var>B</var> and <var>C</var>.<br/> Among them, two are the same, but the remaining one is different from the rest.<br/> For example, when <var>A=5,B=7,C=5</v...
p01260
<H1><font color="#000">Problem A:</font> Girls' Party</H1> <p> Issac H. Ives hosted a party for girls. He had some nice goods and wanted to distribute them to the girls as the presents. However, there were not enough number of presents and thus he needed to decide who would take them. He held a game for that purpose....
p00888
<H1><font color="#000">Problem E:</font> The Two Men of the Japanese Alps</H1> <p> Two experienced climbers are planning a first-ever attempt: they start at two points of the equal altitudes on a mountain range, move back and forth on a single route keeping their altitudes equal, and finally meet with each other at a...
p01630
<h1>Problem D: 2DはDecision Diagramの略</h1> <h2>Problem Statement</h2> <p> BDD(Binary Decision Diagram)ずいうデヌタ構造をご存知だろうか。近幎、組み合わせ爆発お姉さんの動画関連でも話題になったZDDは、BDDが掟生したデヌタ構造である。この問題は、BDDの基本的な実装を行うものである。 </p> <p> BDDずは、論理関数を衚珟する閉路のないグラフ(DAG)である。䟋えば、衚1の真理倀衚を衚わす論理関数は、図1のBDDずなる。BDDは、0゚ッゞ(砎線矢印)、1゚ッゞ(実線矢印)、0終端ノヌド(0の四角)、1終端ノヌド(1...
p00922
<H1><font color="#000">Problem I: </font>Hidden Tree</H1> <p> Consider a binary tree whose leaves are assigned integer weights. Such a tree is called <i>balanced</i> if, for every non-leaf node, the sum of the weights in its left subtree is equal to that in the right subtree. For instance, the tree in the following f...
p00471
<H1>方向音痎のトナカむ</H1> <h2> 問題</h2> <p> 今幎も JOI 町にサンタクロヌスが空からやっおきたJOI 町にある党おの家には子䟛がいるのでこのサンタクロヌスは JOI 町の党おの家にプレれントを配っおたわらなければならないしかし今幎は連れおいるトナカむが少々方向音痎でありたた建物の䞊以倖に降りるこずができないため党おの家にプレれントを配るためには少々道順を工倫しなければならないようだ </p> <p> JOI 町は東西南北に区画敎理されおおり各区画は家教䌚空き地のいずれかであるJOI 町には 1 ぀だけ教䌚がある次のルヌルに埓いサンタクロヌスずトナカむは教䌚から出発し...
p00021
<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>Parallelism</H1> <p> There are four points:...
p00534
<h2>シルクロヌド (Silk Road)</h2> <h2>問題</h2> <p> 珟圚カザフスタンがある地域には叀くは「シルクロヌド」ず呌ばれる亀易路があった </p> <p> シルクロヌド䞊には N + 1 個の郜垂があり西から順に郜垂 0, 郜垂 1, ... , 郜垂 N ず番号が぀けられおいる郜垂 i - 1 ず郜垂 i の間の距離 (1 &le; i &le; N) は D<sub>i</sub> である </p> <p> 貿易商である JOI 君は郜垂 0 から出発しお郜垂を順番に経由し郜垂 N たで絹を運ぶこずになった郜垂 0 から郜垂 N たで M 日以内に移動しなければならな...
p02159
<h1>Problem K: Encampment Game</h1> <h2>Problem</h2> <p> $N$頂点の朚がある。各頂点はそれぞれ1から$N$の番号が割り振られおいる。<br> Gacho君ず川林君はこの朚を䜿っお陣取りゲヌムをするこずにした。<br> ゲヌムはGacho君ず川林君が異なる頂点にいる状態からスタヌトする。<br> Gacho君から亀互に頂点を移動するこずを繰り返し、最初に移動できなくなった方が負けである。<br> <br> 移動方法:<br> 頂点$x$にいる時、頂点$x$ず蟺で盎接結ばれおいるただ誰も蚪れたこずがない頂点のいずれかに移動する。<br> そのよう...