question_id
stringlengths
6
6
content
stringlengths
1
27.2k
p00084
<H1>検索エンジン</H1> <p> インターネットの検索エンジン、例えば、Google などでは、世界中のウェブページを自動で収捨して分類し、巨大なデータベースを作成します。また、ユーザが入力した検索キーワードを解析して、データベース検索のための問い合わせ文を作成します。 </p> <p> いずれの場合も、効率的な検索を実現するために複雑な処理を行っていますが、とりあえずの基本は全て文章からの単語の切り出しです。 </p> <p> ということで、文章からの単語の切り出しに挑戦してください。今回は以下の通り、単語区切りが明確な英語の文章を対象とします。 </p> <ul> <li> 対象となる文章 : 改行を含まない...
p02543
<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> points on a number line, <var>i</var>-th of which is placed on coordinate <var>X_i</var>. These points are numbered in the increasing order of coordinates. In other words, for all...
p02810
<span class="lang-en"> <p>Score : <var>1100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Niwango bought a piece of land that can be represented as a half-open interval <var>[0, X)</var>.</p> <p>Niwango will lay out <var>N</var> vinyl sheets on this land. The sheets are numbered <var>1,2, ...
p03702
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are going out for a walk, when you suddenly encounter <var>N</var> monsters. Each monster has a parameter called <em>health</em>, and the health of the <var>i</var>-th monster is <var>h_i</var> at t...
p00987
<h2>One-Way Conveyors</h2> <p> You are working at a factory manufacturing many different products. Products have to be processed on a number of different machine tools. Machine shops with these machines are connected with conveyor lines to exchange unfinished products. Each unfinished product is transferred from a m...
p01695
<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> <!-- begin en only --> <h3><u...
p03352
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a positive integer <var>X</var>. Find the largest <em>perfect power</em> that is at most <var>X</var>. Here, a perfect power is an integer that can be represented as <var>b^p</var>, where ...
p02390
<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>Watch</H1> <p> Write a prog...
p00657
<H1>Problem K: Rearranging Seats</H1> <p> Haruna is a high school student. She must remember the seating arrangements in her class because she is a class president. It is too difficult task to remember if there are so many students. </p> <p> That is the reason why seating rearrangement is depress task for her. But st...
p03978
<span class="lang-en"> <p>Score : <var>150</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p> There is a long blackboard with <var>2</var> rows and <var>N</var> columns in a classroom of Kyoto University. This blackboard is so long that it is impossible to tell which cells are already use...
p01945
<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...
p00207
<H1>ブロック</H1> <p> A さんの家に親戚の B 君がやってきました。彼は 3 歳でブロックが大好きです。彼が持っているブロックは図 1 のような形をしています。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_blockMaze1"> <p> 図1 </p> </center> <p> B 君はボードの上にブロックを敷き詰めています。彼に「何を作っているの?」と聞くと、彼は「迷路!!」と元気よく答えました。彼の言う迷路とは、スタートからゴールまで側面が接している、同じ色のブロックだけでたどることが...
p03581
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><var>A + B</var> balls are arranged in a row. The leftmost <var>A</var> balls are colored red, and the rightmost <var>B</var> balls are colored blue.</p> <p>You perform the following operation:</p> <ul...
p01046
<h1>Problem J: Yu-kun Likes a lot of Money</h1> <h2>Background</h2> <p> 会津大学付属幼稚園はプログラミングが大好きな子供が集まる幼稚園である。園児の一人であるゆう君は、プログラミングと同じくらいお金が大好きだ。ゆう君は、今日もお金を稼ぐために財宝の眠る島を訪れた。ゆう君は事前に財宝のありかの描かれた地図を手に入れている。その地図をもとに出来るだけ多くのお金を稼ぎたい。ゆう君は最大でどのくらいお金を手に入れることができるだろうか? </p> <h2>Problem</h2> <p> 地図、ゆう君の初期位置、財宝の種類とそれらから得られるお金、そして小さい岩を...
p01416
<H1>J: Tiles are Colorful</H1> <p> ICPC で良い成績を収めるには修行が欠かせない.うさぎは ICPC で勝ちたいので,今日も修行をすることにした. </p> <p> 今日の修行は,流行りのパズルをすばやく解いて,瞬発力を鍛えようというものである.今日挑戦するのは,色とりどりのタイルが並んでいてそれらを上手く消していくパズルだ </p> <p> 初期状態では,グリッド上のいくつかのマスにタイルが置かれている.各タイルには色がついている.プレイヤーはゲーム開始後,以下の手順で示される操作を何回も行うことができる. </p> <ol> <li>タイルが置かれていないマスを 1 つ選択し,そのマス...
p01103
<h3><u>A Garden with Ponds</u></h3> <p> Mr. Gardiner is a modern garden designer who is excellent at utilizing the terrain features. His design method is unique: he first decides the location of ponds and design them with the terrain features intact. </p> <p> According to his unique design procedure, all of hi...
p01553
<h1>問題名 箱根駅伝</h1> <p>日本のお正月の風物詩に箱根駅伝があります。箱根駅伝は、各チーム 10 人の走者が中継所ごとに襷をつなぎながらゴールを目指すというものです。テレビの放送では中継所で各チームの通過順位と共に前の中継所からの順位変動が表示されます。そこで、それを見て前の中継所の各チームの通過順として考えられるものが何通りあるか答えてください。ありえた通過順の数は非常に大きくなりうるので、1,000,000,007 で割った余りで答えて下さい。 </p> <h2>Input</h2> <p>入力は以下の形で与えられます </p><blockquote> <var>n</var><br><var>c<sub>1<...
p03094
<span class="lang-en"> <p>Score : <var>1800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a round pizza. Snuke wants to eat one third of it, or something as close as possible to that.</p> <p>He decides to cut this pizza as follows.</p> <p>First, he divides the pizza into <var>N</var...
p00712
<h1> <font color="#000">Problem C:</font> Unit Fraction Partition </h1> <p> A fraction whose numerator is 1 and whose denominator is a positive integer is called a unit fraction. A representation of a positive rational number <I>p</I>/<I>q</I> as the sum of finitely many unit fractions is called a <I>partition</I> ...
p01800
<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 Runner and Sniper</h...
p00342
<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</var> 個の異なる自然数が...
p02685
<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> blocks arranged in a row. Let us paint these blocks.</p> <p>We will consider two ways to paint the blocks different if and only if there is a block painted in different colors in ...
p03997
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a trapezoid. The lengths of its upper base, lower base, and height are <var>a</var>, <var>b</var>, and <var>h</var>, respectively.</p> <div style="text-align: center;"> <img src="https://a...
p00196
<H1>野球大会</H1> <p> 野球の国別対抗戦 WBC で、日本が2連覇達成!! 野球人気が高まる中、会津学園高校を会場に野球大会が行われました。この大会では、総当りのリーグ戦を行い、以下のような方法で順位を決めることになりました。 </p> <ol> <li> 勝ち数の多いチームを上位とする</li> <li> 勝ち数が同数の場合は負け数の少ないチームを上位とする</li> </ol> <p> 各チームの成績を入力とし、チーム名を上位のチームから順に出力するプログラムを作成してください。同順位のチームが存在する場合は、入力順に出力してください。ただし、チーム数 <var>n</var> は 2 以上 10 以...
p02451
<h1>Binary Search</h1> <p> For a given sequence $A = \{a_0, a_1, ..., a_{n-1}\}$ which is sorted by ascending order, find a specific value $k$ given as a query. </p> <h2>Input</h2> <p> The input is given in the following format. </p> <pre> $n$ $a_0 \; a_1 \; ,..., \; a_{n-1}$ $q$ $k_1$ $k_2$ : $k_q$ </pre> <...
p02001
<h1>F: Swap</h1> <h2>問題</h2> <p> 長さ $N$ の文字列 $S,\ T$ が与えられます.$S,\ T$ はそれぞれ 'o' , '.' の二種類の文字だけで構成されています. あなたは $S$ に対して,以下の操作を行うことができます. </p> <p> <ul> <li> 以下の条件を全て満たす整数対 $(l, r)$ を選択する.その後,$S[l]$ と $S[l + 1],S[r - 1]$ と $S[r]$ をそれぞれスワップする.</li> <ul> <li>$1 \leq l, r \leq N$</li> <li>$r - l \...
p00895
<H1><font color="#000">Problem B: </font>The Sorcerer's Donut </H1> <p> Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore f...
p01787
<h2>H - RLE Replacement</h2> <h3>Problem Statement</h3> <p> In JAG Kingdom, ICPC (Intentionally Compressible Programming Code) is one of the common programming languages. Programs in this language only contain uppercase English letters and the same letters often appear repeatedly in ICPC programs. Thus, programmers i...
p03240
<span class="lang-en"> <p>Score: <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.<br/> The pyramid had <em>center coordinates</em> <var>(C_X, C_Y)</var> and <e...
p02902
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a directed graph <var>G</var> with <var>N</var> vertices and <var>M</var> edges.<br/> The vertices are numbered <var>1</var> to <var>N</var>, and the <var>i</var>-th edge is directed from Verte...
p03610
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a string <var>s</var> consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmo...
p01338
<h1><font color="#000">Problem F:</font> KULASIS</h1> <h2>Description</h2> <p> <i>  KULASISとは,全学共通科目に関する情報をWeb化し,学生・教員への支援やサービスの向上を目的に,高等教育研究開発推進機構で開発・運用しているシステムの名称です。 KULASISは2003年度のオンラインシラバス開発から始まり,Web掲示板・履修登録・成績関係(採点登録・学生からの採点確認)と順次システムを拡充してきました。<br>  学生はパソコン・携帯電話から学内外を問わず,教務情報(休講・授業変更・レポート)の確認・履修登録・採点確認等の機能を利用する...
p03305
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Kenkoooo is planning a trip in Republic of Snuke. In this country, there are <var>n</var> cities and <var>m</var> trains running. The cities are numbered <var>1</var> through <var>n</var>, and the <var>...
p02847
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a string <var>S</var> representing the day of the week today.</p> <p><var>S</var> is <code>SUN</code>, <code>MON</code>, <code>TUE</code>, <code>WED</code>, <code>THU</code>, <code>FRI</code>, ...
p01768
<h1 id="c-shopping-買い物">C : Shopping / 買い物</h1> <h2 id="問題文">問題文</h2> <p>料理が得意な2D君は昼ごはんを作ろうとしている。料理には <var>N</var> 個の材料 <var>a_{0}, a_{1}, … , a_{N&minus;1}</var> が全てが必要である。</p> <p>さて、今2D君の家の冷蔵庫には一つも材料が入っていないので、スーパーに買いに行かなければならない。スーパーでは材料 <var>a_{i}</var> を値段 <var>x_{i}</var> 円で買うことができる。</p> <p>2D君は魔法使いでもあり、 <var>M<...
p03755
<span class="lang-en lang-child hidden-lang"> <div id="task-statement"> Max Score: <var>1000</var> Points <br/> <section> <h3>Problem Statement</h3> There is a railroad company in Atcoder Kingdom, "Atcoder Railroad". <br/> There are <var>N + 1</var> stations numbered <var>0, 1, 2, ..., N</var> along a rai...
p01292
<H1><font color="#000">Problem J:</font> Secret Operation</H1> <p> Mary Ice is a member of a spy group. She is about to carry out a secret operation with her colleague. </p> <p> She has got into a target place just now, but unfortunately the colleague has not reached there yet. She needs to hide from her enemy George...
p00529
<h2>JOIOI の塔(Tower of JOIOI)</h2> <p> JOIOI の塔とは,1 人で遊ぶ円盤を使ったゲームである. </p> <p> このゲームは,<span>J</span>,<span>O</span>,<span>I</span> のいずれかの文字が書かれたいくつかの円盤を用いて行う.円盤は直径が互いに異なり,ゲーム開始時にはこれらの円盤は直径の大きいものから順に下から上に向かって積まれている.あなたは,これらの円盤を用いて,出来るだけ多くのミニ JOIOI の塔を作りたい.ミニ JOIOI の塔とは 3 枚の円盤からなり,円盤の直径が小さいものから順に読んで <span>JOI</span>...
p02144
<h1>Problem H: Loss</h1> <h2>Problem</h2> <p> あなたは、とある会社からプログラムの作成を依頼された。 その会社には$N$個の仕事があり、それぞれの仕事には$1$から$N$までの番号が振られている。 仕事$i$には、$M_i$個の前提となる仕事$X_{i,j}$が存在し、仕事$i$を前提となる仕事$X_{i,j}$よりも先に行うと、仕事$i$は多大な損失を被る。 </p> <p>そこであなたには、損失を被る仕事の数が最小となるような順番ですべての仕事を行ったときの損失を被った仕事の数を求めてもらいたい。</p> <h2>Input</h2> <p>入力は以下の形式ですべて整...
p00179
<H1>ふしぎな虫</H1> <p> 会津生物学研究所のA博士は、とある南の島でふしぎな虫を発見しました。形は芋虫のように細長いのですが、ひとつの体節が玉のような形をしているので、糸でつないだビーズ玉のように見えます。ふしぎなのは体の色に様々なバリエーションがあることと、なかには時間がたつにつれて体の色が変っていく虫がいることでした。どの虫の体節の色も赤か緑か青のどれかに限られるようですが、1 秒ごとに体節の色が変わっていき、最後にはすべての体節が同じ色になって落ち着く場合もあれば、いつまで待ってもずっと色が変わりつづける場合もあるようでした。 </p> <center> <img src="https://judgeap...
p00483
<H1> 惑星探査(Planetary Exploration) </H1> <p> あなたを乗せた超時空移民船は長旅の末,ついに居住可能と思われる惑星を発見した.JOI 星と名付けられたその惑星は,その名の通り「ジャングル(Jungle)」,「海(Ocean)」,「氷(Ice)」の3 種類の地形が入り組んだ過酷な惑星である.簡単な調査により,居住予定地近辺の地図が作成された.居住予定地は南北<i>M</i> km, 東西<i>N</i> km の長方形の形をしており, 1 km 四方の正方形の区画に分けられている.区画は全部で<i>MN</i> 個あり,北から<i>p</i> 行目,西から<i>q</i> 列目の区画を(<...
p01441
<H1><font color="#000">Problem E:</font> Full Text Search</H1> <p> Mr. Don is an administrator of a famous quiz website named QMACloneClone. The users there can submit their own questions to the system as well as search for question texts with arbitrary queries. This search system employs bi-gram search method. </p> ...
p03186
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi has <var>A</var> untasty cookies containing antidotes, <var>B</var> tasty cookies containing antidotes and <var>C</var> tasty cookies containing poison.</p> <p>Eating a cookie containing poiso...
p01011
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <h1>Problem F: Prize Game</h1> <h2>Problem</h2> <p> 新しいゲームセンターが開店することになった。たくさんのお客さんを取り入れるために、全く新しいプライズゲームを設置することになった。 </p> <p> このプライズゲームは<var>R</var>&times;<var>C</var>のグリッドから構成される。各マスは空白か、1〜18のいずれかの数字が書かれている。プレイヤーはひとつの空白のマスを選択し、そのマスの景品を獲得できる。ただし、マスにある景品は...
p00250
<H1>スコーン配達計画</H1> <p> 愛歌さんの家は、小さな喫茶店を経営しています。愛歌さんのお母さんが焼くスコーンはとても美味しくて、店はとても繁盛していました。 </p> <p> ウェイトレスである愛歌さんの仕事の一つは、次々と焼き上がるスコーンを、お客様の席まで届けることです。焼きあがったスコーンはお盆の上に乗せられ、カウンターの上に一列に並べられます。<var>i</var> 番目のお盆の上に乗っているスコーンの数を <var>K<sub>i</sub></var> としましょう。愛歌さんは、それぞれのお客様にちょうど <var>m</var> 個のスコーンを運ばなければなりません。愛歌さんは一度にいくつでも...
p02797
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are three integers <var>N</var>, <var>K</var>, and <var>S</var>.</p> <p>Find a sequence <var>A_1, A_2, ..., A_N</var> of <var>N</var> integers between <var>1</var> and <var>10^9</var> (inclusive) ...
p03885
<span class="lang-en"> <p>Score : <var>1500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><style> #nck { width: 30px; height: auto; } </style> <p>Snuke received two matrices <var>A</var> and <var>B</var> as birthday presents. Each of the matrices is an <var>N</var> by <var>N<...
p00600
<H1><font color="#000000">Problem F:</font> Computation of Minimum Length of Pipeline</H1> <p> The Aizu Wakamatsu city office decided to lay a hot water pipeline covering the whole area of the city to heat houses. The pipeline starts from some hot springs and connects every district in the city. The pipeline can fork...
p01912
<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>H: ジャンプパーティ</h1> <h2>問題</h2> <p> とあるダンスホールで $N$ 人の参加するダンスパーテ...
p00315
<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> 会津タカダ市が生産販売する布製コースターは、対称なデザ...
p02328
<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>Largest Rectangle in a Histogram</H1> <p> ...
p02282
<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>Reconstruction of a Tree</H...
p00745
<h1><font color="#000000">Problem F:</font> Tighten Up!</h1> <p> We have a flat panel with two holes. Pins are nailed on its surface. From the back of the panel, a string comes out through one of the holes to the surface. The string is then laid on the surface in a form of a polygonal chain, and goes out to the pa...
p02778
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Given is a string <var>S</var>. Replace every character in <var>S</var> with <code>x</code> and print the result.</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3> <ul> <li><var>S...
p01857
<h1 id="f-卵-eggs">F : 卵 / Eggs</h1> <h2 id="問題文">問題文</h2> <p><var>1</var> か月前のことである. 小学生の肉西君は夏休みの宿題をやっていなかった. そこで自由研究は家にあった卵の強度を調べることにした.</p> <p>この研究において,卵を高さ <var>H</var> から落としても割れず, 高さ <var>H+1</var> から落とすと割れるとき, その卵の強度は <var>H</var> であると定義する. ここで <var>H</var> は非負整数であり,非負整数以外の高さから落とすことは無いとする. 肉西くんは卵を <var>1</var...
p03539
<span class="lang-en"> <p>Score : <var>1000</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Consider the following game:</p> <ul> <li>The game is played using a row of <var>N</var> squares and many stones.</li> <li>First, <var>a_i</var> stones are put in Square <var>i\ (1 \leq i \leq N)</var>...
p01504
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <H1>AYBABTU</H1> <p> There is a tree that has <var>n</var> nodes and <var>n-1</var> edges. There are military bases on <var>t</var> out of the <var>n</var> nodes. We want to disconnect the bases as much as possible by destroying <var>k</var> edges. The t...
p03493
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a grid consisting of three squares numbered <var>1</var>, <var>2</var> and <var>3</var>. In each square, either <code>0</code> or <code>1</code> is written. The number written in Square <var>i...
p03169
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> dishes, numbered <var>1, 2, \ldots, N</var>. Initially, for each <var>i</var> (<var>1 \leq i \leq N</var>), Dish <var>i</var> has <var>a_i</var> (<var>1 \leq a_i \leq 3</var>) pie...
p01154
<H1><font color="#000">Problem I:</font> Light The Room</H1> <p> You are given plans of rooms of polygonal shapes. The walls of the rooms on the plans are placed parallel to either <i>x</i>-axis or <i>y</i>-axis. In addition, the walls are made of special materials so they reflect light from sources as mirrors do, bu...
p01343
<H1><font color="#000">Problem E: </font>Psychic Accelerator</H1> <p> In the west of Tokyo, there is a city named “Academy City.” There are many schools and laboratories to develop psychics in Academy City. </p> <p> You are a psychic student of a school in Academy City. Your psychic ability is to give acceleration t...
p02996
<span class="lang-en"> <p>Score: <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.</p> <p>Let the current time be time <var>0</va...
p03684
<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> towns on a plane. The <var>i</var>-th town is located at the coordinates <var>(x_i,y_i)</var>. There may be more than one town at the same coordinates.</p> <p>You can build a road...
p00801
<H1><font color="#000">Problem F:</font> Numoeba</H1> <p> A scientist discovered a strange variation of amoeba. The scientist named it <i>numoeba</i>. A numoeba, though it looks like an amoeba, is actually a community of cells, which always forms a tree. </p> <p> The scientist called the cell <i>leader</i> that is at...
p01713
<h1>問題 B : Evacuation Route</h1> <h2>問題文</h2> <p> 日本では防災研究が盛んに行われており,近年その重要性がますます増している. 避難経路の評価も重要な研究のひとつである. 今回は直線状の通路の安全評価を行う. </p> <p> 通路は <var>W</var> 個のユニットに分けられており,一方の端のユニットからもう一方の端のユニットまで <var>0, &thinsp;1, &thinsp;2, &thinsp;…&thinsp;, &thinsp;W-1</var> の番号がつけられている. 通路内の各ユニットには,入口の扉,出口の扉,防火扉のいずれか1つが存在する. 入...
p00552
<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> <h2>断層(Geologic Fault)</h2> <p> 遠い昔,IOI 文明という...
p02095
<h2>H: Colorful Tree</h2> <h3>Story</h3> <p> <i>Yamiuchi</i> (assassination) is a traditional event that is held annually in JAG summer camp. Every team displays a decorated tree in the dark and all teams' trees are compared from the point of view of their colorfulness. In this competition, it is allowed to cut the o...
p00102
<H1>Matrix-like Computation</H1> <p> Your task is to develop a tiny little part of spreadsheet software. </p> <p> Write a program which adds up columns and rows of given table as shown in the following figure: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640"> <...
p00417
<h1>コンピュータシステムの不具合</h1>   <p> あなたは世界最高性能のコンピュータシステム「那由多(なゆた)」を設計している。しかし、このシステムのプロトタイプの実装中に、命令列がある条件を満たすとシステムが停止するという不具合が見つかった。 </p> <p> このシステムは、長さ$N$の命令列をプログラムとして与えることで動作する。命令列の中の$m$番目の命令を数$X_m$で表したとき、不具合が起こる条件は、ある整数$i,j$ ($2 \leq i<j \leq N$)に対して$X_i + X_{j-1} = X_j + X_{i-1}$となる命令のパターンが命令列に存在することであると判明した。 </p> <p>...
p02580
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a two-dimensional grid with <var>H \times W</var> squares. There are <var>M</var> targets to destroy in this grid - the position of the <var>i</var>-th target is <var>\left(h_i, w_i \right)</var...
p00047
<H1>カップゲーム</H1> <center> <table> <tr> <td><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_cupGame"></td> </tr> </table> </center> <br/> <p> 3 つのカップがふせて置かれています。カップの置かれている場所を、順に A,B,C と呼ぶことにします。最初は A に置かれているカップの中にボールが隠されているとします。カップの位置を入れ替えると、中に入っているボールも一緒に移動します。 </p> <p> 入れ替える2つのカップの位置を読み込んで、最終的にどの場...
p04004
<span class="lang-en"> <p>Score : <var>1100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Alice, Bob and Charlie are playing <em>Card Game for Three</em>, as below:</p> <ul> <li>At first, each of the three players has a deck consisting of some number of cards. Alice's deck has <var>N</var> ...
p01206
<H1><font color="#000">Problem E:</font> Black Force</H1> <p> A dam construction project was designed around an area called Black Force. The area is surrounded by mountains and its rugged terrain is said to be very suitable for constructing a dam. </p> <p> However, the project is now almost pushed into cancellation b...
p03391
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given sequences <var>A</var> and <var>B</var> consisting of non-negative integers. The lengths of both <var>A</var> and <var>B</var> are <var>N</var>, and the sums of the elements in <var>A</var...
p02979
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a blackboard on which all integers from <var>-10^{18}</var> through <var>10^{18}</var> are written, each of them appearing once. Takahashi will repeat the following sequence of operations any ...
p00944
<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 Post Office Investig...
p01656
<h2>A - 旧総合研究7号館</h2> <p> 時は平成50年春休み.情報学研究科に所属する京子さんは,京都にある某研究パークからの研究室の引越しがやっと終わり,ホッと一息ついていた. 今回の引越しは,古くなった校舎の改修工事によるもので,新年度から工事に伴い校舎の名前が変更されることになっている. </p> <p> ホッとしていたのもつかの間,京子さんは先生から大学の資料に載っている校舎名を新しい名前に変更するお仕事を頼まれてしまった. しかし編集しなければならない資料には,今までの担当者が仕事を怠っていたせいか,ひとつ古い名前よりもっと古い名前が使われているものもあった. </p> <p> なんとか京子さんは,平...
p00694
<h1> Strange Key </h1> <p> Professor Tsukuba invented a mysterious jewelry box that can be opened with a special gold key whose shape is very strange. It is composed of gold bars joined at their ends. Each gold bar has the same length and is placed parallel to one of the three orthogonal axes in a three dimensional...
p01986
<h3>対空シールド</h3> <!-- begin ja only --> <p>時は3xxx年,太陽系外の惑星に進出した人類は,大量の隕石の飛来による基地の被害で頭を悩ませていた.国際宇宙防護会社(International Cosmic Protection Company)は,この問題を解決するために新たな対空シールドを開発した.</p> <p>防護対象の基地は同じサイズの <i>N</i> 個のユニットが一直線上に等間隔で並んだ形をしており, 1 から <i>N</i> までの番号が順に付けられている.ICPCは,これらのユニットに,合計で <i>M</i> 個のシールドを設置することにした.<i>i</i> 番目のシ...
p02353
<H1>RSQ and RUQ</H1> <p> Write a program which manipulates a sequence $A$ = {$a_0, a_1, ..., a_{n-1}$} with the following operations: </p> <p> <ul> <li> $update(s, t, x)$: change $a_s, a_{s+1}, ..., a_t$ to $x$.</li> <li> $getSum(s, t)$: print the sum of $a_s, a_{s+1}, ..., a_t$.</li> </ul> </p> <p> ...
p02703
<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> cities numbered <var>1</var> to <var>N</var>, connected by <var>M</var> railroads.</p> <p>You are now at City <var>1</var>, with <var>10^{100}</var> gold coins and <var>S</var> s...
p03811
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> integers written on a blackboard. The <var>i</var>-th integer is <var>A_i</var>.</p> <p>Takahashi and Aoki will arrange these integers in a row, as follows:</p> <ul> <li>First, T...
p01085
<h2>Entrance Examination</h2> <p> The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination. </p> <p> The successful applicants of the examination are chosen as follows. </p> <ul> <li>The s...
p03542
<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...
p03112
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Along a road running in an east-west direction, there are <var>A</var> shrines and <var>B</var> temples. The <var>i</var>-th shrine from the west is located at a distance of <var>s_i</var> meters from t...
p03407
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>An elementary school student Takahashi has come to a variety store.</p> <p>He has two coins, <var>A</var>-yen and <var>B</var>-yen coins (yen is the currency of Japan), and wants to buy a toy that costs...
p03057
<span class="lang-en"> <p>Score : <var>1500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Consider a circle whose perimeter is divided by <var>N</var> points into <var>N</var> arcs of equal length, and each of the arcs is painted red or blue. Such a circle is said to <em>generate a string <...
p01590
<H1><font color="#000">Problem K:</font> Trading Ship</H1> <p> You are on board a trading ship as a crew. </p> <p> The ship is now going to pass through a strait notorious for many pirates often robbing ships. The Maritime Police has attempted to expel those pirates many times, but failed their attempts as the pirat...
p02216
<span class="lang"> <span class="lang-ja"> <h1>E: 数列ゲーム</h1> <div class="part"> <section> <h3>問題文</h3><p>長さ $N$ の正整数列 $a_1, a_2, \ldots, a_N$ があります。</p> <p>この数列を用いた、$2$ 人のプレイヤーが先手と後手に分かれて行う以下のゲームを考えます。</p> <ul> <li>先手と後手は交互に、以下の操作のどちらかを選んで行う。<ul> <li>数列の正の項を $1$ つ選び、その値を $1$ 減らす。</li> <li>数列の全ての項が正のとき、全ての項の値を $1$ ずつ減ら...
p02646
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate <var>A</var>, and he can travel the ...
p03954
<span class="lang-en"> <p>Score : <var>1300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a pyramid with <var>N</var> steps, built with blocks. The steps are numbered <var>1</var> through <var>N</var> from top to bottom. For each <var>1≤i≤N</var>, step <var>i</var> consists of <var>...
p01969
<h2>C: AA グラフ (AA Graph)</h2> <h3>Problem</h3> <p>Given a graph as an ASCII Art (AA), please print the length of shortest paths from the vertex <var>s</var> to the vertex <var>t</var>. The AA of the graph satisfies the following constraints.</p> <p>A vertex is represented by an uppercase alphabet and symbols <code>o...
p00381
<h1>Transporter</h1> <p> In the year 30XX, an expedition team reached a planet and found a warp machine suggesting the existence of a mysterious supercivilization. When you go through one of its entrance gates, you can instantaneously move to the exit irrespective of how far away it is. You can move even to the end ...
p02168
<h1>Problem G: Double or Increment</h1> <h2>Problem</h2> <p> ある日、mo3tthi君とtubuann君は、魔法のポケットとビスケットを使ってゲームをすることにしました。<br> 今ここに $K$ 個のポケットがあり、$1,2, \ldots ,K$ の番号がついています。<br> $i$ 番目のポケットの容量は $M_i$ で、最初 $N_i$ 枚のビスケットが入っています。<br> mo3tthi君とtubuann君は、mo3tthi君から始めて、以下の一連の操作を交互に行います。<br> </p> <ul> <li>ポケットを一つ選ぶ...
p00155
<H1>スパイダー人</H1> <p> 正義のヒーロー「スパイダー人」は、腕からロープを出してビルからビルへ飛び移ることができます。しかし、ロープが短いので自分からの距離が 50 以下のビルにしか移動できません。それより遠くのビルに移動するには、一旦別のビルに飛び移らなくてはなりません。 </p> <br> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_spider"> </center> <br><br> <p> ビルの数 <var>n</var>、<var>n</var> 個のビルの情報、スパイダー人の移動開始位置及び...
p02538
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You have a string <var>S</var> of length <var>N</var>. Initially, all characters in <var>S</var> are <code>1</code>s.</p> <p>You will perform queries <var>Q</var> times. In the <var>i</var>-th query, yo...
p00505
<H1>問題1</h2> <br/> <p style="line-height: 200%;">  三角形の形は辺の長さで決まる. 順番に3つの正整数が与えられたとき, 辺の長さがそれらの値と一致する三角形が存在するかどうかを調べ, 存在するなら鋭角三角形,直角三角形,鈍角三角形のいずれかを判定し, 次の入力へ進む. 三角形が存在しないとき, それまでに入力された,三角形,直角三角形,鋭角三角形,鈍角三角形の 個数を空白で区切って出力し, それ以降の入力は無視して終了する. 入力の中には必ず三角形が存在しないようなものがある と仮定してよい. 入力の行数は判らないが各行には3つの正整数が空白で区切って書かれている. ただし...
p03283
<span class="lang-en"> <p>Score: <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>In Takahashi Kingdom, there is a east-west railroad and <var>N</var> cities along it, numbered <var>1</var>, <var>2</var>, <var>3</var>, ..., <var>N</var> from west to east. A company called <em>AtCoder...
p00856
<H1><font color="#000">Problem C:</font> Minimal Backgammon</H1> <p> Here is a very simple variation of the game backgammon, named “Minimal Backgammon”. The game is played by only one player, using only one of the dice and only one checker (the token used by the player). </p> <p> The game board is a line of (<i>N</i>...
p01744
<p> <var>w</var> 本の縦棒からなり,高さ(横棒を追加することのできる段数) が <var>h</var> のあみだくじがある.<var>w</var> は偶数である.このあみだくじの横棒を追加する場所の候補のうち上から <var>a</var> 番目,左から <var>b</var> 番目を <var>(a, b)</var> という.(<var>(a, b)</var> に横棒を追加した場合,上から <var>a</var> 段目で左から <var>b</var> 番目と <var>b+1</var> 番目の縦棒が結ばれる.) このような場所は合計 <var>h(w &minus;1)</var> 箇所(1 &...