question_id
stringlengths
6
6
content
stringlengths
1
27.2k
p01691
<h2>E - Disappear Drive / 消えるドライヴ</h2> <h3>Story</h3> <p>Dのひとはバスケットボールが好きだが、シュートが好きなため、他のテクニックはからっきしである。ドリブルは特に苦手で、相手の守備範囲に入ると必ずボールを奪われてしまう。そこでどんな相手も必ず抜き去る必殺のドリブルを編み出すことにした。努力の末、彼は遂に消えるドライヴ、&quot;ディスアピアドライヴ&quot;を完成させた。</p> <p>ディスアピアドライヴは、相手を挑発することで集中力を奪い視線を外す&quot;ディスディレクション&quot;により隙を作り、その隙に次元(ディメンジョン)の壁を超えて相手の守備...
p00983
<h2>Reordering the Documents</h2> <p> Susan is good at arranging her dining table for convenience, but not her office desk. </p> <p> Susan has just finished the paperwork on a set of documents, which are still piled on her desk. They have serial numbers and <i>were</i> stacked in order when her boss brought them ...
p01384
<div> <h1 class="title">問題 I : ビット演算</h1> <p>いよいよ G○○gle Code Jam の世界大会が始まろうとしている. 前では P○tr, t○mek, SnapDrag○n をはじめとする, G○○gle の誇る最強のコーダー達が睨みを利かせている. 妙な動きを見せれば,命はないだろう. 目をつむり,コンテスト開始をじっと待つ.</p> <p>…妙だ,コンテストが始まらない. 目を開けてみると…なんということだ.部屋の全ての人間が,倒れている. いや違う,全てではない.一人の男,wata を除いてだ.</p> <dl class="docutils"> <dt>wata</dt...
p03643
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>This contest, <em>AtCoder Beginner Contest</em>, is abbreviated as <em>ABC</em>.</p> <p>When we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 6...
p02951
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have two bottles for holding water.</p> <p>Bottle <var>1</var> can hold up to <var>A</var> milliliters of water, and now it contains <var>B</var> milliliters of water.</p> <p>Bottle <var>2</var> cont...
p03213
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an integer <var>N</var>. Among the divisors of <var>N!</var> <var>(= 1 \times 2 \times ... \times N)</var>, how many <em>Shichi-Go numbers</em> (literally "Seven-Five numbers") are there?<...
p00595
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1> <p> Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task. </p> <H2>Input</H2> <p> The input file consists of several lines with pairs of two natural numbers in each lin...
p02052
<h2>A: Hokkaido University Easy</h2> <h3>注意</h3> <p> 問題設定は B 問題と同一のものですが、制約のみが異なりますのでご注意ください。</p> <h3>物語</h3> <p> 北海道大学に合格し、新たな生活の始まりに心を躍らせるほむらちゃん。しかし彼女の前には、とてつもなく広いキャンパスが待ち受けていた...。</p> <p> 「え...次の授業に間に合わないんだけど...」</p> <h3>問題</h3> <p> 北海道大学札幌キャンパスは異常に広いことで有名です。札幌キャンパスは縦に <var>H</var> マス、横に <var>W</var> マス並んだ長方形のマス...
p02402
<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>Min, Max and Sum</h1> <p> ...
p00350
<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> あなたは、双子のアイ君とヅー君に文字列を使っ...
p02697
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are going to hold a competition of one-to-one game called AtCoder Janken. <em>(Janken is the Japanese name for Rock-paper-scissors.)</em> <var>N</var> players will participate in this competition, a...
p03985
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Story</h3> <p>I am a Summoner who can invoke monsters. I can embody the pictures of monsters drawn on sketchbooks. <p>I recently have received a request from Primate Research Institute of Kyoto University to invoke "Hundred Ey...
p00700
<h1> Exploring Caves </h1> <p>There are many caves deep in mountains found in the countryside. In legend, each cave has a treasure hidden within the farthest room from the cave's entrance. The Shogun has ordered his Samurais to explore these caves with Karakuri dolls (robots) and to find all treasures. These robo...
p01812
<h2>真っ暗な部屋</h2> <p> 目を覚ますと、A君は真っ暗な部屋の中にいた。 どうやらA君は <var>N</var> 個の部屋から構成されたダンジョンに迷い込んでしまったようだ。 あなたはA君がどの部屋に迷い込んだのかを知ることはできなかったが、幸いにもダンジョンのマップを手に入れることができた。 A君の進むべき道を示し明るい部屋に導こう。 </p> <p> <var>N</var> 個の部屋のうち <var>M</var> 個の部屋が真っ暗な部屋であり、それぞれ <var>D_1</var>, <var>D_2</var>, ..., <var>D_M</var> 番目の部屋が真っ暗な部屋であることが分かって...
p01541
<h1>ほそながいところ</h1> <p> 高橋君は苹果(りんご)ちゃんとニューヨークを観光することになりました。 高橋君は観光するところに特に希望はなかったのですが、苹果ちゃんの熱烈な誘いにより、以下の地図にあるような&quot;ほそながいところ&quot;を観光することに決まりました。 </p> <center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE_hosonaga" height="344" width="454"></center> <center>Google マップ - (C)2012 Google</center> <...
p03086
<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 uppercase English letters. Find the length of the longest <em>ACGT string</em> that is a substring (see Notes) of <var>S</var>.</p> <p>Here, a ACGT stri...
p01111
<h3>Skyscraper "MinatoHarukas"</h3> <!-- end en only --> <!-- begin en only --> <p> Mr.&nbsp;Port plans to start a new business renting one or more floors of the new skyscraper with one giga floors, MinatoHarukas. He wants to rent as many vertically adjacent floors as possible, because he wants to show advertisem...
p01404
<h2> Problem G: 水時計 </h2> <p> 琵琶湖の湖底から変わった形の水時計のようなものが発見された。 </p> <p> 水時計は水平な広い平面上に置かれ、1つ以上の一辺が30cmの立方体の水槽で構成されている。 水槽は格子状に並べられた様々な高さの台の上に置かれている。水槽の厚みは無視できる。 同じ高さの台の上に置かれた水槽が前後左右に隣接していたとき、それらの水槽の間には穴があけられ、水の高さが等しく保たれる仕組みになっている。(図1) </p> <center> <table> <tr> <td> <img src="https://judgeapi.u-aizu.ac.jp/resources...
p03439
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p><font color="red"><strong>This is an interactive task.</strong></font></p> <p>Let <var>N</var> be an odd number at least <var>3</var>.</p> <p>There are <var>N</var> seats arranged in a circle. The seats...
p03593
<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</var>-by-<var>W</var> matrix. Let <var>a_{ij}</var> be the element at the <var>i</var>-th row from the top and <var>j</var>-th column from the left. In this matrix, each <var>a_{ij}</v...
p01054
<h1>String Conversion</h1> <h2>Problem</h2> <p> ジェニファーとマリアンはカーラに文字列<var>S</var>をプレゼントしました。<br> しかし、カーラは文字列<var>S</var>をもらっても嬉しくありません。<br> 文字列<var>T</var>が欲しかったのです。<br> 3人は協力して文字列<var>S</var>を文字列<var>T</var>に変えることにしました。<br> </p> <p> 最初にジェニファーが文字を任意の順番に並び替えます。 </p> <p> 次にマリアンが2種類のアルファベットの小文字を交換することを任意の回数行います。<br> この...
p03069
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> stones arranged in a row. Every stone is painted white or black. A string <var>S</var> represents the color of the stones. The <var>i</var>-th stone from the left is white if the ...
p02228
a
p00215
<H1>パチモンクリーチャー</H1> <p> 某国で<!--爆発的-->大人気のゲーム、パチモンクリーチャーが日本でリメイクされて発売されました。 ゲームが大好きなあなたは、 このゲームを<!--今まで貯めたお小遣いで購入し、何度もプレイしました。そして、-->何度もプレイするうちにどうしたら最速でクリアできるのか考えるようになりました。しかし、いくら考えても最速の攻略方法がわからなかったあなたは、どれだけ早くゲームをクリアできるかを求めるプログラムを作成することにしました。 </p> <p> ゲームの詳細は以下の通りです。 </p> <!-- <p> パチモンクリーチャー(以下、パチクリ)という生物が多く存在す...
p02382
<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>Distance II</h1><br> <p> ...
p02678
<span class="lang-en"> <p>Score: <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>There is a cave.</p> <p>The cave has <var>N</var> rooms and <var>M</var> passages. The rooms are numbered <var>1</var> to <var>N</var>, and the passages are numbered <var>1</var> to <var>M</var>. Passag...
p00645
<H1><font color="#000000">Problem I:</font> Mysterious Onslaught</H1> <p> In 2012, human beings have been exposed to fierce onslaught of unidentified mysterious extra-terrestrial creatures. We have exhaused because of the long war and can't regist against them any longer. Only you, an excellent wizard, can save us. Y...
p01957
<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...
p00995
<h1>Problem F : Dungeon (I)</h1> <p> あなたはとあるゲームの開発に携わっている。 そのゲームはランダムに生成されたダンジョンをプレイヤーが探索するというものである。 </p> <p> このゲームで生成されるダンジョンには<i>n</i> 個の部屋が存在しており、0から <i>n-1</i> までの番号が割り振られている。 部屋と部屋は通路で結ばれている。部屋と部屋を結ぶ通路は、<i>m</i> 本ある。 通路はどちらの方向へも進むことができる。 また、部屋と部屋の間には距離が設定されている。 生成されたダンジョンではいくつかの通路を経由して、ある部屋から他のすべての部屋へ行くことが可能で...
p01687
<h2>A - D's Ambition / Dのやぼう</h2> <h3>Story</h3> <p>あいずにゃんは若ヶ松高校のプログラミングコンテスト部、通称ぷろこん部に所属する2年生である。かわいい。Dのひとは天使のごとくかわいいあいずにゃんにぞっこんであり、隙あらばぺろぺろしようと画策する変態である。その愛は猟奇的であり、あいずにゃんを自分色に染めようと、&quot;AIZUNYAN&quot;という文字列を見る度&quot;AIDUNYAN&quot;に書き換えてしまう。さらにあいずにゃんを自分だけのものにするため、他の人に気づかれないようにその文字列をバラバラに並べ替えてしまう。プロコンの名門・律命館大学中等部卒...
p03340
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is an integer sequence <var>A</var> of length <var>N</var>.</p> <p>Find the number of the pairs of integers <var>l</var> and <var>r</var> (<var>1 \leq l \leq r \leq N</var>) that satisfy the follo...
p02802
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi participated in a contest on AtCoder.</p> <p>The contest had <var>N</var> problems.</p> <p>Takahashi made <var>M</var> submissions during the contest.</p> <p>The <var>i</var>-th submission was...
p03710
<span class="lang-en"> <p>Score : <var>1700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Kenus, the organizer of <em>International Euclidean Olympiad</em>, is seeking a pair of two integers that requires many steps to find its greatest common divisor using the Euclidean algorithm.</p> <p>Y...
p00096
<H1>4つの整数の和 II</H1> <p> 4,000 以下の正の整数 <var>n</var> を入力し、0 〜 1000 の範囲の整数 <var>a, b, c, d</var> の組で</p> <pre> <var>a + b + c + d = n</var> </pre> <p>を満たすものの組み合わせ数を出力するプログラムを作成して下さい。</p> <H2>Input</H2> <p> 複数のデータセットが与えられます。各データセットに <var>n</var> が1行に与えられます。入力の最後まで処理して下さい。 </p> <p> データセットの数は 50 を超えません。 </p> <H2>Ou...
p02551
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a grid with <var>N</var> rows and <var>N</var> columns of squares. Let <var>(i, j)</var> be the square at the <var>i</var>-th row from the top and the <var>j</var>-th column from the left.</p> ...
p02101
<h1>Problem D: Let's Go To School</h1> <h2>Problem</h2> <p> がっちょ君は期末試験が近づくとやる気がなくなってしまい、しばしば学校を休むようになる。<br> 期末試験まで残り<var>N</var>日である。<br> がっちょ君の<var>i</var>日目のやる気は<var>X<sub>i</sub></var>であり、<var>i</var>日目に学校に行くために必要なやる気は<var>Y<sub>i</sub></var>である。<br> がっちょ君は <var>X<sub>i</sub></var> &ge; <var>Y<sub>i</sub></var> ...
p00429
<H1></H1> <p> 0 から 9 までの数字だけで構成された文字列が与えられたとき,その文字列から次の規則に従って新しい文字列を作る操作を考える.与えられた文字列を左端から1文字ずつ順に読んで行き,同じ数字 <i>a</i> が <i>r</i> 個続いていた場合,個数 <i>r</i> と数字<i>a</i> を空白で区切らずにこの順で書き出す.与えられた文字列の右端まで読み,最後の書き出しが終わったところまでを途中何回書き出しがあったとしても全部まとめて操作1回とカウントする.2回目以降の操作は前回の操作により書き出された文字列を与えられた文字列として同様の操作を実施する.例えば “<span>122244</...
p02414
<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>Matrix Multiplication</h1><...
p00079
<H1>凸 <var>n</var> 角形の面積</H1> <p> 凸 <var>n</var> 角形(すべての頂点の内角が 180 度未満である多角形、要するにへこんでいない多角形のこと)の頂点の座標を読んで、その面積を出力するプログラムを作成してください。頂点には辺のつながりの順序に従って頂点 1、頂点 2、頂点 3、‥‥頂点 <var>n</var> という名前がついています。 </p> <p> ただし、 <var>n</var> は 3 以上 20 以下とします。また、次の、三角形の 3 辺の長さ <var>a, b, c</var> から面積 <var>S</var> を求める公式を使ってもかまいません。 </p...
p02044
<h3>割り勘</h3> <!-- begin ja only --> <p>あなたは ICPC 2019 Yokohama Regional 国内予選の健闘を祈るためのパーティを企画した.このパーティの参加者は <i>N</i> 人である.</p> <p>このパーティの開催には合計で <i>M</i> 円の費用が必要となるため,<i>N</i> 人の参加者からそれぞれ <i>M/N</i> 円を集めることにした.<i>M</i> は <i>N</i> で割り切れる金額となったため,余りについて心配する必要はない.</p> <p><i>i</i> 番目の参加者の今日の所持金は <i>A<sub>i</sub></i> 円である....
p00583
<h1>たのしいたのしいたのしい家庭菜園(Growing Vegetables is Fun 3)</h1> <p> JOI 君は,長年にわたる家庭菜園の経験を生かして,自宅の庭で新たにジョイ草という植物を育てている.庭には東西方向に並んだ$N$ 個のプランターがあり,西側から順に1 から$N$ までの番号がついている.ジョイ草は全部で$N$ 株あり,それぞれのプランターに1 株ずつ植えてある. </p> <p> 春になって様子を見に行ったJOI 君は,ジョイ草が予想に反して色とりどりの葉を付けていることに気がついた.さらに,ジョイ草が思ったほど生育していないことに気がついた.JOI 君はこれらのことを不思議に思い,本で...
p03205
<span class="lang-en"> <p>Score : <var>2200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given <var>N-1</var> subsets of <var>\{1,2,...,N\}</var>. Let the <var>i</var>-th set be <var>E_i</var>.</p> <p>Let us choose two distinct elements <var>u_i</var> and <var>v_i</var> from each s...
p01238
<H1><font color="#000">Problem E:</font> Subdividing a Land</H1> <p> Indigo Real-estate Company is now planning to develop a new housing complex. The entire complex is a square, all of whose edges are equally <i>a</i> meters. The complex contains <i>n</i> subdivided blocks, each of which is a <i>b</i>-meter square. H...
p02947
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We will call a string obtained by arranging the characters contained in a string <var>a</var> in some order, an <em>anagram</em> of <var>a</var>.</p> <p>For example, <code>greenbin</code> is an anagram ...
p03655
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Joisino is planning on touring Takahashi Town. The town is divided into square sections by north-south and east-west lines. We will refer to the section that is the <var>x</var>-th from the west and th...
p01668
<h2>B - Integer in Integer</h2> <h3>Problem Statement</h3> <p> Given an integer interval <var>\[A, B\]</var> and an integer <var>C</var>, your job is to calculate the number of occurrences of <var>C</var> as string in the interval. </p> <p> For example, <var>33</var> appears in <var>333</var> twice, and appears in ...
p01392
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <h1><font color="#000">問題 E</font> Fox Number</h1> <h2>問題文</h2> <p>きつねのしえるは数字について考えるのが好きである.ある日,しえるはこの世にねこの数字というものがあることを知り,自分もそのような数字が欲しくなってしまった.そこで,次の性質を満たす数字をとりあえず Fox Number と呼ぶことにした.</p> <p>[性質]: 整数 <var>N</var> は <var>k (&ge; 1)</var> 個の素数 <var>p<sub...
p03481
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence <var>A</var> needs to satisfy the conditions below:</p> <ul> <li><var>A</var> consists of integers...
p01146
<!-- begin en only --> <h3><U> Princess in Danger </U></h3> <!-- end en only --> <!-- begin ja only --> <h3><U> お姫様の危機 </U></h3> <!-- end ja only --> <!-- begin en only --> <p> English text is not available in this practice contest. </p> <!-- end en only --> <!-- begin ja only --> <p> ある貧乏な国のおてんばで勇敢なお姫様が,政略結婚のため別の...
p01516
<!-- begin en only --> <h3><u>Milky Way </u></h3> <!-- end en only --> <!-- begin ja only --> <h3><u>天の川 </u></h3> <!-- end ja only --> <div> <!-- begin en only --> <p> English text is not available in this practice contest. </p> <!-- end en only --> <!-- begin ja only --> <p> 天の川交通公社は星間旅行ツアーの企画・運営を行う旅行会社である。 天の川交...
p02290
<H1>Projection</H1> <br/> <p> For given three points <var>p1, p2, p</var>, find the projection point <var>x</var> of <var>p</var> onto <var>p1p2</var>. </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_CGL_CGL_1_A"> </center> <H2>Input</H2> <pre> <var>x<sub>p1</sub></var> <var>y<sub>p1...
p00757
<h3><U>Planning Rolling Blackouts</U></h3> <!-- end en only --> <div> <!-- please enclose each h3 level section with div --> <!-- begin en only --> <p>Faced with seriously tight power supply-demand balance, the electric power company for which you are working implemented <q>rolling blackouts</q> in this spring...
p01845
<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-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
p03878
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><style> #nck { width: 30px; height: auto; } </style> <p>There are <var>N</var> computers and <var>N</var> sockets in a one-dimensional world. The coordinate of the <var>i</var>-th compute...
p00307
<h1>ネットカフェ</h1> <p> あなたはネットカフェを経営しています。今日あなたは、顧客に指摘され続けている問題を解決しようと取り組んでいます。その問題とは、店舗の本棚の単行本が巻数順に並んでおらず、目的の単行本を探しだすのが面倒だという苦情です。 </p> <p> あなたの店舗で一番巻数の多い単行本は「名探偵 赤ベコ」(通称「赤ベコ」)です。あまりに長編なので、特別な本棚を「赤ベコ」のために用意しました。 </p> <p> 単行本の各巻の重さと厚さは様々で、本棚の各段の幅と、各段に並べることができる本の重さの上限も様々です。あなたは、次の条件を満足するように本棚に本を並べることにしました。 </p> <ul>...
p00612
<H1><font color="#000000">Problem H:</font> Hedro's Hexahedron</H1> <p> Dr. Hedro is astonished. According to his theory, we can make sludge that can dissolve almost everything on the earth. Now he's trying to produce the sludge to verify his theory. </p> <p> The sludge is produced in a rectangular solid shaped tan...
p01900
<link rel="stylesheet" href="css/description.css" type="text/css" /> <script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script> <h2>C : Mod!Mod!</h2> <h3>物語</h3> <p> じゃん!探してますよ目撃証言! 会津に怪盗が現れた!みんなのウマウマ棒が盗まれた!犯人は誰だ!? 解きあかせ!Mod!Mod! </p> <h3>問題文</h3> <p>"アイズ"...それは選ばれし者の心に膨らむ...
p00242
<H1>入力候補</H1> <p> 携帯電話には、メールなどの文章を効率良く入力するために入力候補を表示する機能が搭載されています。これは、使われる頻度が高い単語を記録しておき、入力された文字を頭文字に持つ単語を入力候補として提示するものです。例えば、普段”computer”という単語を多く入力しているなら、”c”と入力するだけで候補として”computer”が提示されます。このような機能の基本部分を作成してみましょう。 </p> <p> 文章、文字を入力とし、その文字を頭文字に持つ単語を出現数の順に出力するプログラムを作成してください。ただし、出現数が同じ単語が複数ある場合は、辞書式順序で出力します。出力する単語は最大5...
p02785
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Fennec is fighting with <var>N</var> monsters.</p> <p>The <em>health</em> of the <var>i</var>-th monster is <var>H_i</var>.</p> <p>Fennec can do the following two actions:</p> <ul> <li>Attack: Fennec ch...
p03897
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have an <var>N×N</var> checkerboard.</p> <p>From the square at the upper left corner, a square that is <var>i</var> squares to the right and <var>j</var> squares below is denoted as <var>(i, j)</var>...
p01003
<h1>Problem E: Doragoso Ball</h1> <h2>Problem</h2> <p> <var> L </var>個集めるとドラゴソが現れどんな願いでも一つだけ叶えてくれるというドラゴソボールがとある迷宮に散らばっている。入口からスタートし、途中で立ち止まることなくすべてのボールを回収し、それらを迷宮内にある祭壇に奉納し、そのまま呪文を唱えるとドラゴソが現れ願いを叶えてくれるという。ただし、呪文を唱え始める時間は入口からボールを奉納するまでのルートのうち、移動時間が<var> K </var>番目に短いルートで移動したときの時間でなければならない。 </p> <p> この迷宮は部屋とわたり通路からな...
p01453
<H1>Problem G: スプリング・タイル</H1> <p> ある朝、あなたが目覚めると、そこはバネだらけの迷宮の中だった。 </p> <p> なぜ自分がこんな見知らぬ場所にいるのかはわからない。この場でじっと助けを待つという選択肢も あるにはあるが、こういった迷宮の中に長居していると、いつかは必ず突風が吹いてきて吹き飛ばさ れてしまうことを、あなたは経験上知っていた。しかし、突風が吹いてくるまでの時間は判断のしよ うがない。そこであなたは、迷宮から脱出するまでに必要な移動回数の期待値が最小になるように行 動するのが最善の戦略だと考えた。 </p> <p> 足元に落ちていた正体不明の巻物を拾ってためしに読んでみたと...
p03194
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> integers <var>a_1, a_2, ..., a_N</var> not less than <var>1</var>. The values of <var>a_1, a_2, ..., a_N</var> are not known, but it is known that <var>a_1 \times a_2 \times ... \...
p02156
<h1>Problem H: Ghost</h1> <h2>Problem</h2> <p> 幽霊が一直線上に左から右に$N$人並んでいる。<br> 最初、左から$i$番目の幽霊は$U_i$が'L'ならば左を、'R'ならば右を向いている。<br> <br> 彼らはとても臆病なのでなるべく怖い幽霊を見たくない。<br> <br> あなたは、各幽霊に対して振り返るように指示をできる。<br> 後ろを振り返るのは怖いので、$i$番目の幽霊が一回振り返ると$A_i$の恐怖度が発生する。<br> 左を向いている幽霊が振り返ると、右を向く。<br> 右を向いている幽霊が振り返ると、左を向く。<br> <br> $ i < j...
p00491
<H1>パスタ (Pasta) </H1> <h2> 問題</h2> <p> あなたはパスタが大好物であり,毎日,晩御飯にパスタを作って食べている.あなたはトマトソース,クリームソース,バジルソースの 3 種類のパスタを作ることができる. </p> <p> N 日間の晩御飯の予定を考えることにした.それぞれの日に 3 種類のパスタから 1 種類を選ぶ.ただし,同じパスタが続くと飽きてしまうので,3 日以上連続して同じパスタを選んではいけない.また,N 日のうちの K 日分のパスタはすでに決めてある. </p> <p> 入力として N の値と,K 日分のパスタの情報が与えられたとき,条件をみたす予定が何通りあるかを 1...
p00868
<H1><font color="#000">Problem E:</font> Spherical Mirrors</H1> <p> <i> A long time ago in a galaxy, far, far away, there were N spheres with various radii. Spheres were mirrors, that is, they had reflective surfaces . . . . </i> </p> <p> You are standing at the origin of the galaxy (0, 0, 0), and emit a laser ray t...
p02855
<span class="lang-en"> <p>Score: <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Chokudai made a rectangular cake for contestants in DDCC 2020 Finals.</p> <p>The cake has <var>H - 1</var> horizontal notches and <var>W - 1</var> vertical notches, which divide the cake into <var>H \ti...
p03747
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a circle with a circumference of <var>L</var>. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On ...
p01280
<H1><font color="#000">Problem H:</font> Galaxy Wide Web Service</H1> <p> The volume of access to a web service varies from time to time in a day. Also, the hours with the highest volume of access varies from service to service. For example, a service popular in the United States may receive more access in the daytim...
p03317
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a sequence of length <var>N</var>: <var>A_1, A_2, ..., A_N</var>. Initially, this sequence is a permutation of <var>1, 2, ..., N</var>.</p> <p>On this sequence, Snuke can perform the following ...
p02910
<span class="lang-en"> <p>Score: <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Takahashi will do a tap dance. The dance is described by a string <var>S</var> where each character is <code>L</code>, <code>R</code>, <code>U</code>, or <code>D</code>. These characters indicate the po...
p03602
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>In Takahashi Kingdom, which once existed, there are <var>N</var> cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network:</p> <ul> <li>Peo...
p00887
<H1><font color="#000">Problem D:</font> Awkward Lights</H1> <p> You are working as a night watchman in an office building. Your task is to check whether all the lights in the building are turned off after all the office workers in the building have left the office. If there are lights that are turned on, you must tu...
p01795
<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 F ICPC Teams</h2> <p>...
p03252
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given strings <var>S</var> and <var>T</var> consisting of lowercase English letters.</p> <p>You can perform the following operation on <var>S</var> any number of times:</p> <p>Operation: Choose ...
p02013
<h1>Problem J. Prime Routing</h1> <!-- Time Limit: 2 sec Memory Limit: 512 MB --> <p> Fox Jiro is one of the staffs of the ACM-ICPC 2018 Asia Yokohama Regional Contest and is responsible for designing the network for the venue of the contest. His network consists of $N$ computers, which are connected by $M$ cables...
p00184
<H1>鶴ヶ城</H1> <p> 会津若松市のシンボルである鶴ヶ城は、蒲生氏郷が本格的な天守閣を築城し、「鶴ヶ城」と名付けました。天守閣からは会津盆地が一望できます。また、晴れた日には、白虎隊で有名な飯盛山の山頂から鶴ヶ城を見ることができます。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_tsuruga"><br/> <br/> </center> <p> 会津若松市の今後の広報活動の参考にするため、鶴ヶ城に訪れた来場者について、年代調査をすることにしました。来場者の年齢を入力とし、下記の年齢区分別に人数を...
p02443
<h1>Reverse</h1> <p> Write a program which reads a sequence of integers $A = \{a_0, a_1, ..., a_{n-1}\}$ and reverse specified elements by a list of the following operation: </p> <ul> <li>reverse($b, e$): reverse the order of $a_b, a_{b+1}, ..., a_{e-1}$</li> </ul> <h2>Input</h2> <p> The input is given in t...
p02434
<h1>Vector II</h1> <p> For $n$ dynamic arrays $A_i$ ($i = 0, 1, ..., n-1$), perform a sequence of the following operations: </p> <ul> <li>pushBack($t$, $x$): Add element $x$ at the end of $A_t$.</li> <li>dump($t$): Print all elements in $A_t$.</li> <li>clear($t$): Clear $A_t$. If $A_t$ is empty, do nothing.<...
p00409
<h1>イワシロの祈り</h1>  <p> 古代国家イワシロでは、災害が起きたときにそれを鎮めるために、神官が祈りをささげます。 </p> <p> 神官は古文書から文字列Sを選び、以下を繰り返すことで儀式を進めていきます。 </p> <ul> <li>文字列$S$の中の場所を一つ選び、そこに書かれた文字を他の文字に入れ替えて、$S$を更新する。</li> <li>$S$がどのような文字列の繰り返しで表せるかを見つけて、見つけた文字列を唱える。ただし、$S$が文字列の繰り返しで表せないときは$S$を唱える。 </li> </ul> <p> 祈りの効力が最大になるのは、最も短い文字列の繰り返しで元の文字列を表すものを唱えたとき...
p02064
<h2>E: 最短経路の復元</h2> <h3>物語</h3> <p>競技プログラマーは日々最短経路問題を解いている。BFS や、ベルマンフォード、ダイクストラ、ワーシャルフロイドと多くのアルゴリズムも知られている。</p> <p>あなたはそんな中、どうしても解けない最短路問題があった。それはグラフを見ずに最短路問題を解けという問題だ!こんなもの通常の人類には解けるわけがないのだが、30 分だけ ivvivvi 神の天啓を受けることができるようになった。</p> <p>ivvivvi 神は競技プログラミングにも最短経路問題にも精通しており、どんなグラフに対しても任意の 2 点間の最短経路長を定数時間で求める能力を持っている。あ...
p00059
<H1>長方形の重なり</H1> <p> 底辺が <var>x</var> 軸に対して平行な 2 つの長方形があります。長方形 A の左下の座標 (<var>xa1</var>, <var>ya1</var>) と右上の座標 (<var>xa2</var>, <var>ya2</var>)、長方形 B の左下の座標 (<var>xb1</var>, <var>yb1</var>) と右上の座標 (<var>xb2</var>, <var>yb2</var>) を読み込んで、長方形 A と長方形 B が一部でも重なっていれば YES を、まったく重なっていなければ NO を出力するプログラムを作成してください。ただし、長方形 ...
p01218
<H1><font color="#000">Problem C:</font> Nagashi Soumen</H1> <p> Mr. Natsume, the captain of a baseball club, decided to hold a <i>nagashi-soumen</i> party. He first planned to put a flume at the arena, and let members stand by the side of the flume to eat soumen. But they are so weird that they adhere to each specia...
p03225
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are some coins in the <var>xy</var>-plane. The positions of the coins are represented by a grid of characters with <var>H</var> rows and <var>W</var> columns. If the character at the <var>i</var>-...
p02967
<span class="lang-en"> <p>Score : <var>1500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a string <var>S</var> consisting of <code>A</code>,<code>B</code>, and <code>C</code>.</p> <p>Consider the (not necessarily contiguous) subsequences <var>x</var> of <var>S</var> that satisfy a...
p01648
<h2>Problem Statement</h2> <p> You are given a connected undirected graph which has even numbers of nodes. A connected graph is a graph in which all nodes are connected directly or indirectly by edges. </p> <p> Your task is to find a spanning tree whose median value of edges' costs is minimum. A spanning tree of a...
p03675
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an integer sequence of length <var>n</var>, <var>a_1, ..., a_n</var>. Let us consider performing the following <var>n</var> operations on an empty sequence <var>b</var>.</p> <p>The <var>i<...
p02988
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a permutation <var>p</var> = {<var>p_1,\ p_2,\ ...,\ p_n</var>} of {<var>1,\ 2,\ ...,\ n</var>}.</p> <p>Print the number of elements <var>p_i</var> (<var>1 &lt; i &lt; n</var>) that satisfy the ...
p03360
<span class="lang-en"> <p>Score: <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>There are three positive integers <var>A</var>, <var>B</var> and <var>C</var> written on a blackboard. E869120 performs the following operation <var>K</var> times:</p> <ul> <li>Choose one integer writte...
p02822
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a tree <var>T</var> with <var>N</var> vertices. The <var>i</var>-th edge connects Vertex <var>A_i</var> and <var>B_i</var> (<var>1 \leq A_i,B_i \leq N</var>).</p> <p>Now, each vertex is painted...
p03730
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We ask you to select some number of positive integers, and calculate the sum of them.</p> <p>It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow t...
p02571
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are two strings <var>S</var> and <var>T</var>.</p> <p>Let us change some of the characters in <var>S</var> so that <var>T</var> will be a substring of <var>S</var>.</p> <p>At least how many charac...
p02121
<h1>Problem K: Chinol Choco</h1> <h2>Problem</h2> <p> チョコレート会社チノルチョコは新しい店を<var>n</var>店建てることにした。<br> それぞれの店は各店長に建てたい場所の候補を2つ用意してもらい、どちらかの場所に建てる。 </p> <p> チノルチョコでは<var>m</var>種類のチョコレートを販売しており、それぞれ別の工場で製造している。<br> すべての店で全種類のチョコレートを販売する。<br> チノルチョコではチョコレートを搬送するためのトラックを1台しか所有しておらず、1台のトラックでは1店分のチョコレートしか運べない。<br> そのため、トラ...
p03419
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive <var>N</var> rows and <var>M</var> columns, and a card is placed in each square in thi...
p01424
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <H1>Palindrome Generator</H1> <p> A palidrome craftsperson starts to work in the early morning, with the clear air allowing him to polish up his palindromes. </p> <p> On this morning, he is making his pieces to submit to the International Contest for Palin...
p03049
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has <var>N</var> strings. The <var>i</var>-th string is <var>s_i</var>.</p> <p>Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number...
p01074
<h1>Problem C: Unhappy Class</h1> <h2>Problem</h2> <p> 山之御船学園の1年G組は、不幸を背負った女子生徒たちが集まるクラスである。 彼女たちは、幸福になることを目標に、日々様々な試練に立ち向かう。 </p> <p> 彼女たちのクラスでは、幸福になるための試練の一環として、幸福実技科目を受講することができる。<br> 月曜から金曜のそれぞれ1限から<var>N</var>限までに授業科目の枠があり、<var>M</var>個の受講可能な科目がある。 </p> <p> 科目<var>i</var>は、曜日<var>d<sub>i</sub></v...
p00235
<H1>サージェント・ライアン</H1> <p> 「ライアン軍曹を救え」という指令のもと、アイヅ軍の救出部隊はドイツリーの水上都市で敵軍と激しい戦闘を繰り広げていました。彼らは無事に軍曹と合流しましたが、敵の戦車が多く、救出ヘリを呼べずにいました。そこで、彼らは敵の戦車を混乱させるため、都市にある橋を全て爆破するという作戦を実行することにしました。 </p> <p> 作戦はすぐに司令部に伝えられ、救出ヘリの準備が進められました。救出ヘリを飛ばすためには、いつ橋が全て爆破されるかを予測しなければなりません。軍のプログラマであるあなたの任務は、救出部隊が全ての橋の爆破に必要な時間を計算することです。 </p> <p> 水上...
p02208
<h2>カツサンド (Cutlet Sandwich)</h2> <p>ある世界には、 $X$ 種類の「サンド」、 $Y$ 種類の「カツ」、 $Z$ 種類の「カレー」という食べ物があります。</p> <p>この世界には $N$ 種類の「カツサンド」という食べ物があり、 $i$ 種類目のカツサンドは $A_i$ 種類目のサンドと $B_i$ 種類目のカツが原料です。</p> <p>また、 $M$ 種類の「カツカレー」という食べ物があり、 $i$ 種類目のカツカレーは $C_i$ 種類目のカツと $D_i$ 種類目のカレーが原料です。</p> <p>Segtree 君は、あるカツサンドまたはカツカレーを持っているとき、原料のうち少なくと...
p00665
<H1>Problem G : Everything Starts With Your Vote</H1> <p> ヒューリスティクスという言葉がある。確実にうまくいくという保証はないけれども大抵の場合はうまくいく、比較的単純なアプローチのことだ。単純にして強力であるがゆえに、この世の中は多くのヒューリスティクスで満ち溢れている。 </p> <p> ヒューリスティクスの一例として、こんなものが挙げられる。アニメ番組において、あるキャラクターの人気度は、そのアニメ本編中における登場時間の総和に比例する。確かにこれは多くの場合に成り立っているようだ。しかし、どうやら僕は少数派に属するらしい。影の薄いキャラ、背景にちらりと映るモブ...