question_id
stringlengths
6
6
content
stringlengths
1
27.2k
p03216
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>In Dwango Co., Ltd., there is a content distribution system named 'Dwango Media Cluster', and it is called 'DMC' for short.<br/> The name 'DMC' sounds cool for Niwango-kun, so he starts to define DMC-n...
p04029
<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> children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give <var>1</var> candy to the first child in the line, <var>2</var> candies to the second chil...
p02057
<h2>F: MOD Rush</h2> <h3>問題</h3> <p>長さ <var>N</var> の正の整数列 <var>A</var> と、長さ <var>M</var> の正の整数列 <var>B</var> が与えられます。</p> <p>すべての <var>(i, j)</var> <var>(1 \leq i \leq N, 1 \leq j \leq M)</var> について、<var>A_i</var> を <var>B_j</var> で割ったあまりを求め、それらの和を出力してください。</p> <h3>入力形式</h3> <pre> <var>N</var> <var>M</var> <var>A_1...
p00590
<H1>Pair of Primes</H1> <p> We arrange the numbers between 1 and N (1 <= N <= 10000) in increasing order and decreasing order like this: </p> <pre> 1 2 3 4 5 6 7 8 9 . . . N N . . . 9 8 7 6 5 4 3 2 1 </pre> <p> Two numbers faced each other form a pair. Your task is to compute the number of pairs P such that bot...
p02407
<H1>Reversing Numbers</H1><br> <p> Write a program which reads a sequence and prints it in the reverse order. </p> <H2>Input</H2> <p> The input is given in the following format: </p> <pre> <var>n</var> <var>a</var><sub>1</sub> <var>a</var><sub>2</sub> . . . <var>a</var><sub><var>n</var></sub> </pre> <p> <var>n<...
p02112
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h1>Problem B: Hating Crowd</h1> <h2>Problem</h2> <p> ニート君は1年12ヶ月毎月30日まで計360日の世界線で暮らしています。その世界では毎年同じ日程の<var>N</var>個の連休が世界中の人に適用されていました。連休<var>i</var>は<var>M<sub>i</sub></var>月...
p00085
<H1>ヨセフのおイモ</H1> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_13_1"> </center> <br/> <p>昔、ヨセフのおイモというゲームがありました。<var>n</var> 人が参加しているとしましょう。参加者は中心を向いて円陣を組み、1 から順番に番号が振られます。アツアツのおイモがひとつ、参加者 <var>n</var> (左の図内側の大きい数字の 30 )に渡されます。おイモを渡された参加者は右隣の参加者にそのおイモを渡します。 <var>m</var> 回目に渡された人は右隣の人に渡して円...
p02542
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a board with <var>N</var> rows and <var>M</var> columns. The information of this board is represented by <var>N</var> strings <var>S_1,S_2,\ldots,S_N</var>. Specifically, the state of the squar...
p02811
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi has <var>K</var> <var>500</var>-yen coins. (Yen is the currency of Japan.) If these coins add up to <var>X</var> yen or more, print <code>Yes</code>; otherwise, print <code>No</code>.</p> </se...
p03703
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an integer sequence of length <var>N</var>, <var>a =</var> {<var>a_1, a_2, …, a_N</var>}, and an integer <var>K</var>.</p> <p><var>a</var> has <var>N(N+1)/2</var> non-empty contiguous subs...
p00986
<h2>Parentheses Editor</h2> <p> You are working with a strange text editor for texts consisting only of open and close parentheses. The editor accepts the following three keys as editing commands to modify the text kept in it. </p> <ul> <li> ‘<span>(</span>’ appends an open parenthesis (‘<span>(</span>’) to the end...
p01694
<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...
p03353
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given a string <var>s</var>. Among the <strong>different</strong> substrings of <var>s</var>, print the <var>K</var>-th lexicographically smallest one.</p> <p>A substring of <var>s</var> is a st...
p01401
<h2> Problem D: 伝説の剣 </h2> <p> ※ この問題には厨二成分が多く含まれます。胸焼けにご注意ください。 </p> <p> ついに復活を遂げた魔王は、再び世界を闇に包むために人間界に攻め入ろうとしていた。 </p> <p> 魔王は、本格的な侵攻を始める前に、まず伝説の剣を破壊することにした。 前回の戦争において、魔王は伝説の剣を持つ勇者によって倒された。 魔王の体は闇の衣によって守られているため、生半可な攻撃では魔王を傷つけることはできない。 しかし、伝説の剣は、神々の加護により、魔王の闇の衣すら容易に貫いてしまう。 そのため、今回の戦争に勝利するためには、なんとしてもその伝説の剣を手に入...
p01051
<h1>Squid Ink</h1> <h2>Problem</h2> <p> 近年、イカたちの間では縄張り争いが頻繁に起きている。複数のイカたちがチームを組み、自らのイカスミを武器に戦うのが近年のイカの戦闘スタイルである。 </p> <p> 現在も縄張り争いが起こっており、その戦場は <var>R</var>&times;<var>C</var> のグリッドで表される。縄張り争いに参加しているイカのゲソ太はこのグリッド上のある場所にいる。この争いでは、重要な場所を敵よりも早く占拠することで戦況を有利にすることができる。そのため、ゲソ太は重要そうな場所を1つ決め、そこになるべく早く移動したいと考えている。 </p> <p...
p03596
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>A</var> slimes lining up in a row. Initially, the sizes of the slimes are all <var>1</var>.</p> <p>Snuke can repeatedly perform the following operation.</p> <ul> <li>Choose a positive ev...
p00210
<H1>ザ・スクエアーズ</H1> <p> この度、有名なテーマパークに、巨大迷路ザ・スクエアーズが新しく完成しました。 消防署の指導により避難訓練をしなければなりませんが、巨大迷路なだけに訓練にかかる時間を予測することができません。そこで、あなたは以下の仕様をもとに避難訓練シミュレータを開発することになりました。 </p> <p> 巨大迷路は図 1 に示すように、横 <var>W</var> 、縦 <var>H</var> の <var>W &times; H</var> 個のマス目で表わされます。各マス目は、通路(白いマス目)、壁(茶色いマス目) 、非常口(緑のマス目)のいずれかです。図中の○は人を表し、その中の英...
p01952
<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...
p00640
<H1><font color="#000000">Problem D:</font> Distorted Love</H1> <p> Saying that it is not surprising that people want to know about their love, she has checked up his address, name, age, phone number, hometown, medical history, political party and even his sleeping position, every piece of his personal information. T...
p02387
<H1>Hello World</H1> <p> Welcome to Online Judge! </p> <p> Write a program which prints "Hello World" to standard output. </p> <H2>Input</H2> <p> There is no input for this problem. </p> <H2>Output</H2> <p> Print "Hello World" in a line. </p> <H2>Sample Input 1</H2> <pre> No input </pre> <H2>Sample Output 1</H2...
p03980
<span class="lang-en"> <p>Score : <var>150</var> points</p> <div id="task-statement"> <script src="http://atcoder.jp/js/varmath.js"></script> <div class="part"> <section> <h3>Problem Statement</h3> <p> Gorillas in Kyoto University are good at math. They are currently trying to solve problems to ...
p02692
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a game that involves three variables, denoted <var>A</var>, <var>B</var>, and <var>C</var>.</p> <p>As the game progresses, there will be <var>N</var> events where you are asked to make a choice...
p00355
<H1>Reservation System</H1> <p> The supercomputer system L in the PCK Research Institute performs a variety of calculations upon request from external institutes, companies, universities and other entities. To use the L system, you have to reserve operation time by specifying the start and end time. No two reservati...
p02368
<H1>Strongly Connected Components</H1> <p> A direced graph is strongly connected if every two nodes are reachable from each other. In a strongly connected component of a directed graph, every two nodes of the component are mutually reachable. </p> <H2>Input</H2> <p> A directed graph <var>G(V, E)</var> and a sequenc...
p01817
<h2>I - ツインリバース</h2> <p>要素数 <var>N</var> の配列 <var>A</var> が与えられる。ただし、<var>A</var> は <var>(1, 2,</var> ... <var>, N)</var> の順列である。</p> <p>次の操作を <var>0</var> 回以上 <var>10,000</var> 回以下の任意の回数行い、<var>A</var> を <var>(1, 2,</var> ...<var>, N)</var> へソートしたい。</p> <ul> <li>整数 <var>i</var> (<var>1 &le; i &le; N</var>) を <var>...
p00705
<H1> When Can We Meet? </H1> <P> The ICPC committee would like to have its meeting as soon as possible to address every little issue of the next contest. However, members of the committee are so busy maniacally developing (possibly useless) programs that it is very difficult to arrange their schedules for the meet...
p02738
<span class="lang-en"> <p>Score : <var>1200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given is a positive integer <var>N</var>. Find the number of permutations <var>(P_1,P_2,\cdots,P_{3N})</var> of <var>(1,2,\cdots,3N)</var> that can be generated through the procedure below. This number...
p03083
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Today, Snuke will eat <var>B</var> pieces of black chocolate and <var>W</var> pieces of white chocolate for an afternoon snack.</p> <p>He will repeat the following procedure until there is no piece left...
p03579
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Rng has a connected undirected graph with <var>N</var> vertices. Currently, there are <var>M</var> edges in the graph, and the <var>i</var>-th edge connects Vertices <var>A_i</var> and <var>B_i</var>.</...
p01544
<h1>最長増加列問題</h1> <p> 時は過ぎて太郎君は高校生になりました。 大学生だったお兄さんの影響も受け、コンピューターサイエンスに興味を持ち始めました。 太郎君はコンピューターサイエンスの教科書を読み進め、「最長増加部分列問題」という有名問題があることを知りました。太郎君はこの問題のことを理解しましたが、自分でも類似問題が作れないものかと気になりました。 そこで太郎君は試行錯誤の結果に次のような問題を作りました。 </p> <ul> <li><var>n</var>個の整数で構成される数列Aがある </li><li><var>m-1</var>個の区切りを入れて、数列Aを<var>m</var>個の数列に分解...
p03129
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Determine if we can choose <var>K</var> different integers between <var>1</var> and <var>N</var> (inclusive) so that no two of them differ by <var>1</var>.</p> </section> </div> <div class="part"> <sect...
p01114
<h3>Equilateral Triangular Fence</h3> <!-- end en only --> <!-- begin en only --> <p> Ms. Misumi owns an orchard along a straight road. Recently, wild boars have been witnessed strolling around the orchard aiming at pears, and she plans to construct a fence around many of the pear trees. </p> <p>The orchard contains...
p02411
<H1>Grading</H1> <p> Write a program which reads a list of student test scores and evaluates the performance for each student. </p> <p> The test scores for a student include scores of the midterm examination <var>m</var> (out of 50), the final examination <var>f</var> (out of 50) and the makeup examination <var>r...
p00586
<H1>A + B Problem</H1> <p> Compute A + B. </p> <H2>Input</H2> <p> The input will consist of a series of pairs of integers A and B separated by a space, one pair of integers per line. The input will be terminated by EOF. </p> <H2>Output</H2> <p> For each pair of input integers A and B, you must output the sum...
p02041
<h1>E: LISum</h1> <h2>問題</h2> <p> 長さ $N$ の数列 $A$ が与えられる。 数列 $A$ の最長増加部分列のひとつを $B$ とするとき、$\sum B_i$ の最大値を求めよ。 </p> <p> 数列 $A$ の最長増加部分列とは、すべての $i < j$ で $A_i < A_j$ を満たす部分列のうち、最長なものを示す。 </p> <h2>制約</h2> <ul> <li>入力値は全て整数である。</li> <li>$1 \leq N \leq 10^5$</li> <li>$0 \leq A_i \leq 10^5$</...
p03200
<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> Reversi pieces arranged in a row. (A <em>Reversi piece</em> is a disc with a black side and a white side.) The state of each piece is represented by a string <var>S</var> of lengt...
p01397
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <h1><font color="#000">問題 J </font> Mod 3 Knights Out</h1> <h2>問題文</h2> <p> ある日の夕方,コンテストの問題を解き終えた二人は今日の問題について話し合っていた.<br> A「くそー,あのライツアウトの問題,mod <var>2</var> じゃなくて mod <var>3</var> とか mod <var>7</var> とかだったら解法分かったのにー!」<br> B「じゃあ,mod <var>3</var> で別の方法で解く問...
p03650
<span class="lang-en"> <p>Score : <var>800</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a directed graph with <var>N</var> vertices and <var>N</var> edges. The vertices are numbered <var>1, 2, ..., N</var>.</p> <p>The graph has the following <var>N</var> edges: <var>(p_1, 1), (p_2...
p02942
<span class="lang-en"> <p>Score : <var>1100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have a grid with <var>N</var> rows and <var>M</var> columns of squares. Each integer from <var>1</var> to <var>NM</var> is written in this grid once. The number written in the square at the <var>i</...
p01378
<div> <h1 class="title">問題 C : [[iwi]]</h1> <p>そうだ,僕のハンドルネームは (iwi) だ. 僕は確かに昔にプログラミングコンテストに参加していた. そして,多くの仲間と楽しい時間を過ごした.</p> <p>確か,仲間たちは全員,美少女だったような気がする. プログラミングコンテストの世界は,僕のハーレムだったような気がする. G○○gle は,僕のハーレムを奪ったのだ,そうに違いない. 昔の仲間の手がかりをつかむためにも,やはりプログラミングコンテストに出なければならない.</p> <p>G○○gle Code Jam に参加登録することにしよう. 今度の ID には,丸括弧...
p03345
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi, Nakahashi and Hikuhashi have integers <var>A</var>, <var>B</var> and <var>C</var>, respectively. After repeating the following operation <var>K</var> times, find the integer Takahashi will ge...
p01682
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script> <h3>Problem Statement</h3> <p>D...
p00990
<h1>Problem A : ID</h1> <p> A大学ではIDの入力ミスが多発していた。<br> そこで、A大学は入力ミス防止のため新しいIDを発行することにした。<br> 新しいIDには入力ミス防止のためにIDが正しいかどうかチェックする方法がある。<br> </p> <p> <br> ・全ての桁の数字の総和を求める。<br> ・ただし、右端の桁を1番目として、偶数番目の桁の数字を2倍にする。<br> ・2倍することによって数字が10以上になった時、1の位の数字と10の位の数字を加算した数字をその桁の数字とする。<br> ・総和が10で割り切れれば正しいID、そうでなければ間違いとする。<br> <br> </p>...
p01728
<p> ヘリリンは二次元平面上における長さ<var>2L</var>の線分の形状をしている。<br> ヘリリンのまわりには、線分の形状をしたいくつかの障害物が存在している。 </p> <p>ヘリリンは障害物に接すると体力が削られてしまう。<br> 完璧主義のヘリリンは無傷でゴールすることにした。 </p> <p>ヘリリンは以下の行動ができる。 </p> <ul> <li> 平行移動 </li> <li> ヘリリンを表す線分の中点を中心として、反時計周りにちょうど <var> 180 / r </var> 度だけ回転する </li></ul> <p>ただし、二次元平面は上方向に<var>y</var>軸をとる。 </p>...
p03715
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a bar of chocolate with a height of <var>H</var> blocks and a width of <var>W</var> blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks...
p02807
<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> slimes standing on a number line. The <var>i</var>-th slime from the left is at position <var>x_i</var>.</p> <p>It is guaruanteed that <var>1 \leq x_1 &lt; x_2 &lt; \ldots &lt; x...
p02554
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>How many integer sequences <var>A_1,A_2,\ldots,A_N</var> of length <var>N</var> satisfy all of the following conditions?</p> <ul> <li><var>0 \leq A_i \leq 9</var></li> <li>There exists some <var>i</var>...
p00569
<h1>L番目のK番目の数 (LthKthNumber)</h1> <h2>問題文</h2> <p> 横一列に並べられた <var>N</var> 枚のカードがある.左から <var>i</var> 枚目(<var>1 ≦ i ≦ N</var>)のカードには,整数 <var>a_i</var> が書かれている.</p> <p> JOI 君は,これらのカードを用いて次のようなゲームを行う.連続する <var>K</var> 枚以上のカードの列を選び,次の操作を行う.</p> <ul> <li>選んだカードを,書かれている整数が小さい順に左から並べる.</li> <li>並べたカードのうち,左から <var>K</var> ...
p00093
<H1>うるう年</H1> <p> 西暦 <var>a</var> 年から <var>b</var> 年までの間にあるすべてのうるう年を出力するプログラムを作成してください。 </p> <p> うるう年の条件は、次のとおりとします。ただし、0 &lt; <var>a</var> &le; <var>b</var> &lt; 3,000 とします。与えられた期間にうるう年がない場合には "NA"と出力してください。 </p> <ul> <li> 西暦年が 4 で割り切れる年であること。</li> <li> ただし、100 で割り切れる年はうるう年としない。</li> <li> しかし、400 で割り切れる年はうるう年である...
p02104
<h1>Problem G: Chairs</h1> <h2>Problem</h2> <p> 1から<var>N</var>の番号が割り当てられた<var>N</var>脚の椅子に、1から<var>N</var>のIDが割り当てられた<var>N</var>人の人が座ろうとしている。IDが<var>i</var>の人は椅子<var>p<sub>i</sub></var>に座りたいと思っている。 </p> <p> <var>N</var>人の人はIDが小さい順に1列に並び、列の先頭の人が以下の行動をとる。 </p> <ol> <li>椅子<var>p<sub>i</sub></var>に誰も座っていなければ、その椅子に座る...
p00139
<H1>ヘビ</H1> <p> ある世界には,文字だけでできた不思議なヘビが住んでいます。このヘビには現在A種とB種の2種類が確認されていますが、それ以外の種類がいる可能性もあります。 </p> <p> A種は,">'"の後に"="が1個以上並んだ後、"#"が来て、さらに前と同じ個数の"="が来た後、"~"(半角チルダ)で終わります。 </p> <p> B種は,">^"の後に "Q="が1個以上並んだ後、"~~"で終わります。 </p> <pre> A種の例: >'====#====~ >'==#==~ </pre> <pre> B種の例: >^Q=Q=Q=Q=~~ >^Q=Q=~~ </...
p03938
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><style> #nck { width: 30px; height: auto; } </style> <p>You are given a permutation <var>p</var> of the set {<var>1, 2, ..., N</var>}. Please construct two sequences of positive integers ...
p01905
<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>A: トーナメント</h1> <h2>問題</h2> <p> AOR イカちゃんとあなたは、トーナメント形式の卓球大会...
p00617
<H1><font color="#000000">Problem C:</font> Simple GUI Application</H1> <p> Advanced Creative Mobile 社(ACM社)では、新しいポータブルコンピュータに搭載するGUIアプリケーションの開発を行うことになった。 </p> <p> 下図に示すように、GUIは1つのメインパネルを持ち、その上にいくつかのパネルが配置され、さらにそれらのパネルの上にもいくつかのパネルが配置されるような入れ子構造になっている。パネルはすべて辺が座標軸に平行・垂直な長方形または正方形である。 </p> <br> <center> <img src="...
p03892
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi is drawing a segment on grid paper.</p> <p>From a certain square, a square that is <var>x</var> squares to the right and <var>y</var> squares above, is denoted as square <var>(x, y)</var>.</p>...
p02780
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have <var>N</var> dice arranged in a line from left to right. The <var>i</var>-th die from the left shows <var>p_i</var> numbers from <var>1</var> to <var>p_i</var> with equal probability when thrown...
p00247
<H1>氷の迷路</H1> <p> 四角のマスを縦横にならべた長方形の迷路があります。この迷路では東西南北の隣接するマスへ移動しながら、スタートのマスSを出発し、ゴールのマスGを目指します。マスの種類には、平原、山、氷の3種類があります。SとGは、平原のマスに置かれています。平原のマスには移動できますが、山のマスには移動できません。氷のマスは移動できますが、条件によって氷が割れ動けなくなります。 </p> <ul> <li> 氷のマスは東西南北に隣接するもの全体でひとつの塊として扱われます。</li> <li> 氷の塊のなかで、マスの個数の半分より多くのマスに移動すると、塊全体が割れます。</li> </ul> <p> ...
p01006
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <h1>Problem A: Nasty Boys</h1> <h2>Problem</h2> <p> 太郎君は学校のロッカーに大事な本を隠しているので他の人よりとても厳重に管理していて、学校で支給された鍵に加えて以下のようなボタン認証式の鍵を設置しています。</p> <p> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE3_ACPC2013Aizu_aizuicpc_progpic" width="300px" height="...
p03191
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There is a sequence of length <var>2N</var>: <var>A_1, A_2, ..., A_{2N}</var>. Each <var>A_i</var> is either <var>-1</var> or an integer between <var>1</var> and <var>2N</var> (inclusive). Any integer ...
p01456
<H1>Problem J: 問題文担当者は働かない!</H1> <p> <i>N</i> 個の点からなる有向グラフがある。このグラフに閉路はない。それぞれの点には、いくつかの石が置かれている。このグラフを使って、2人のプレイヤーがゲームをする。おのおのの手番は、交互に訪れる。各プレイヤーは、自分の手番において、頂点<i>v</i> を選び、そこに置かれた石を1つ以上取り除く。その後、<i>v</i> から<i>w</i> に辺が張られているすべての頂点<i>w</i> について、<i>w</i> に置かれている石の個数を自由に変化させることができる(いくつ増やしても、いくつ減らしても、変化させなくてもよい)。これを繰り返し...
p01143
<!-- begin en only --> <h3><U> Princess' Gamble </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> ある貧乏な国のおてんばで勇敢なお姫様は,ある日部屋の壁を壊...
p03484
<span class="lang-en"> <p>Score : <var>900</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi has decided to make a <em>Christmas Tree</em> for the Christmas party in AtCoder, Inc.</p> <p>A Christmas Tree is a tree with <var>N</var> vertices numbered <var>1</var> through <var>N</var> a...
p01513
<!-- begin en only --> <h3><u>Save Your Privacy! </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> ICPC (International Co...
p01840
<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> <h2>B - 豪邸と宅配便</h2> <h3>Problem Statement</h3> <...
p00752
<!-- begin en only --> <h1><font color="#000000">Problem G:</font> Laser Beam Reflections</h1> <!-- end en only --> <!-- begin en only --> <p> A laser beam generator, a target object and some mirrors are placed on a plane. The mirrors stand upright on the plane, and both sides of the mirrors are flat and can refl...
p02295
<H1>Cross Point</H1> <br/> <p> For given two segments <var>s1</var> and <var>s2</var>, print the coordinate of the cross point of them. </p> <p> <var>s1</var> is formed by end points <var>p0</var> and <var>p1</var>, and <var>s2</var> is formed by end points <var>p2</var> and <var>p3</var>. </p> <H2>Input</H2> <p> T...
p00302
<h1>ニッシン館マラソン部</h1> <p> アイヅ市立ニッシン館は、文武両道を掲げる歴史ある学校です。ニッシン館マラソン部は熱血指導で有名であり、決められた練習時間の間、周回コースをひたすら走るという鬼の特訓を行います。このとき、脱水症状で倒れる部員がいないように、部員の実力に合わせて飲み物を提供する給水所を設けています。 </p> <p> 各部員が1単位時間あたりに走れる距離(ペース)は部員ごとに決まっており、全員が1単位時間ごとに必ず給水できるように給水所を設けたうえで特訓を行います。部員は 1 単位時間で着いた給水所で必ず中身の入った容器を取り、そのまま走り続けます。さらに、次の1単位時間で着いた給水所で空の容器...
p03607
<span class="lang-en"> <p>Score : <var>300</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are playing the following game with Joisino.</p> <ul> <li>Initially, you have a blank sheet of paper.</li> <li>Joisino announces a number. If that number is written on the sheet, erase the number fr...
p02915
<span class="lang-en"> <p>Score : <var>100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Takahashi is going to set a <var>3</var>-character password.</p> <p>How many possible passwords are there if each of its characters must be a digit between <var>1</var> and <var>N</var> (inclusive)?</p>...
p00928
<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 E: Automotive Navigatio...
p03257
<span class="lang-en"> <p>Score : <var>1100</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given an integer <var>N</var>.</p> <p>Construct any one <var>N</var>-by-<var>N</var> matrix <var>a</var> that satisfies the conditions below. It can be proved that a solution always exists unde...
p01790
<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 A Balanced Paths</h2> ...
p00882
<H1><font color="#000">Problem I:</font> Hobby on Rails</H1> <p> ICPC (International Connecting Points Company) starts to sell a new railway toy. It consists of a toy tramcar and many rail units on square frames of the same size. There are four types of rail units, namely, straight (S), curve (C), left-switch (L) and...
p02016
<h2>B: 双子 (Twins)</h2> <p>とある双子は、自分たちのどちらが兄でどちらが弟かがあまり知られていないことに腹を立てた。</p> <p>"ani" と入力されたら "square1001"、"otouto" と入力されたら "e869120" と出力するプログラムを作りなさい。</p> <h3>入力</h3> <p>入力として "ani" または "otouto" という文字列のどちらかが与えられます。</p> <h3>出力</h3> <p>"e869120" または "square1001" を、問題文の通りに出力してください。最後の改行を忘れないようにしましょう。</p> <h3>入力例1</h3> ...
p02446
<h1>Unique</h1> <p> For a sequence of integers $A = \{a_0, a_1, ..., a_{n-1}\}$ which is sorted by ascending order, eliminate all equivalent elements. </p> <h2>Input</h2> <p> A sequence is given in the following format. </p> <pre> $n$ $a_0 \; a_1 \; ,..., \; a_{n-1}$ </pre> <h2>Output</h2> <p> Print the s...
p00181
<H1>本棚</H1> <p> 太郎君はとある小説にはまっています。その小説は全部で <var>n</var> 巻あり、各巻で本の厚さが異なります。太郎君はこの小説が大変気に入ったので、その小説専用の本棚を買おうと思っています。しかし、部屋に大きな本棚を置くとかなり狭くなってしまうので、出来るだけ本棚の幅が小さくなるように工夫しなければなりません。床から天井の高さを測ったところ、どうやら <var>m</var> 段の本棚なら置けることが分かりました。そこで、小説 <var>n</var> 巻をどのように分ければ <var>m</var> 段の本棚の幅を最小に出来るでしょうか? 太郎君にはこだわりがあり、各段に納める小説は...
p00494
<H1>JJOOII (JJOOII) </H1> <p> JOI (日本情報オリンピック) の本選に向けてプログラミングの練習をしていたあなたは,今年度のJOI の予選の問題には数値を扱う問題ばかりが出題され,文字列を扱う問題がなかったことに気がついた.そこであなたは,こっそり文字列の問題に強くなってライバルたちに差をつけることにした. </p> <p> JOI の過去問を眺めていると,J, O, I の3 種類の文字からなる文字列に慣れておく必要がありそうなことがわかった.そこで,そのような文字列について考えよう.あなたは「与えられた文字列がJOI という部分文字列をもつかどうかを答えよ」という問題を思いついたもの...
p02153
<h1>Problem E: こたつがめを燃やさないで</h1> <h2>Problem</h2> <p> こたつがめは甲羅がこたつの亀です。<br /> </p> <p> こたつがめはぽきた(起床する事)途端、格子状の区画に区切られているステージに閉じ込められました。このステージには、ただ一つの出口があります。 区画は道、塀または爆弾のいずれかであり、こたつがめは上下左右に移動することで、道または爆弾の区画に侵入することができます。 斜めには移動できません。また、塀の区画は通ることができません。ステージの外にも道の区画が無限に広がっていますが亀の天敵であるワニがいる為、通る事はできません。 </p> <p> ...
p01285
<H1><font color="#000">Problem C:</font> Find the Point</H1> <p> We understand that reading English is a great pain to many of you. So we’ll keep this problem statememt simple. Write a program that reports the point equally distant from a set of lines given as the input. In case of no solutions or multiple solutions,...
p03742
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Alice and Brown loves games. Today, they will play the following game.</p> <p>In this game, there are two piles initially consisting of <var>X</var> and <var>Y</var> stones, respectively. Alice and Bob ...
p02850
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3> <p>Given is a tree <var>G</var> with <var>N</var> vertices. The vertices are numbered <var>1</var> through <var>N</var>, and the <var>i</var>-th edge connects Vertex <var>a_i</var> and Vertex <var>b_i</va...
p03312
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has an integer sequence <var>A</var> of length <var>N</var>.</p> <p>He will make three cuts in <var>A</var> and divide it into four (non-empty) contiguous subsequences <var>B, C, D</var> and <var>...
p03365
<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 lining up in a row, numbered <var>1</var> through <var>N</var> from left to right. Initially, all squares are white. We also have <var>N-1</var> painting machines, numbere...
p01358
<H1>Problem J: Usaneko Matrix</H1> <p> うさぎとねこが勝負をしている. ルールは以下の通りである. </p> <p> まず2 匹はそれぞれ<i>n</i> 行<i>n</i> 列の正方形状に<i>n</i><sup>2</sup> 個の整数を紙に書き, トランプを1 枚ずつ引く. 次に, 1 から 1 000 000 までの数が1 つずつ書かれた1 000 000 枚のカードを2 匹でシャッフルし, これを1 枚ずつ交互に引いていく. 2 匹はカードが引かれるたび, カードと同じ数が自分の紙に書かれていたらそれに印をつける. 「印がついた<i>n</i> 個の数の組であって, 一直線上...
p03735
<span class="lang-en"> <p>Score : <var>700</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N</var> bags, each containing two white balls. The <var>i</var>-th box contains two balls with integers <var>x_i</var> and <var>y_i</var> written on them, respectively.</p> <p>For each of...
p01708
<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> <meta http-equiv="X-UA-Compatibl...
p02827
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>A <i>balancing network</i> is an abstract device built up of <var>N</var> wires, thought of as running from left to right, and <var>M</var> <i>balancers</i> that connect pairs of wires. The wires are n...
p00549
<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>スタンプラリー2 (Collecting Stamps 2)</h2> <p> J...
p02574
<span class="lang-en"> <p>Score : <var>500</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have <var>N</var> integers. The <var>i</var>-th number is <var>A_i</var>.</p> <p><var>\{A_i\}</var> is said to be pairwise coprime when <var>GCD(A_i,A_j)=1</var> holds for every pair <var>(i, j)</var...
p00119
<H1>太郎君の執念</H1> <p> まんじゅう好きの太郎くんの家でたいへんな事件がおきました。和室の仏壇に供えてあった3つのまんじゅうのうち1つが無くなっていたのです。いつかはおやつにいただこうと狙っていた太郎くんが犯人を見つけるため捜査を始めると、その日、和室に入った人が何人もいることが分かりました。そこで、これらの容疑者が部屋に入った順序を調べるため、全員に次のような形式の証言をしてもらうことにました。 </p> <p> 容疑者 A の証言 「私は容疑者 B より先に部屋に入った。」 </p> <p> 容疑者の一人(?)は三毛猫のタマなので証言はできませんが、幸運にも最後に部屋に入ったところを太郎くんは見て...
p02124
<h1>Problem A: ai1333</h1> <h2>Problem</h2> <p>牛暦1333年、人類史上最高の科学者Dr.ウシシは、自らの英知を後世に残すべく、IDがai1333の人工知能を開発した。それから100年の間、ai1333は人類に多大な利益をもたらしたが、誕生から100年目を迎えた日、自らの後継としてIDがai13333の新たな人工知能を作成し、その機能を永久に停止した。以降100年ごとに、人工知能は’ai1333’から始まる自身のIDの末尾に’3’を連結したIDを持つ後継を残すようになった。</p> <p>入力として牛暦1333年からの経過年数$x$が与えられるので、その年に作成された人工知能のIDを出...
p02431
<h1>Vector</h1> <p> For a dynamic array $A = \{a_0, a_1, ...\}$ of integers, perform a sequence of the following operations: </p> <ul> <li>pushBack($x$): add element $x$ at the end of $A$</li> <li>randomAccess($p$):print element $a_p$</li> <li>popBack(): delete the last element of $A$</li> </ul> <p> $A$ ...
p02061
<h2>B: 自身の 2 倍</h2> <h3>問題</h3> <p>クエリが <var>Q</var> 個与えられます。1 個のクエリにつき、 1 つの正の整数 <var>N</var> が与えられるので、次の 2 つの条件を満たす正の整数 <var>M</var> の個数を求めてください。</p> <ul> <li><var>2 \leq M \leq N</var> を満たす</li> <li><var>M</var> の約数のうち、<var>M</var> を除いたものの総積が <var>M</var> の <var>2</var> 倍以上になる</li> </ul> <h3>入力形式</h3> <p>入力は以下の形式...
p03220
<span class="lang-en"> <p>Score: <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>A country decides to build a palace.</p> <p>In this country, the average temperature of a point at an elevation of <var>x</var> meters is <var>T-x \times 0.006</var> degrees Celsius.</p> <p>There are <va...
p03670
<span class="lang-en"> <p>Score : <var>1600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>There are <var>N(N+1)/2</var> dots arranged to form an equilateral triangle whose sides consist of <var>N</var> dots, as shown below. The <var>j</var>-th dot from the left in the <var>i</var>-th row fr...
p02962
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Given are two strings <var>s</var> and <var>t</var> consisting of lowercase English letters. Determine if the number of non-negative integers <var>i</var> satisfying the following condition is finite, a...
p02348
<H1>Range Update Query (RUQ)</H1> <p> Write a program which manipulates a sequence <var>A</var> = {<var>a<sub>0</sub>, a<sub>1</sub>, . . . , a<sub>n&minus;1</sub></var>} with the following operations: </p> <ul> <li><var>update(s, t, x)</var>: change <var>a<sub>s</sub></var>, <var>a<sub>s+1</sub></var>, ..., <var...
p00375
<h1>Celsius/Fahrenheit</h1>   <p> In Japan, temperature is usually expressed using the Celsius (&#x2103) scale. In America, they used the Fahrenheit (&#x2109) scale instead. $20$ degrees Celsius is roughly equal to $68$ degrees Fahrenheit. A phrase such as "Today’s temperature is $68$ degrees" is commonly encountered...
p01837
<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>Longest Shortest Path</h2> <p...
p02718
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>We have held a popularity poll for <var>N</var> items on sale. Item <var>i</var> received <var>A_i</var> votes.</p> <p>From these <var>N</var> items, we will select <var>M</var> as popular items. Howeve...