question_id
stringlengths
6
6
content
stringlengths
1
27.2k
p01331
<h1><font color="#000">Problem K:</font> ワヌプホヌル</h1> <p>20XX幎、遠く離れた堎所に察する効率的な物質転送方匏が確立され、人類の宇宙ぞの進出はたすたす加速されるこずになった。この転送方匏は、より遠くに物質を転送しようずするず、原則的により倧きな物質の転送が可胜になる点で革新的であった。転送方匏の詳现を次に蚘す。</p> <p>たず転送察象ずなる物質は、スタヌト座暙(1, 1)にお単䜍質量毎のパヌティクルに分割される。各パヌティクルには、各々異なる波動゚ネルギヌが䞎えられなければならない。波動゚ネルギヌは、<i>V</i>ず<i>H</i>からなる任意の長さの文字列で衚珟さ...
p01624
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <!-- <h3><u>Ononokomachi's Edit War</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 -->...
p03619
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>In the city of Nevermore, there are <var>10^8</var> streets and <var>10^8</var> avenues, both numbered from <var>0</var> to <var>10^8-1</var>. All streets run straight from west to east, and all avenues...
p00936
<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 B Squeeze the Cylinder...
p01274
<H1><font color="#000">Problem B:</font> Magic Slayer</H1> <p> You are in a fantasy monster-ridden world. You are a slayer fighting against the monsters with magic spells. </p> <p> The monsters have <i>hit points</i> for each, which represent their vitality. You can decrease their hit points by your magic spells: ea...
p03249
<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 <var>D_1, D_2, ..., D_N</var> of length <var>N</var>. <strong>The values of <var>D_i</var> are all distinct.</strong> Does a tree with <var>N</var> vertices that satisfies the f...
p02008
<h1>Problem E. Magic Triangles</h1> <!-- Time Limit: 2 sec Memory Limit: 512 MB --> <p> Fallen angel Yohane plans to draw a magic symbol composed of triangles on the earth. By casting some magic spell on the symbol, she will obtain magic power; this is the purpose for which she will draw a magic symbol. The magic ...
p00035
<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> 平面䞊の異なる 4 点 $A (x_a, y_a)$, $...
p02458
<h1>Multi-Set</h1> <p> For a set $S$ of integers, perform a sequence of the following operations. Note that <u>multiple elements can have equivalent values in $S$</u>. </p> <ul> <li>insert($x$): Insert $x$ to $S$ and report the number of elements in $S$ after the operation.</li> <li>find($x$): Report the numbe...
p00465
<H1> 認蚌レベル </H1> <h2>問題</h2> <p> あなたは Just Odd Inventions 瀟を知っおいるだろうか? この䌚瀟の業務は「ただ奇劙な発明 (just odd inventions)」をするこずである.ここでは略しお JOI 瀟ず呌ぶ. </p> <p> JOI 瀟には 2 ぀の事務所があり,それぞれ同じ倧きさの正方圢の郚屋がマス目状に䞊んでできおいる.蟺で接しおいるすべおの郚屋の間に,身分蚌による認蚌機胜の付いた扉がある.JOI 瀟では様々なレベルの機密情報を扱っおいるため,郚屋ごずに機密レベルずいう正の敎数が蚭定されおおり,身分蚌の事務所ごずに定められた非負敎数の認蚌レベルが,機密...
p01960
<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...
p00672
<h1>Problem D: Dimensional Analysis</h1> <p> 量の次元ずは、盞異なる量の間の関係匏から具䜓的数倀を無芖しお量の皮類ずそのべき乗だけに着目した抂念である。具䜓的には定数係数を無芖した等匏ずしお、次元の関係匏を衚す。すなわち、量 q の次元を[ q ]ず衚せば、以䞋のようないく぀かの次元の関係匏が䟋瀺できる。</p> <ul> <li>[面積] = [長さ]<sup>2</sup></li> <li>[䜓積] = [長さ]<sup>3</sup></li> <li>[速さ] = [長さ][時間]<sup>-1</sup></li> <li>[加速床] = [長さ][時間]<sup>-2</...
p00388
<h1>Design of a Mansion</h1> <p> Our master carpenter is designing a condominium called Bange Hills Mansion. The condominium is constructed by stacking up floors of the same height. The height of each floor is designed so that the total height of the stacked floors coincides with the predetermined height of the condo...
p00222
<H1>四぀子玠数</H1> <p> (<var>a, a+2, a+6, a+8</var>) のように䞊んだ 4 ぀の玠数の組を四぀子玠数ずいいたす。四぀子玠数を構成する四぀の玠数のうち、最倧の数をその四぀子玠数の倧きさず呌びたす。䟋えば、最も小さい倧きさの四぀子玠数は、(5, 7, 11, 13) の組であり、その倧きさは 13 です。次に倧きい四぀子玠数は、(11, 13, 17, 19) の組で、その倧きさは 19 です。 </p> <p> 敎数 <var>n</var> (13 &le; <var>n</var> &le; 10,000,000) を入力ずし、倧きさが <var>n</var> 以䞋にな...
p01063
<h1>Rubik Dungeon</h1> <h2>Problem</h2> <p> あなたは<var>n</var> × <var>n</var> × <var>n</var>の立方䜓のルヌビックキュヌブ型のダンゞョンにやっおきた。<br> あなたは珟圚(<var>x<sub>1</sub></var>,<var>y<sub>1</sub></var>,<var>z<sub>1</sub></var>)の郚屋にいる。<br> 目暙の宝は(<var>x<sub>2</sub></var>,<var>y<sub>2</sub></var>,<var>z<sub>2</sub></var>)の郚屋にある。<br> あなたは隣接...
p01599
<h2>Problem I: Train King</h2> <p>Roland has been given a mission of dangerous material transfer by Train King. The material is stored in the station A and subject to being transferred to the station B. He will bring it by direct trains between A and B, one (or zero) unit per ride.</p> <p>Your task is to write a pro...
p01433
<script type="text/javascript" src="./varmath.js" charset="UTF-8"></script> <h2>問題文</h2> <p> 人魚の魔女 KLARISSA はコンサヌトホヌルの䞭で圚りし日の感動を倢芋぀づけおいる圌女の運呜の車茪は具珟化しコンサヌトホヌルの䞭で転がり続けおいる </p> <p> <i>䜐倉杏子</i>はその運呜の車茪が円ではなくカラフルな正方圢であるこずに気が぀いた運呜の車茪はコンサヌトホヌルの西から東ぞ転がろうずしおいる<i>䜐倉杏子</i>は運呜の車茪がある所たで転がったずきにその䞊に飛び移るこずにしたそこで飛び移るべき面の色を知り飛び...
p01126
<h1>Amida, the City of Miracle</h1> <p> 奇跡の郜垂アミダAmida, the City of Miracleの垂長は他の垂のように遞挙で遞ぶのではないか぀お長い政暩闘争ず倩倉地異により疲匊したこの郜垂は候補者党員を公平に遞びか぀幞運の星の䞋に生たれた者を垂長にするために候補者党員の運呜をくじにゆだねるこずにしたのである埌にあみだくじず呌ばれるくじである </p> <p> 遞挙は以䞋のように行われる候補者数ず同数の長い瞊線が匕かれさらにいく぀かの暪線がそこに匕かれる暪線は隣接した瞊線の途䞭同士を結ぶように匕かれるいずれかの瞊線の䞋には「圓遞」ず曞かれおいるどの瞊...
p01576
<H1><font color="#000">Problem F:</font> Exciting Bicycle</H1> <p> You happened to get a special bicycle. You can run with it incredibly fast because it has a turbo engine. You can't wait to try it off road to enjoy the power. </p> <p> You planned to go straight. The ground is very rough with ups and downs, and can ...
p03818
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has decided to play a game using cards. He has a deck consisting of <var>N</var> cards. On the <var>i</var>-th card from the top, an integer <var>A_i</var> is written.</p> <p>He will perform the o...
p01825
<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 H: Laser Cutter </h2>...
p00737
<h1><font color="#000000">Problem D:</font> Twirling Robot </h1> <!-- end en only --> <!-- begin en only --> <p> Let's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal...
p00367
<!--<H1>Breakfast, Lunch and Supper</H1>--> <h1>Three Meals</h1> <p> You are running a restaurant that serves dishes only three times a day. Each of your customer has his/her own separate time zones for eating breakfast, lunch and supper. Thus, your customer enjoys your dish only when he/she visits your restaurant to ...
p03398
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Let <var>X = 10^{100}</var>. Inaba has <var>N</var> checker pieces on the number line, where the <var>i</var>-th checker piece is at coordinate <var>X^{i}</var> for all <var>1 \leq i \leq N</var>.</p> ...
p03662
<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_...
p02970
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> apple trees in a row. People say that one of them will bear golden apples.</p> <p>We want to deploy some number of inspectors so that each of these trees will be inspected.</p> <p...
p03232
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> blocks arranged in a row, numbered <var>1</var> to <var>N</var> from left to right. Each block has a weight, and the weight of Block <var>i</var> is <var>A_i</var>. Snuke will per...
p02589
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Limak can repeatedly remove one of the first two characters of a string, for example <var>abcxyx \rightarrow acxyx \rightarrow cxyx \rightarrow cyx</var>.</p> <p>You are given <var>N</var> different...
p02073
<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: ...
p02423
<h1>Bit Operation I</h1> <p> Given a non-negative decimal integer $x$, convert it to binary representation $b$ of 32 bits. Then, print the result of the following operations to $b$ respecitvely. </p> <ul> <li>Inversion: change the state of each bit to the opposite state</li> <li>Logical left shift: shift left by 1</...
p02136
<h1>Problem M: Manhattan Bomb</h1> <h2>Problem</h2> <p> 2次元平面䞊に$n$個の爆匟がある。爆匟にはそれぞれ1から$n$たでの番号が割り振られおおり、$i$番目の爆匟は座暙$(x_i,y_i)$に存圚しおいる。<br> なお、どの爆匟も原点からのマンハッタン距離が等しいこずが分かっおいる。<br> $i$番目の爆匟が爆発したずき、座暙$(x_i,y_i)$からのマンハッタン距離が$r_i$以内の座暙に存圚しおいる爆匟も連鎖的に爆発する。<br> $n$個の爆匟それぞれに぀いお、その爆匟のみに着火した堎合に、爆発せずに残る爆匟の個数を求めよ。 </p> <h2...
p02566
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a string of length <var>N</var>. Calculate the number of distinct substrings of <var>S</var>.</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1 \leq N ...
p03727
<span class="lang-en"> <p>Score : <var>1400</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 of the <var>N-1</var> edges connects vertices <var>a_i</var> and <var>b_i</var>.</p> <p>Initia...
p02835
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are three integers <var>A_1</var>, <var>A_2</var>, and <var>A_3</var>.</p> <p>If <var>A_1+A_2+A_3</var> is greater than or equal to <var>22</var>, print <code>bust</code>; otherwise, print <code>w...
p00808
<H1><font color="#000">Problem F:</font> Young, Poor and Busy</H1> <p> Ken and Keiko are young, poor and busy. Short explanation: they are students, and ridden with part-time jobs. To make things worse, Ken lives in Hakodate and Keiko in Tokyo. They want to meet, but since they have neither time nor money, they have ...
p03377
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are a total of <var>A + B</var> cats and dogs. Among them, <var>A</var> are known to be cats, but the remaining <var>B</var> are not known to be either cats or dogs.</p> <p>Determine if it is poss...
p03459
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point <var>(0, 0)</var> at time <var>0</var>, then for each <var>i</var> between <var>1</var> and <var>N...
p01464
<H1>Sunny Graph</H1> <p> The Sun is a great heavenly body. The Sun is worshiped by various religions. Bob loves the Sun and loves any object that is similar to the Sun. He noticed that he can find the shape of the Sun in certain graphs. He calls such graphs &quot;Sunny&quot;. </p> <p> We define the property &quot;Su...
p03009
<span class="lang-en"> <p>Score : <var>800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> squares arranged in a row, numbered <var>1</var> to <var>N</var> from left to right. Takahashi will stack building blocks on these squares, on which there are no blocks yet.</p> <...
p01034
<h1>Problem H: Yu-kun Likes a Directed Graph</h1> <h2>Background</h2> <p> 䌚接倧孊付属幌皚園はプログラミングが倧奜きな子䟛が集たる幌皚園である。園児の䞀人であるゆう君は、プログラミングず同じくらいお絵描きが倧奜きだ。 これたでゆう君は、䞞ず矢印で沢山絵を曞いおきた。矢印は必ず䞞ず䞞を結ぶようにしお描いおある。ある日ゆう君はこれらの絵がグラフであるこずを知る。 </p> <p> 䞞は頂点ず呌ばれ、矢印は蟺ず呌ばれおいるらしい。曎にゆう君は、矢印を描く際に、必ずその䞊に぀正の敎数を曞いおいた。このように、蟺に重みがあり有向な蟺からなるグラフは重み付き有向グラフ...
p00275
<H1>坊䞻めくりの結末</H1> <p> 癟人䞀銖の札を䜿った遊戯の぀に、「坊䞻めくり」ずいうものがありたす。絵札だけを䜿う簡単な遊戯なので広く楜したれおいたす。きたりには様々な掟生型がありたすが、ここで考える坊䞻めくりはN人の参加者で、以䞋のようなルヌルで行いたす。 </p> <ul> <li> 枚の「男」、枚の「坊䞻」、枚の「姫」、蚈枚の札を䜿う。</li> <li> 絵が芋えないように札を裏がえしにしおよく混ぜ、「札山」を぀くる。</li> <li> 参加者の䞀人目から順番に枚ず぀札山の札を匕く。N人目の次は、たた䞀人目から繰り返す。 <ul> <li> 匕いた札が男なら、匕い...
p02248
<H1>String Search</H1> <p> Find places where a string <var>P</var> is found within a text <var>T</var>. Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0. </p> <H2>Input</H2> <p> In the first line, a text <var>T</var> is given. In the second line, a string ...
p01937
<!-- - - - - - 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...
p00625
<H1><font color="#000000">Problem E:</font> Frisbee Dogs</H1> <p> クレむンは, 圌女の愛犬である Jack をフリスビヌドッグ倧䌚に出堎させようずしおいる. しかし, 圌女は Jack がよい成瞟を取れるか自信が無い. 圌女のために, 倧䌚をシミュレヌトしお Jack の成瞟を芋積もるプログラムを䜜成しおほしい. </p> <p> この倧䌚は, 2次元平面䞊にいる N 匹の犬によっお行われる. 倧䌚の開始時点においお, <i>i</i> 番目の犬は (<i>D<sub>i</sub>x</i>, <i>D<sub>i</sub>y</i>) の䜍眮にいる. <...
p02618
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For conven...
p00330
<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> コンピュヌタで扱われるデヌタの最小単䜍をビット(bit...
p01872
<h2>A: マむナンバヌ - My Number -</h2> <h3>問題</h3> <p>いっけなヌい遅刻遅刻</p> <p>あっ私、今日から憧れのこの䌚瀟で働くこずになったんだ</p> <p>それなのに、初日から寝坊だなんお </p> <p>今日は䌚瀟にマむナンバヌを教えなければならない倧切な日なのに </p> <p>みんな知っおいるず思うけれど、䞀応マむナンバヌの説明をするね</p> <p>マむナンバヌは行政手続きにおける個人を識別するために甚いられる <var>12</var> 桁からなる数字列 (<var>P_{11} P_{10} P_{9}</var> ... <var>P_{1...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
p01521
<h1>B - 簡易オセロ</h1> <h2>問題文</h2> <p> B君はオセロが倧奜きである (オセロのルヌルに぀いおは<a href="http://ja.wikipedia.org/wiki/%E3%82%AA%E3%82%BB%E3%83%AD_(%E9%81%8A%E6%88%AF)">Wikipediaのオセロのペヌゞ</a>を参照せよ「パス」に぀いおも Wikipedia に曞かれおいるずおり駒を打぀こずができない堎合のみパスできるものずしパスの回数に制限は無いものずする) B君は駒の初期配眮によっおゲヌムの結果がどのように倉わるのかに興味がある しかしいきなり 2 次元の盀面で考えるのは難しい...
p01171
<H1><font color="#000">Problem A:</font> Everlasting...?</H1> <p> Everlasting Sa-Ga, a new, hot and very popular role-playing game, is out on October 19, 2008. Fans have been looking forward to a new title of Everlasting Sa-Ga. </p> <p> Little Jimmy is in trouble. He is a seven-year-old boy, and he obtained the Everl...
p02474
<h2>Multiplication of Big Integers</h2> <p> Given two integers $A$ and $B$, compute the product, $A \times 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 product in a line. </p> <h3>Constraints</h3> <ul> <li>$-1 ...
p00449
<H1>船旅 </H1> <h2>問題</h2> <p> JOI囜にはn 島の島があり各島には 1 から n たでの番号が付けられおいる珟圚JOI囜では各島の間を結ぶ航路網の敎備が進んでいる </p> <p> あなたは船舶の切笊を扱っおいるチケットセンタヌに勀務しおいるJOI囜には船舶を䜿っおできる限り安䟡に島ず島の間を旅行したいず考えおいる人が沢山おり圌らは出発地ず目的地を泚文祚に蚘入しおあなたのずころに送っおくる </p> <p> あなたの仕事は客から泚文祚を受け取ったらすぐにいく぀かの船舶を乗り継いで出発地ず目的地を結ぶ航路の䞭でもっずも安䟡な運賃を蚈算し客に䌝えるこずである た...
p02024
<h2>J: 郜 (City)</h2> <p>サンタはある郜にプレれントを届けるこずにした。</p> <p>この郜は南北 $H$ 区画 × 東西 $W$ 区画に分けられた長方圢の圢をしおおり、各区画にプレれントを届ける家が 1 ぀ず぀ある。</p> <p>北から数えお $X$ 番目、西から数えお $Y$ 番目の区画を $(X, Y)$ で衚す。</p> <p>サンタは次の条件で移動する。</p> <ul> <li>はじめに区画 $(S, T)$ に降り、この堎所からスタヌトする。</li> <li>1 回の移動で東西南北に隣り合う区画に移動でき、街の倖には移動できない。</li> <li>1 床蚪ねた区画には、2 床ず入ら...
p00019
<H1>Factorial</H1> <p> Write a program which reads an integer <var>n</var> and prints the factorial of <var>n</var>. You can assume that <var>n</var> &le; 20. </p> <H2>Input</H2> <p> An integer <var>n</var> (1 &le; <var>n</var> &le; 20) in a line. </p> <H2>Output</H2> <p> Print the factorial of <var>n</var> in a ...
p01258
<H1><font color="#000">Problem I:</font> Memory Match</H1> <p> Memory match is a single-player game which employs a set of 2<i>M</i> cards. Each card is labeled with a number between 1 and <i>M</i> on its face. For each number <i>i</i> (1 &le; <i>i</i> &le; <i>M</i>), there are exactly two cards which have the number...
p03265
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a square in the <var>xy</var>-plane. The coordinates of its four vertices are <var>(x_1,y_1),(x_2,y_2),(x_3,y_3)</var> and <var>(x_4,y_4)</var> in counter-clockwise order. (Assume that the posi...
p01608
<h2>1</h2> <h2>Problem Statement</h2> <p>長さ<var>n</var>のビット列がある</p> <p>巊から<var>i</var>番目のビットが1のずきスコアを<var>a_i</var>点埗られる<br /> 巊から<var>i</var>番目のビットを䞭心に距離<var>w</var>以内にある1の個数(<var>=|\{j \in \{1,...,n\}∩\{i-w,...,i+w\} | 巊から</var>j<var>番目のビットが1\}|</var>)が奇数のずきスコアを<var>b_i</var>点埗られる</p> <p>スコアを最も倚く埗られるようなビット...
p03635
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>In <em>K-city</em>, there are <var>n</var> streets running east-west, and <var>m</var> streets running north-south. Each street running east-west and each street running north-south cross each other. We...
p02927
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Today is August <var>24</var>, one of the five Product Days in a year.</p> <p>A date <var>m</var>-<var>d</var> (<var>m</var> is the month, <var>d</var> is the date) is called a Product Day when <var>d</...
p03320
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Let <var>S(n)</var> denote the sum of the digits in the decimal notation of <var>n</var>. For example, <var>S(123) = 1 + 2 + 3 = 6</var>.</p> <p>We will call an integer <var>n</var> a <strong>Snuke numb...
p03770
<span class="lang-en"> <p>Score : <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke arranged <var>N</var> colorful balls in a row. The <var>i</var>-th ball from the left has color <var>c_i</var> and weight <var>w_i</var>.</p> <p>He can rearrange the balls by performing the follo...
p02862
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a knight - the chess piece - at the origin <var>(0, 0)</var> of a two-dimensional grid.</p> <p>When the knight is at the square <var>(i, j)</var>, it can be moved to either <var>(i+1,j+2)</var>...
p02161
<h1>Problem M: 1333</h1> <h2>Problem</h2> <p> 長さ$N$の文字列$S$が䞎えられる。 以䞋のク゚リを$Q$回凊理せよ。<br> <br>ク゚リ<br> $S[L: R]$を$S$の$L$文字目から$R$文字目たで䞡端を含むからなる文字列ずする。<br> $ S[L: R] $を適圓な文字列$A,B,C,X$を甚いお$AXBXCX(1 \leq |A|,|B|,|C|,|X|)$ ず衚すこずを考え、そのような$X$の䞭で最長のものの長さを出力する。<br> ただし、そのような$X$が存圚しない堎合は代わりに0を出力する。<br> </p> <h2>I...
p00633
<H1><font color="#000000">Problem 07:</font> Crop Circle</H1> <p> アルれンチンの広倧な蟲地に突劂ミステリヌサヌクルが出没した。ミステリヌサヌクルは重なっおいるもの、ポツンずあるもの、倧きいもの、小さいものず合蚈 <i>n</i> 個確認された。 </p> <p> あるミステリヌハンタヌが空䞭からミステリヌサヌクルの党䜓像を撮圱しようず詊みたずころ、各円の茪郭がはっきりしおいなかったため、映像にその矎しい暡様を映し出すこずが難しいこずが分かった。 </p> <p> そこで、そのミステリヌハンタヌは茪郭に沿っお特殊玠材の玐を蚭眮し、茪郭を匷調する提案をした。 <...
p01921
<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>F: 朚を隠すのなら森の䞭</h2> <h3>物語</h3> <p> 「朚はいいです」 喫茶店「タヌトルハりス」を経営するチコちゃんは、朚に䞊々ならぬ愛情を持っおいる。なんでも、朚の䞍動のあり方に心が掗われるらしい。。。そんなチコちゃんの朚ぞの愛情を確かめるため、同じ喫茶店で...
p00263
<H1>金剛の型</H1> <p> 以䞋のように、右から 7 ビット分が小数郚、続く24 ビット分が敎数郚で、䞀番巊の 1 ビット分を笊号郚ずする 32 ビット実数型を考える(b<sub>1</sub>, ... , b<sub>32</sub> は 0 か1 を衚す。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_kongoType1" width="780"> </center><br/> <p> この圢匏を、人が理解しやすい 10 進数衚珟に盎すずきは、以䞋のように解釈する。<br/> &nbsp;&n...
p00799
<H1><font color="#000">Problem D:</font> Pump up Batteries</H1> <p> Bill is a boss of security guards. He has pride in that his men put on wearable computers on their duty. At the same time, it is his headache that capacities of commercially available batteries are far too small to support those computers all day lon...
p01022
<h1>Problem G: Yu-kun Likes Building Block</h1> <h2>Background</h2> <p> 䌚接倧孊付属幌皚園はプログラミングが倧奜きな子䟛が集たる幌皚園である。園児の䞀人であるゆう君はプログラミングず同じくらい長方圢の積み朚が倧奜きだ。 そんなゆう君は、最近積み朚で山を䜜る遊びに熱䞭しおいる。 </p> <p> 今日もゆう君は山を䜜っお遊んでいたのだが、持っおいる積み朚で沢山の山を䜜る事は簡単なので、今日は党おの積み朚を䜿っお出来る山の数を最小化しようず考えた。 そこでゆう君は、実際に党おの積み朚を䜿っお山を䜜った埌、本圓にその山の数が最小になっおいるのかどうかを確かめるため...
p01472
<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?con...
p01188
<H1><font color="#000">Problem H:</font> Slippy Floors</H1> <p> The princess of the Fancy Kingdom has been loved by many people for her lovely face. However the witch of the Snow World has been jealous of the princess being loved. For her jealousy, the witch has shut the princess into the Ice Tower built by the witch...
p01167
<H1><font color="#000">Problem E:</font> Alice in Foxland</H1> <p> <i> - The world is made of foxes; people with watchful eyes will find foxes in every fragment of the world. </i> </p> <p> </i>Defoxyrenardnucleic Acids</i> (or DNAs for short) and <i>Renardnucleic Acids</i> (or RNAs) are similar organic molecules con...
p01537
<h1> Code Art Online</h1> <h2> G: コヌドアヌトオンラむン</h2> <p> コヌドアヌトオンラむンCAOは様々な問題をプログラミングによっお解くこずにより冒険を進めお行くオンラむンRPGである CAOは䞖界初のバヌチャルリアリティ空間を実珟したゲヌムであったこずもあり倧人気の内に完売しゲヌムを賌入したナヌザ達はこの䞖界を楜しむはずであった しかしゲヌムにダむブしたプレむダヌ達はゲヌムマスタヌから恐るべき蚗宣を聞かされる </p> <p> 「君たちプレむダヌの内の誰かがラストダンゞョンのラストプロブレムを解かない限りこの仮想空間から抜け出すこずはできないそしおこの䞖...
p00776
<h3>Encryption System</h3> <p> A programmer developed a new encryption system. However, his system has an issue that two or more distinct strings are `encrypted' to the same string. </p> <p> We have a string encrypted by his system. To decode the original string, we want to enumerate all the candidates of the stri...
p01864
<!--<script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script>--> <h2>G: 旅費支絊 - Travel Support -</h2> <h3>物語</h3> <p>私銙坂穂乃果16歳孊生アむドルをやっおいたす</p> <p>孊生アむドルの良さをみんなに䌝えるためのラむブをやろうずたくさんの孊生アむドルの人たちを呌んでアキバスタゞアムでラむブをしたす</p> <p>だけど遠くから来るラむブ参加者もいおずっおも電車賃がかかるのだからu’sのメンバヌでバむトをしお...
p03859
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a string <var>S</var> of length <var>N</var> consisting of characters <code>0</code> and <code>1</code>. You will perform the following operation for each <var>i = 1, 2, ..., m</var>:</p> <ul> ...
p00326
<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> あなたはナニヌクなオペレヌティングシステム「りン...
p02931
<span class="lang-en"> <p>Score : <var>800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> cards placed on a grid with <var>H</var> rows and <var>W</var> columns of squares.</p> <p>The <var>i</var>-th card has an integer <var>A_i</var> written on it, and it is placed on...
p03623
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke lives at position <var>x</var> on a number line. On this line, there are two stores <var>A</var> and <var>B</var>, respectively at position <var>a</var> and <var>b</var>, that offer food for deliv...
p03789
<span class="lang-en"> <p>Score : <var>1300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We will call a non-negative integer <em>increasing</em> if, for any two adjacent digits in its decimal representation, the digit to the right is greater than or equal to the digit to the left. For exam...
p03273
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a grid of squares with <var>H</var> horizontal rows and <var>W</var> vertical columns. The square at the <var>i</var>-th row from the top and the <var>j</var>-th column from the left is represe...
p02032
<h2>C: 玄数ゲヌム / Divisor Game</h2> <h3>問題</h3> <p>tsutaj くんは玄数ゲヌムで遊がうずしおいたす。</p> <p>玄数ゲヌムでは、たず <var>2</var> 以䞊の自然数 <var>N</var> が䞎えられ、その埌は以䞋の手順でゲヌムが進んでいきたす。</p> <ul> <li> <var>N</var> 以倖の <var>N</var> の玄数の䞭から、敎数を <var>1</var> ぀宣蚀する。ただしこのずき、既に宣蚀したこずがある敎数の玄数になるものは宣蚀できない。</li> <li> 宣蚀できる敎数がある限りこれを繰り返し、宣蚀できるものがなければゲヌムは終了す...
p02198
<h2>アルミ猶の䞊にあるミカン (Oranges on Cans)</h2> <p>square1001 君は、テヌブルにアルミ猶を $N$ 猶眮きたした。</p> <p>E869120 君は、テヌブル䞊のそれぞれのアルミ猶の䞊に $M$ 個ず぀ミカンを乗せたした。</p> <p>アルミ猶の䞊に乗っおいるミカンは党郚で䜕個ありたすか</p> <h3>入力</h3> <p>入力は以䞋の圢匏で暙準入力から䞎えられる。</p> <pre> $N$ $M$ </pre> <h3>出力</h3> <p>アルミ猶の䞊に乗っおいるミカンの数を 1 行で出力しおください。</p> <p>ただし、最埌には改行を入れるこず。</p> <h3>制玄<...
p02462
<h1>Multi-Map</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>multiple elements can have equivalent keys</u>. </p> <ul> <li>insert($key$, $x$): Insert an element formed by a pair of $key$ and $x$ ...
p02177
<h1>C: 同倀呜題</h1> <h2>問題</h2> <p> $N$ 個の呜題があり, それぞれ $1, 2, \cdots,N$ ずいう名前が぀いおいる. </br> たた, 呜題に関する情報が $M$ 個䞎えられる. $i$ 番目の情報は「$a_i$ $b_i$」ずいう圢匏で䞎えられ, これは $a_i$ ならば $b_i$ であるこずを衚す.「ならば」は論理包含であり、掚移埋が成り立぀</br> 各呜題 $i$ に察しお $i$ ず同倀な呜題を党お昇順に出力せよ.</br> ただし呜題 $i$ ず呜題 $i$ は垞に同倀である.</br> 呜題 $X$ ず呜題 $Y$ が同倀ずは,「$X$ ...
p00849
<H1><font color="#000">Problem E:</font> Manhattan Wiring</H1> <p> There is a rectangular area containing <i>n</i> &times; <i>m</i> cells. Two cells are marked with "2", and another two with "3". Some cells are occupied by obstacles. You should connect the two "2"s and also the two "3"s with non-intersecting lines. L...
p02874
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><var>10^9</var> contestants, numbered <var>1</var> to <var>10^9</var>, will compete in a competition. There will be two contests in this competition.</p> <p>The organizer prepared <var>N</var> problems,...
p03766
<span class="lang-en"> <p>Score : <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>How many infinite sequences <var>a_1, a_2, ...</var> consisting of {<var>{1, ... ,n}</var>} satisfy the following conditions?</p> <ul> <li>The <var>n</var>-th and subsequent elements are all equal. Tha...
p03336
<span class="lang-en"> <p>Score : <var>2400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi and Aoki love calculating things, so they will play with numbers now.</p> <p>First, they came up with one positive integer each. Takahashi came up with <var>X</var>, and Aoki came up with <va...
p01425
<H1>White Bird</H1> <p> Angry Birds is a mobile game of a big craze all over the world. You were convinced that it was a waste of time to play the game, so you decided to create an automatic solver. </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE_2308-bird-3"> </center> <p> You are ...
p03418
<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...
p01075
<h1>Problem D: One-Time Path</h1> <h2>Problem</h2> <p> <var>N</var>個の島ず<var>M</var>本の橋がある。 <var>N</var>個の島にはそれぞれ1から<var>N</var>たでの番号が割り振られおいる。 <var>M</var>本の橋にもそれぞれ1から<var>M</var>たでの番号が割り振られおいる。 </p> <p> がっちょ君は珟圚(時刻0の時点で)、1番目の島にいる。 がっちょ君は<var>i</var>番目の橋を利甚するこずにより、<var>a<sub>i</sub></var>番目の島から<var>b<sub>i</sub></...
p03048
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:</p> <ul> <li>Red boxes, each containing <var>R</var> red balls</li> <li>Green boxes, each...
p02209
<h2>カヌドはおや぀に入りたすか(Are Cards Snacks?)</h2> <p>square1001君は $N$ 枚のカヌドを持っおいたす。</p> <p>これらのカヌドにはそれぞれ敎数が曞かれおおり、$i$ 枚目のカヌドに曞かれおいる敎数は $A_i$ です。</p> <p>square1001君の今日の乱数は $K$ です。square1001君はこれらの $N$ 枚のカヌドの䞭から䜕枚かのカヌドを遞び、合蚈が $K$ ずなるようにしたいです。</p> <p>この様子を芋おいたE869120君は、これを阻止したいず考えたした。</p> <p>具䜓的には、事前に䜕枚かのカヌドを食べるこずで、square1001 君がど...
p00234
<H1>䌚接の埋蔵金</H1> <p> 䌚接には叀くから䌝わる埋蔵金の䌝説がありたす。あなたは、遂に埋蔵金が埋たっおいる堎所を突き止めたした。埋蔵金が埋たっおいる深さ、掘り進める地局の状態が分かっおいるので、綿密に蚈画を立おれば最小費甚で埋蔵金たで到達するこずができたす。そこであなたは、地局の状態を読み取っお埋蔵金の埋たっおいる深さたで最小費甚で到達するルヌトを算出するプログラムを䜜成するこずにしたした。 </p> <p>地局の状態は 2 次元栌子状に配眮されたセルで衚わされ、各セルの䜍眮は座暙 (x,y) で衚されたす。巊䞊を (1,1) ずし、x 座暙は右に行くに぀れお倧きくなり、y 座暙は䞋に深くなるに぀れお倧きく...
p02659
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Compute <var>A \times B</var>, truncate its fractional part, and print the result as an integer.</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>0 \leq A \leq 10^{15...
p00664
<H1>Problem F: Cosmic Market</H1> <p> Cosmic market(コズミック・マヌケット)、通称コズミケ、は党宇宙最倧芏暡の同人即売䌚だ。 コズミケにはあらゆるゞャンルの同人愛奜家達が集う。 近幎、コズミケぞの来堎者は増加傟向にある。 最初から党おの人が入堎できるず倧倉混雑しお危険なので、開堎盎埌は入堎芏制を行っおいる。 ある䞀定人数の人だけが開堎ず同時に入堎するこずが出来るのだ。 それ以倖の人たちはしばらく埅っおからの入堎ずなっおいる。 </p> <p> しかし先着順に䌚堎に入るこずにするず、培倜で前日から䞊ぶ人が出おしたう。 コズミケの参加者には未成幎も倚く、治安䞊の問題もあるので先...
p01976
<h1>C: 䞀臎</h1> <h2>問題</h2> <p> 長さ $N$ の数列 $a_i$ が䞎えられる。 次の条件を満たす敎数 $K (1 \le K \le N)$ を党お出力せよ。 </p> <p> 条件: $a_1, \cdots, a_K$ をうたく䞊び替えるず $a_{N-K+1}, \cdots, a_N$ ず䞀臎する。 </p> <h2>制玄</h2> <ul> <li>$1 \le N \le 10^5$</li> <li>$1 \le a_i \le 10^9$</li> <li>入力は党お敎数</li> </ul> <h2>入力:</h2> <p> $N$<br> $a_1 \cdots a_N$...
p00371
<H1>Lottery Box</H1> <p> A lottery is being held in a corner of the venue of the Aizu festival. Several types of balls are inside the lottery box and each type has its unique integer printed on the surfaces of the balls. An integer <var>T</var> is printed on the lottery box. </p> <p> In the lottery, you first declare...
p01999
<h1>D: 遭難</h1> <h2>問題</h2> <p> $H * W$ のグリッドで衚される地図が䞎えられる。 各マスは '#' か '.' であり、前者は陞地であるこずを、埌者は海であるこずを瀺しおいる。 </p> <p> 以䞋のように䞊䞋巊右に隣接しおいる陞地の集合を島ず呌ぶ。 </p> <pre> ..... .###. ..##. ..#.. ..... </pre> <p>陞地 $6$ マスの島。</p> <pre> ...... .##.#. ....#. ...... </pre> <p>陞地 $2$ マスの島が $2$ ぀。</p> <p> 䞎えられる地図は、以䞋の条件を満たす。 ...
p00721
<h1><font color="#000">Problem F:</font> Cleaning Robot</h1> <p> Here, we want to solve path planning for a mobile robot cleaning a rectangular room floor with furniture. </p> <p> Consider the room floor paved with square tiles whose size fits the cleaning robot (1 &times; 1). There are 'clean tiles' and 'dirty til...