id
stringlengths 6
6
| slug_name
stringlengths 1
105
| pretty_content
stringlengths 1
27.2k
| test_cases
sequencelengths 1
1
|
---|---|---|---|
p00200 | Traveling Alone: One-way Ticket of Youth |
<h1>éćĽăŽçéĺ珌</h1>
<p>
太éĺăŻĺ¤äźăżăŤéťčťă§éˇć
ăăăč¨çťăçŤăŚăŚăăžăăăăăéŤć ĄçăŽčşŤă§ăă太éĺăä¸ăľćăăăŞăĺ¤äźăżă§ĺŻč˝ăŞéăé ăăŤć
ăăăăŤăŻăĺşćĽăă ăĺŽăčĄăćšă¨ĺşćĽăă ăćŠăčĄăćšăăăăăčŚă¤ăăŞăăă°ăăžăč¨çťăçŤăŚăăăžăăă太éĺăç´ ćľăŞć
ăćşĺŤă§ăăăăăŤă太éĺăŽč¨çťăŽĺŠăăŤăŞăăăă°ăŠă ăä˝ăŁăŚăăăžăăăă
</p>
<br>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_trip">
</center>
<br><br>
<p>
çˇčˇŻăŽć
ĺ ąăé§
ăŽć°ăĺ
Ľĺă¨ăăĺăĺăăăŤĺżăăŚăćĺ°ééĄăžăăŻćçćéăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var> <var>m</var>
<var>a<sub>1</sub></var> <var>b<sub>1</sub></var> <var>cost<sub>1</sub></var> <var>time<sub>1</sub></var>
<var>a<sub>2</sub></var> <var>b<sub>2</sub></var> <var>cost<sub>2</sub></var> <var>time<sub>2</sub></var>
:
<var>a<sub>n</sub></var> <var>b<sub>n</sub></var> <var>cost<sub>n</sub></var> <var>time<sub>n</sub></var>
<var>k</var>
<var>p<sub>1</sub></var> <var>q<sub>1</sub></var> <var>r<sub>1</sub></var>
<var>p<sub>2</sub></var> <var>q<sub>2</sub></var> <var>r<sub>2</sub></var>
:
<var>p<sub>k</sub></var> <var>q<sub>k</sub></var> <var>r<sub>k</sub></var>
</pre>
<p>
1 čĄçŽăŤçˇčˇŻăŽć
ĺ ąăŽć° <var>n</var> (1 ≤ <var>n</var> ≤ 3000)ă¨é§
ăŽć° <var>m</var> (1 ≤ <var>m</var> ≤ 100) ăä¸ăăăăžăă
</p>
<p>
çśă <var>n</var> čĄăŤ <var>i</var> çŞçŽăŽčˇŻçˇăŽć
ĺ ąăä¸ăăăăžăăĺ衯çˇăŽć
ĺ ąă¨ăăŚă衯çˇăă¤ăŞăďźă¤ăŽé§
ăŽçŞĺˇ <var>a<sub>i</sub></var>, <var>b<sub>i</sub></var> (1 ≤ <var>a<sub>i</sub></var>, <var>b<sub>i</sub></var> ≤ <var>m</var>)ăćé <var>cost<sub>i</sub></var> (1 ≤ <var>cost<sub>i</sub></var> ≤ 1000)ă秝ĺćé <var>time<sub>i</sub></var> (1 ≤ <var>time<sub>i</sub></var> ≤ 1000) ăä¸ăăăăžăăăă ăăĺé§
㯠1 ăă <var>m</var> ăžă§é çŞăŤçŞĺˇăäťăăăăŚăăăăŽă¨ăăžăă
ăŞăă<var>a<sub>i</sub></var> 㨠<var>b<sub>i</sub></var> ăçˇčˇŻă§ă¤ăŞăăŁăŚăăă°ă<var>a<sub>i</sub></var> ăă <var>b<sub>i</sub></var>ă <var>b<sub>i</sub></var> ăă<var>a<sub>i</sub></var> ăŽä¸ĄćšăŽç§ťĺăĺăćéă¨ćéă§ĺŻč˝ă¨ăăžăă
</p>
<p>
çśăčĄăŤĺăĺăăăŽć° <var>k</var> (1 ≤ <var>k</var> ≤ 200) ăä¸ăăăăžăăçśă <var>k</var> čĄăŤ <var>i</var> çŞçŽăŽĺăĺăăăä¸ăăăăžăăĺĺĺăăă¨ăăŚăĺşçşé§
<var>p<sub>i</sub></var> ăĺ°çé§
<var>q<sub>i</sub></var> ăĺşĺăăĺ¤ăŽç¨ŽéĄ <var>r<sub>i</sub></var> (0 ăžă㯠1)ăä¸ăăăăžăăăŞăăĺăĺăăăŤăŻĺż
ăçľčˇŻăăăăăŽă¨ăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăŞăă
</p>
<H2>Output</H2>
<p>
ăăźăżăťăăăă¨ăŤăćĺ°ééĄăăăăŻćçćéăďźčĄăŤĺşĺăăžăă<var>r<sub>i</sub></var> ă 0 ăŽćăŻćĺ°ééĄăă 1 ăŽćăŻćçćéăĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
6 5
1 2 200 10
1 4 400 15
1 3 250 25
2 4 100 10
4 5 150 20
3 5 300 20
2
1 5 0
1 5 1
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
450
35
</pre>
| [
[
"6 5\n1 2 200 10\n1 4 400 15\n1 3 250 25\n2 4 100 10\n4 5 150 20\n3 5 300 20\n2\n1 5 0\n1 5 1\n0 0\n",
"6 5\n1 2 200 10\n1 4 400 15\n1 3 250 25\n2 4 100 10\n4 5 150 20\n3 5 300 20\n2\n1 5 0\n1 5 1\n0 0\n"
]
] |
p00201 | Wrought Gold Master |
<h1>éŹéăăšăżăź</h1>
<p>
ăăŞăăŻă¤ăăŤéćłăŽéăéŹééăćăŤĺ
ĽăăžăăăéŹééăŤč¤ć°ăŽă˘ă¤ăă ăĺ
Ľăăă¨ăć°ăă㢠ă¤ăă ăä˝ăăă¨ăă§ăăžăăć°ăăä˝ăŁăă˘ă¤ăă ăŻăäťăŽă˘ă¤ăă ăä˝ăăăăŤéŹééă¸ĺ
Ľăăăă¨ăă§ăăžăăă˘ă¤ăă ăä˝ăăăăŤĺż
čŚăŞă˘ă¤ăă ăŽăŞăšăăč¨ăăăăŽăéŹéăŹăˇăă¨ĺźăśăă¨ăŤăăžăă䝼ä¸ăŽ 3 ă¤ăŻéŹéăŹăˇăăŽäžă§ăă
</p>
<ol>
<li> ć¨çă¨çł¸ă§ăŠăąăăăă§ăăă</li>
<li> ăçąłă¨ć°´ă§ăăŤăăăă§ăăă</li>
<li> ăŠăąăăă¨ăă¤ăŻă¨ăăŤăăă§ăŽăżăźăă§ăăă</li>
</ol>
<p>
ă˘ă¤ăă ăŻăéă使ăŁăŚćăŤăăăăă¨ăă§ăăžăăăéŹééă§ä˝ăŁăćšăĺŽăăăĺ ´ĺăăăăžăăäžăă°ăĺă˘ă¤ăă ăŽčłźĺ
ĽäžĄć źă䝼ä¸ăŽăăăŤä¸ăăăăŚăăă¨ăăžăă
</p>
<center>
<table border=1 cellpadding=8 cellspacing=2>
<tr><td width=140>ă˘ă¤ăă ĺ</td><td width=140> čłźĺ
ĽäžĄć ź(ĺ)</td></tr>
<tr><td> ć¨ç </td><td> 3,000</td></tr>
<tr><td> 糸 </td><td> 800</td></tr>
<tr><td> ăçął </td><td> 36</td></tr>
<tr><td> ć°´ </td><td> 0</td></tr>
<tr><td> ăŠăąăă </td><td> 5,000</td></tr>
<tr><td> ăă¤ăŻ </td><td> 9,800</td></tr>
<tr><td> ăăŤăă </td><td> 140</td></tr>
<tr><td> ăŽăżăź </td><td> 98,000</td></tr>
</tr>
</table>
<br/>
</center>
<p>
ăŠăąăă㯠5,000 ĺă§čłźĺ
Ľă§ăăžăăăć¨çă¨çł¸ăčłźĺ
ĽăăŚéŹéăăă° 3,800 ĺă§ćăŤĺ
Ľăăăăžăăć´ăŤăéŹéăéăăăă¨ăŤăăă¨ăŚăăĺžăŤă˘ă¤ăă ăćăŤĺ
Ľăăăăžăăĺł 1 ăŻä¸č¨ 3 ă¤ăŽéŹéăŹăˇăäžăçľăżĺăăăăăŽă§ăăăŽăżăźăŻ 98,000 ĺă§čłźĺ
Ľă§ăăžăăăć¨çă糸ăăçąłăć°´ăăă¤ăŻăčłźĺ
ĽăăŚéŹéăăă°ăăăŁă㎠13,636 ĺă§ćăŤĺ
Ľăăăăžăă
</p>
<br><br>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_recipe">
<p>ĺł 1</p>
</center>
<br><br>
<p>
ăăŞăăŻĺéşă漽ăŤé˛ăăăăăăŞăăšăĺŽăçŽçăŽă˘ă¤ăă ăćăŤĺ
Ľăăăă¨čăăžăăă ă˘ă¤ăă ăŽăŞăšăăéŹéăŹăˇăăŽăŞăšăăćĺŽăăăă˘ă¤ăă ăĺ
Ľĺă¨ăăćĺŽăăăă˘ă¤ăă ăä˝ăăăăŤĺż
čŚăŞééĄăŽćĺ°ĺ¤ăĺşĺăăăăă°ăŠă ăä˝ćăăŚä¸ăăă
</p>
<!--
<p>
ă˘ă¤ăă ăŞăšăăŤĺŤăžăăă˘ă¤ăă ăŽç¨ŽéĄ <var>n</var> 㯠1 äťĽä¸ 100 䝼ä¸ăŽć´ć°ă¨ăăĺă˘ă¤ăă ăčłźĺ
Ľăăĺ ´ĺăŽĺ¤ćŽľ <var>p</var> 㯠0 äťĽä¸ 1000000 䝼ä¸ă¨ăăžăăă˘ă¤ăă ăŽĺĺ <var>i</var> 㯠1 ćĺäťĽä¸ 100 ćĺ䝼ä¸ăŽă˘ăŤăăĄăăăăăăŞăĺč§ćĺĺă§ăăéŹéăŹăˇăăŽç¨ŽéĄ <var>m</var> 㯠0 äťĽä¸ 100 䝼ä¸ăŽć´ć°ă§ăă 1ă¤ăŽéŹéăŹăˇăăŻă˘ă¤ăă ăŽĺĺ <var>o</var>ăăăăä˝ăăăăŤĺż
čŚăŞă˘ă¤ăă ăŽĺć° <var>k</var> ă <var>k</var> ĺăŽă˘ă¤ăă ĺ <var>q</var> ăŽăŞăšăăŤăăŁăŚä¸ăăăăžăă<var>k</var> 㯠100 䝼ä¸ă¨ăăžăă
</p>
-->
<p>
ĺă˘ă¤ăă ăŽć°éăŤéăăŻăŞăăăŽă¨ăăžăăă˘ă¤ăă ăŻč¤ć°ăŽăŹăˇăăŤä˝żăăăăă¨ăăăăžăăă1 ă¤ăŽă˘ă¤ăă ăä˝ăăăăŽăŹăˇăăŻăăă ă 1 ă¤ă§ăăăžăăăăă˘ă¤ăă ă辡çšă¨ăăŚăŹăˇăăăăŠăŁăŚăăŁăă¨ăăăăŽă˘ă¤ăă ăĺăłăŹăˇăăŤçžăăăă¨ăŻăăăžăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>s<sub>1</sub></var> <var>p<sub>1</sub></var>
<var>s<sub>2</sub></var> <var>p<sub>2</sub></var>
:
<var>s<sub>n</sub></var> <var>p<sub>n</sub></var>
<var>m</var>
<var>o<sub>1</sub></var> <var>k<sub>1</sub></var> <var>q<sub>1</sub></var> <var>q<sub>2</sub></var> ... <var>q<sub>k<sub>1</sub></sub></var>
<var>o<sub>2</sub></var> <var>k<sub>2</sub></var> <var>q<sub>1</sub></var> <var>q<sub>2</sub></var> ... <var>q<sub>k<sub>2</sub></sub></var>
:
<var>o<sub>m</sub></var> <var>k<sub>m</sub></var> <var>q<sub>1</sub></var> <var>q<sub>2</sub></var> ... <var>q<sub>k<sub>m</sub></sub></var>
<var>t</var>
</pre>
<p>
1 čĄçŽăŤăŞăšăăŤĺŤăžăăă˘ă¤ăă ăŽç¨ŽéĄć° <var>n</var> (1 ≤ <var>n</var> ≤ 100) ăä¸ăăăăžăăçśă <var>n</var> čĄăŤ <var>i</var> çŞçŽăŽă˘ă¤ăă ăŽĺĺ <var>s<sub>i</sub></var> (1 ćĺäťĽä¸ 100 ćĺ䝼ä¸ăŽă˘ăŤăăĄăăăăăăŞăĺč§ćĺĺ) ă¨ăăăčłźĺ
Ľăăĺ ´ĺăŽĺ¤ćŽľ <var>p<sub>i</sub></var> (0 ≤ <var>p<sub>i</sub></var> ≤ 1000000)ăä¸ăăăăžăă
</p>
<p>
çśăčĄăŤéŹéăŹăˇăăŽć° <var>m</var> (0 ≤ <var>m</var> ≤ 100) ăä¸ăăăăžăăçśă <var>m</var> čĄăŤ <var>i</var> çŞçŽăŽăŹăˇăăŽć
ĺ ąăä¸ăăăăžăăĺăŹăˇăă¨ăăŚăă˘ă¤ăă ăŽĺĺ <var>o<sub>i</sub></var>ăăăăä˝ăăăăŤĺż
čŚăŞă˘ă¤ăă ăŽĺć° <var>k<sub>i</sub></var> (1 ≤ <var>k<sub>i</sub></var> ≤ 100) ă <var>k<sub>i</sub></var> ĺăŽă˘ă¤ăă ĺ <var>q<sub>1</sub></var>, <var>q<sub>2</sub></var> ... <var>q<sub>k<sub>i</sub></var> ăä¸ăăăăžăă
</p>
<p>
ćĺžăŽčĄăŤćĺŽăăăă˘ă¤ăă ĺ <var>t</var> ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 30 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăćĺ°ăŽĺ¤ćŽľăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
8
wood 3000
string 800
rice 36
water 0
racket 5000
microphone 9800
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 300000
0
computer
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
13636
300000
</pre>
| [
[
"8\nwood 3000\nstring 800\nrice 36\nwater 0\nracket 5000\nmicrophone 9800\nonigiri 140\nguitar 98000\n3\nracket 2 wood string\nonigiri 2 rice water\nguitar 3 racket microphone onigiri\nguitar\n1\ncomputer 300000\n0\ncomputer\n0\n",
"8\nwood 3000\nstring 800\nrice 36\nwater 0\nracket 5000\nmicrophone 9800\nonigiri 140\nguitar 98000\n3\nracket 2 wood string\nonigiri 2 rice water\nguitar 3 racket microphone onigiri\nguitar\n1\ncomputer 300000\n0\ncomputer\n0\n"
]
] |
p00202 | At Boss's Expense |
<h1>ä¸ĺ¸ăŽăăă</h1>
<p>
äźć´Ľĺ¤ŞéăăăŽäźç¤žăŤăŻăĺ˛ăĺăăŞăäşă大ĺŤăăŞä¸ĺ¸ăăăžăă太éăăăăăŽä¸ĺ¸ă¨éŁäşăŤčĄăă¨ăăŻăĺ˛ăĺă§äźč¨ăăăŚăăăŽă§ăăăćŻćééĄăĺĺ äşşć°ă§ĺ˛ăĺăăŞăă¨ăăŻăăă¤ăä¸ĺ¸ăăăăŁăŚăăăŚăăžăă
</p>
<p>
ăăćĽă太éăăăŻéŁäşäźăŽĺššäşăŤăŞăăžăăăăéăŽĺ°ăŞă太éăăăŻăăăŽä¸ĺ¸ăčŞăŁăŚăŞăă¨ăăăăŁăŚăăăăăăăŤĺşćĽăŞăăčăăžăăăăăćçĺąăŤćł¨ćăăăŞăăă°ăŞăăŞăăŽă§ăăăăžă ä˝äşşĺĺ ăăăăŻĺăăăŞăăŽă§ăăŠăăŞäşşć°ăĺĺ ăăŚăăăăŁăŚăăăăăăăŞćł¨ćăăăŚăăăăăăă§ăă太éăăăŽĺćă§ăĺăăéŁäşäźăŤĺĺ ăăäşĺŽăŽăăŞăăŻă太éăăăŤĺĺăăŚăäşçŽéĄäťĽä¸ă§ć大ăŽăŠăăŞäşşć°ă§ăĺ˛ăĺăăŞăééĄăçŽĺşăăăă¨ăŤăăžăăă
</p>
<p>
ćçăŽç¨ŽéĄăĺćçăŽćéăäşçŽéĄăĺ
Ľĺă¨ăăäşçŽéĄäťĽä¸ă§ć大ăŽăŠăăŞć°ĺă§ăĺ˛ăĺăăŞăĺč¨ééĄ(ăă ăă 1 ă¨ĺč¨ééĄăŻé¤ă)ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăŞăăĺ税éĄăŽćçăŻč¤ć°ĺ注ćă§ăăžăăăĺ
¨ç¨ŽéĄăŽćçă注ćăăĺż
čŚăŻăăăžăăăăă ăăăăŽăăăŞĺč¨ééĄăăŞăĺ ´ĺăŻă NA ă¨ĺşĺăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăă ĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var> <var>x</var>
<var>v<sub>1</sub></var>
<var>v<sub>2</sub></var>
:
<var>v<sub>n</sub></var>
</pre>
<p>
1 čĄçŽăŤćçăŽç¨ŽéĄ <var>n</var> (1 ≤ <var>n</var> ≤ 30) ă¨äşçŽéĄ <var>x</var> (1 ≤ <var>x</var> ≤ 1000000) ă犺ç˝ĺşĺăă§ä¸ăăăăžăăçśă<var>n</var> čĄăŤ <var>i</var> 税éĄçŽăŽćçăŽééĄă襨ăć´ć° <var>v<sub>i</sub></var> (1 ≤ <var>v<sub>i</sub></var> ≤ 1000000) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăäşçŽéĄăŤćăčżăĺč¨ééĄăăžă㯠NA ăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
4 15000
305
260
129
500
3 400
10
20
30
3 200909
5
9
12
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
14983
NA
200909
</pre>
| [
[
"4 15000\n305\n260\n129\n500\n3 400\n10\n20\n30\n3 200909\n5\n9\n12\n0 0\n",
"4 15000\n305\n260\n129\n500\n3 400\n10\n20\n30\n3 200909\n5\n9\n12\n0 0\n"
]
] |
p00203 | A New Plan of Aizu Ski Resort |
<h1>äźć´Ľĺąąăšăăźĺ ´ăŽć°äźçť</h1>
<p>
äźć´Ľĺąąăšăăźĺ ´ăŽçľĺśč
ă§ăă沚ć¨ĺąăăăŻăä¸ç´č
ĺăă¨ăăŚé厳çŠăă¸ăŁăłăĺ°ăé
罎ăăăłăźăšăç¨ćăăžăăăăłăźăšăŤăŻăăăăăŞćťăćšăăăăăˇăźăşăłä¸ăŤĺ
¨ăŚăŽăăżăźăłăŽćťăćšăĺşćĽăĺŠç¨č
ăŤăŻăăăŹăźăłăăč´ăăă¨ăŤăŞăŁăŚăăžăă
</p>
<p>
沚ć¨ĺąăăăŽăăăŤăăłăźăšăŽčŚĺăĺłăăă¨ăŤćťăćšăŽăăżăźăłć°ăĺşĺăăăăă°ăŠă ăä˝ăŁăŚăăăžăăăă
</p>
<!--
<p>
ăăăăăŞăźăăłç´ĺăŤăŞăŁăŚă沚ć¨ĺąăăăŻćťăćšăŽăăżăźăłć°ăč¨é˛ăăć¸éĄăăŞăăăŚăăž
ăăžăăăăŠăăŤăăăŚć¸éĄăä˝ăç´ăăă沚ć¨ĺąăăăŻăăłăźăšăŽčŚĺăĺłăçćăŤăăŞăăŤĺŠă
ăćąăăŚăăžăăă沚ć¨ĺąăăăŽăăăŤăăłăźăšăŽčŚĺăĺłăăă¨ăŤćťăćšăŽăăżăźăłć°ăĺşĺăă
ăăă°ăŠă ăä˝ăŁăŚăăăžăăăă
</p>
-->
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_ski"><br/>
</center>
<br/>
<p>
ăłăźăšăŻä¸ĺłăŽăă㪠<var>X × Y</var> ĺăŽăăšăăăŞăă°ăŞăăă§čĄ¨ăăăžăă塌ä¸ăĺçšă¨ăăx 座ć¨ăŻĺłăŤčĄăăŤă¤ăăŚĺ¤§ăăăŞăăy 座ć¨ăŻä¸ăŤăăăŤă¤ăăŚĺ¤§ăăăŞăăăŽă¨ăăžăă
</p>
<p>
ĺćťăćšăŽăăżăźăłăŻăćăéŤăă¨ăă(<var>y = 1</var> ăăă ăé厳çŠăŽçĄăă¨ăă) ăăăšăżăźăăăă´ăźăŤ(<var>y = Y</var>) ăŤĺăăŁăŚé˛ăă§ăăăžăăă°ăŞăăăŽăăš(<var>x, y</var>) ăŤăăćťčľ°č
ăŻă(<var>x − 1, y + 1</var>)ă(<var>x, y + 1</var>)ă (<var>x + 1, y + 1</var>) ăŽăăăăăŤç§ťĺăăăă¨ăă§ăăžăăăăšăŤăŻăé厳çŠăă¸ăŁăłăĺ°ăăăăé厳çŠăŽăăăăšăŤăŻé˛ĺ
Ľă§ăăăă¸ăŁăłăĺ°ăăăăăšăŤé˛ĺ
Ľăăă¨(<var>x, y + 2</var>) ă¸ç§ťĺăăžăăăă ăăăăĄă°ăéŤăăăš (<var>y = 1</var> ăŽăăš) ăŤăŻă¸ăŁăłăĺ°ăŻĺĺ¨ăăăă¸ăŁăłăĺ°ăŽăăăăšăŤé˛ĺ
ĽăăéăŤăŻ x 座ć¨ăĺăăăšăăăăé˛ĺ
Ľă§ăăžăăăăłăźăšăŽä¸çŤŻ(<var>y = 1</var>) ăăăšăżăźăăăăłăźăšăăăŻăăăăă¨ăŞăä¸çŤŻăčś
ăăă°(<var>y ≥ Y</var>) 1ă¤ăŽćťăćšă¨ăżăŞăăćťăçľăăăžăă
</p>
<p>
ăłăźăšăŽć
ĺ ąăĺ
Ľĺă¨ăăćťăćšăŽçˇć°ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>X</var> <var>Y</var>
<var>c<sub>11</sub></var> <var>c<sub>21</sub></var> ... <var>c<sub>X1</sub></var>
<var>c<sub>12</sub></var> <var>c<sub>22</sub></var> ... <var>c<sub>X2</sub></var>
:
<var>c<sub>1Y</sub></var> <var>c<sub>2Y</sub></var> ... <var>c<sub>XY</sub></var>
</pre>
<p>
1 čĄçŽăŤăłăźăšăŽĺ¤§ăă<var>X, Y</var> (1 ≤ <var>X, Y</var> ≤ 15) ăä¸ăăăăžăăçśă <var>Y</var> čĄăŤăłăźăšăŽć
ĺ ąăä¸ăăăăžăă<var>c<sub>ij</sub></var> (0 , 1 , 2 ăŽăăăă) ăŻ<var>x = i, y = j</var> ăŽăăšăŽć
ĺ ąă襨ăć´ć°ă§ă0 ă秝ĺĺŻč˝ăŞăăšă1 ăé厳çŠăăăăăšă2 ăă¸ăŁăłăĺ°ăăăăăšă襨ăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăăłăźăšăŽćťăćšăŽăăżăźăłć°ă1čĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
5 5
0 0 0 0 1
2 1 0 2 0
1 0 0 1 1
0 2 1 2 0
0 1 0 0 0
5 5
0 0 1 0 0
2 1 0 2 0
1 0 0 1 1
0 2 1 2 0
0 1 0 0 0
15 15
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
6
52694573
</pre>
| [
[
"5 5\n0 0 0 0 1\n2 1 0 2 0\n1 0 0 1 1\n0 2 1 2 0\n0 1 0 0 0\n5 5\n0 0 1 0 0\n2 1 0 2 0\n1 0 0 1 1\n0 2 1 2 0\n0 1 0 0 0\n15 15\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0\n",
"5 5\n0 0 0 0 1\n2 1 0 2 0\n1 0 0 1 1\n0 2 1 2 0\n0 1 0 0 0\n5 5\n0 0 1 0 0\n2 1 0 2 0\n1 0 0 1 1\n0 2 1 2 0\n0 1 0 0 0\n15 15\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0\n"
]
] |
p00204 | UFO Shooting Down Operation |
<h1>UFO ćĺ˘ä˝ćŚ</h1>
<p>
40XX ĺš´ăĺ°çăŻĺŽĺŽäşşăŽäžľćťăĺăăŚăă!ăă§ăŤĺ°çăŽăťă¨ăăŠăŻĺŽĺŽäşşăŤăăĺśĺ§ăăăŚăăăćŽăé˛čĄć çšăŻéś´ăśĺčŚĺĄăŽăżăŤăŞăŁăŚăăžăŁăăăăŽéś´ăśĺčŚĺĄăŤăăĺśĺ§é¨éă揥ă
ăŤčżŤăŁăŚăăŚăăă<!--3 ćéĺžăŤăŻćĺăŽćŚéăĺ§ăžăă ăăăăăŽăžăžă§ăŻĺ°çćĺžăŽç Śăĺśĺ§ăăăŚăăžăă-->
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_ufo">
</center>
<br>
<p>
ăăăăĺ¸ćăŻćŽăăăŚăăăé˛čĄčťăŽćçľĺ
ľĺ¨ăčś
éˇčˇé˘č˛ŤéăŹăźăśăźç ˛ăĺŽćăăăŽă ăćŹ çšă¨ăăă°ă ĺ¨ĺăĺşăăžă§ăŤä¸ĺŽăŽčˇé˘ăĺż
čŚă§ă čżăăăćľăŻăă éăăŹăăŚăăžăă¨ăăăă¨ă ă ĺ¨ĺăĺşăŞăçŻĺ˛ăŤäžľĺ
ĽăăćľăŻăäťăŽćŚĺă§ăŠăăŤăăăăăăŞăăé˛čĄčťăŽĺčŹăŻăäžľĺ
ĽăăŚćĽă UFO ăŤĺŻžĺŚăăăăăŤăăăŽć°ăçĽăăŞăăă°ăŞăăŞăăŽă ăăăăžăăŤăćľăĺ¤ăăăă§ăăžăć°ăăăăăăŤăŞăăăăă§ĺčŹăŻăăŞăăŤăăŹăźăśăźăŤćĺ˘ăăăŞăăŁă UFO ăŽć°ăĺşĺăăăăă°ăŠă ăç¨ćăăăăăŤĺ˝äť¤ăăăćŚééĺ§ăžă§ăŤăăă°ăŠă ăä˝ćăăéś´ăśĺčŚĺĄăĺŽăĺă¨ăŞăăă
</p>
<p>
ćľăŽ UFO ăŻăă ăžăŁăăăŤăŹăźăśăźç ˛ăŽăăć çšăçŽćăăŚçŞćăăŚăă(UFO ăŤăŻäşăăŤăăćăăĺŚçăć˝ăăăŚăăăčĄçŞăăŚăăžăăă¨ăŻăŞă) ăăŹăźăśăźç ˛ăŻăĺćçść
ăă 1 ĺĺžăŤćăčżă UFO ăŽä¸ĺżăçăŁăŚăŹăźăśăźăçşĺ°ăĺ§ăăăăăă 1 ĺăă¨ăŤĺăćĄäťśă§ăŹăźăśăźăçşĺ°ăçśăăăăŹăźăśăźăŻč˛ŤéăăăăŽĺ
ăŤăă UFO ăăŹăźăśăźăăăăŁăă ăă§ćĺ˘ăăăă¨ăă§ăăăăăăăăăŽăŹăźăśăźăŤăŻĺ¨ĺăŽĺşăŞăçŻĺ˛ăăăăăăŽçŻĺ˛ăŤĺ
ĽăŁăŚăăžăŁăUFO ăŻçăŁăŚăćĺłăăŞăăăăçăăŞăăăăŤč¨č¨ăăăŚăăăćĺ˘ă§ăăă ăćĺ˘ăăă¨ăăăŹăźăśăźăŽĺ¨ĺăĺşăŞăçŻĺ˛ăŤăŻä˝ćŠăŽ UFO ăäžľĺ
Ľăăă ăăăă
</p>
<p>
ăŹăźăśăźăŽĺ¨ĺăĺşăŞăçŻĺ˛ăŽĺĺž <var>R</var> ă¨ă輲ćĽăă UFO ăŽć
ĺ ąăĺ
Ľĺă¨ăăćĺ˘ăăăäžľĺ
ĽăăŚăă UFO ăä˝ćŠăăăăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă 輲ćĽăă UFO ăŽć
ĺ ąăŻăUFO ăŽć° <var>N</var> ăĺ UFO ăŽĺćĺş§ć¨ (<var>x0, y0</var>)ăĺ UFO ăŽĺĺž <var>r</var> ăĺ UFO ăŽĺé <var>v</var> ă§ć§ćăăăžăă
</p>
<p>
座ć¨ăŽĺçš (0 , 0) ăăŹăźăśăźç ˛ăŽä˝ç˝Žă¨ăăžăăăŹăźăśăźç ˛ă¨ UFO ăŽčˇé˘ăŻĺçšăă UFO ăŽä¸ĺżăžă§ăŽčˇé˘ă§ä¸ăăăăăăŽčˇé˘ă <var>R</var> 䝼ä¸ăŽ UFO ăŻăŹăźăśăźăŽĺ¨ĺăĺşăŞăçŻĺ˛ăŤĺ
ĽăŁăă¨ăăžăăçăăšă寞蹥ăĺćăŤč¤ć°ĺĺ¨ăăĺ ´ĺăŻăŞăăăŽă¨ăăŚčăăžăăč¨çŽăŻĺ
¨ăŚĺšłé˘ä¸ă§čăăĺ
ĽĺăŻăăšăŚć´ć°ă§ä¸ăăăăžăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăă ĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>R</var> <var>N</var>
<var>x0<sub>1</sub></var> <var>y0<sub>1</sub></var> <var>r<sub>1</sub></var> <var>v<sub>1</sub></var>
<var>x0<sub>2</sub></var> <var>y0<sub>2</sub></var> <var>r<sub>2</sub></var> <var>v<sub>2</sub></var>
:
<var>x0<sub>N</sub></var> <var>y0<sub>N</sub></var> <var>r<sub>N</sub></var> <var>v<sub>N</sub></var>
</pre>
<p>
1 čĄçŽăŤăŹăźăśăźăŽĺ¨ĺăĺşăŞăçŻĺ˛ăŽĺĺž <var>R</var> (1 ≤ <var>R</var> ≤ 500) ă¨UFO ăŽć° <var>N</var> (1 ≤ <var>N</var> ≤ 100) ăä¸ăăăăžăăçśă <var>N</var> čĄăŤ <var>i</var> ćŠçŽăŽ UFO ăŽć
ĺ ą <var>x0<sub>i</sub></var>, <var>y0<sub>i</sub></var> (-100 ≤ <var>x0<sub>i</sub></var>, <var>y0<sub>i</sub></var> ≤ 1000), <var>r<sub>i</sub></var>, <var>v<sub>i</sub></var> (1 ≤ <var>r<sub>i</sub></var>, <var>v<sub>i</sub></var> ≤ 500) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăăŹăźăśăźăŽĺ¨ĺăĺşăŞăçŻĺ˛ăŤäžľĺ
Ľăă UFO ăŽć°ă1čĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
100 5
101 101 5 5
110 110 2 3
-112 -100 9 11
-208 160 82 90
-110 108 10 2
10 11
15 0 5 1
25 0 5 1
35 0 5 1
45 0 5 1
55 0 5 1
65 0 5 1
75 0 5 1
85 0 5 1
95 0 5 1
-20 0 5 20
-30 0 500 5
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1
1
</pre>
| [
[
"100 5\n101 101 5 5\n110 110 2 3\n-112 -100 9 11\n-208 160 82 90\n-110 108 10 2\n10 11\n15 0 5 1\n25 0 5 1\n35 0 5 1\n45 0 5 1\n55 0 5 1\n65 0 5 1\n75 0 5 1\n85 0 5 1\n95 0 5 1\n-20 0 5 20\n-30 0 500 5\n0 0\n",
"100 5\n101 101 5 5\n110 110 2 3\n-112 -100 9 11\n-208 160 82 90\n-110 108 10 2\n10 11\n15 0 5 1\n25 0 5 1\n35 0 5 1\n45 0 5 1\n55 0 5 1\n65 0 5 1\n75 0 5 1\n85 0 5 1\n95 0 5 1\n-20 0 5 20\n-30 0 500 5\n0 0\n"
]
] |
p00205 | Rock |
<H1>ăăăăă</H1>
<p>
䝲čŻă 5 äşşçľă§ăăăăăăăăăă¨ăŤăŞăăžăăăăăăăăă¨ăŻăă°ăźăăă§ăăăăźă¨ăă 3ă¤ăŽćăăăăă°ăźă¨ăă§ăăŽĺč˛ ăŞăă°ăźăăĺăĄăăťăă§ăăăč˛ ăăăăă§ăă¨ăăźăŞăăăă§ăăăĺăĄăăťăăźăăč˛ ăăăăăźă¨ă°ăźăŞăăăźăăĺăĄăăťă°ăźăăč˛ ăăă¨ăăăŤăźăŤă§ăăĺ
¨ĺĄăĺăćăăžăăŻă°ăźăăă§ăăăăźĺ
¨ăŚăĺşăĺ ´ĺăŻăăăăăă¨ăŞăăžăă
</p>
<p>
5 äşşăŽăăăăăăŽćăĺ
Ľĺă¨ăăăăăăăŽäşşăŽĺćăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăăăăăăŽćăŻăă°ăźăŻ 1ăăă§ă㯠2ăăăźăŻ 3 ăŽć°ĺă§čĄ¨ăăžăăĺćăŻăĺăĄăă 1ăăč˛ ăăă 2ăăăăăăă 3 ăŽć°ĺă§čĄ¨ăăĺ
Ľĺé ăŤĺžăŁăŚĺşĺăăžăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>h<sub>1</sub></var>
<var>h<sub>2</sub></var>
<var>h<sub>3</sub></var>
<var>h<sub>4</sub></var>
<var>h<sub>5</sub></var>
</pre>
<p>
<var>i</var> čĄçŽăŤ <var>i</var> äşşçŽăŽć <var>h<sub>i</sub></var> (1, 2 ăžă㯠3) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 200 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤă5 äşşăŽĺćăĺşĺăăžăă<var>i</var> čĄçŽăŤ <var>i</var> äşşçŽăŽĺć(1, 2 ăžă㯠3) ăĺşĺăăŚăă ăăă
</p>
<H2>Sample Input</H2>
<pre>
1
2
3
2
1
1
2
2
2
1
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
3
3
3
3
3
1
2
2
2
1
</pre>
| [
[
"1\n2\n3\n2\n1\n1\n2\n2\n2\n1\n0\n",
"1\n2\n3\n2\n1\n1\n2\n2\n2\n1\n0\n"
]
] |
p00206 | Next Trip |
<H1>ć
čĄăŻăă¤?</H1>
<p>
ăăŞăăŻĺäşşă¨ć
čĄăŤčĄăăăă¨čăăŚăăžăăă¨ăăăă澪貝çăŽăăĺäşşăŻăŞăăŞăć
čĄč˛ťç¨ă貯ăăăă¨ăă§ăăžăăăĺäşşăäťăŽçć´ťăçśăăŚăăă¨ăć
čĄăŤčĄăăŽăŻăă¤ăŤăŞăŁăŚăăžăăĺăăăžăăăăăă§ăćŠăć
čĄăŤčĄăăăăăŞăăŻăĺäşşăč¨çťçăŤč˛Żčăăăă¨ăĺŠăăăăă°ăŠă ăä˝ćăăăă¨ăŤăăžăăă
</p>
<p>
ĺäşşăŽăăćăŽăĺ°éŁăă <var>M</var> ĺăăăŽćăŤä˝żăăéă <var>N</var> ĺă¨ăăă¨ăăăŽć㯠(<var>M</var> - <var>N</var>) ĺ貯čăăăžăăćŻćăŽĺćŻć
ĺ ą <var>M</var> ă <var>N</var> ăĺ
Ľĺă¨ăă貯čéĄăć
čĄč˛ťç¨ <var>L</var> ăŤéăăăŽăŤăăăćć°ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăă12 ăśćăéăăŚă貯čéĄăć
čĄč˛ťç¨ăŤéăăŞăăŁăĺ ´ĺăŻNA ă¨ĺşĺăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăă ĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>L</var>
<var>M<sub>1</sub></var> <var>N<sub>1</sub></var>
<var>M<sub>2</sub></var> <var>N<sub>2</sub></var>
:
<var>M<sub>12</sub></var> <var>N<sub>12</sub></var>
</pre>
<p>
1 čĄçŽăŤć
čĄč˛ťç¨ <var>L</var> (1 ≤ <var>L</var> ≤ 1000000, ć´ć°) ăä¸ăăăăžăăçśă 12 čĄăŤă<var>i</var> ćçŽăŽĺćŻć
ĺ ą <var>M<sub>i</sub></var>, <var>N<sub>i</sub></var> (0 ≤ <var>M<sub>i</sub>, N<sub>i</sub></var> ≤ 100000, <var>N<sub>i</sub></var> ≤ <var>M<sub>i</sub></var>, ć´ć°) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 1000 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤă貯čéĄăć
čĄč˛ťç¨ăŤéăăăŽăŤăăăćć°ăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
10000
5000 3150
5000 5000
0 0
5000 1050
5000 3980
5000 210
5000 5000
5000 5000
0 0
5000 2100
5000 2100
5000 2100
29170
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 70831
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
6
NA
</pre>
| [
[
"10000\n5000 3150\n5000 5000\n0 0\n5000 1050\n5000 3980\n5000 210\n5000 5000\n5000 5000\n0 0\n5000 2100\n5000 2100\n5000 2100\n29170\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 70831\n0\n",
"10000\n5000 3150\n5000 5000\n0 0\n5000 1050\n5000 3980\n5000 210\n5000 5000\n5000 5000\n0 0\n5000 2100\n5000 2100\n5000 2100\n29170\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 70831\n0\n"
]
] |
p00207 | Block |
<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 ĺăŻăăźăăŽä¸ăŤăăăăŻăćˇă芰ăăŚăăžăă彟ăŤăä˝ăä˝ăŁăŚăăăŽ?ăă¨čăă¨ă彟ăŻă迡衯!!ăă¨ĺ
ć°ăăçăăžăăă彟ăŽč¨ă迡衯ă¨ăŻăăšăżăźăăăă´ăźăŤăžă§ĺ´é˘ăćĽăăŚăăăĺăč˛ăŽăăăăŻă ăă§ăăŠăăă¨ăă§ăăăăăăŻăŽé
罎ăŽăă¨ă ăăă§ăăĺł 2 ăŻéťč˛ăŽăăăăŻăŤăăă塌ä¸(ăšăżăźă)ăăĺłä¸(ă´ăźăŤ)ă¸čżˇčˇŻăă§ăăŚăăăă¨ă襨ăăŚăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_blockMaze2">
<p>
ĺł2
</p>
</center>
<p>
çĄéŞć°ăŤéăă§ăă B ĺă横çŽăŤăăăă°ăŠăăźă§ăăăăŞăăŻăăăăăŻăŽä¸Śăłă迡衯ă¨ăŞăŁăŚăăăă確ăăăŚăżăăă¨ăŤăăžăăă
</p>
<p>
ăăăăŻăŽć
ĺ ąă¨ăšăżăźăăă´ăźăŤăŽĺş§ć¨ăĺ
Ľĺă¨ăăăăăăŻă迡衯ă¨ăŞăŁăŚăăă° OK ăăŞăŁăŚăăŞăăă° NG ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă ăăźăăŻć¨Şćšĺ㍠<var>w</var> ă縌ćšĺ㍠<var>h</var> ăŽĺ¤§ăăăăăĄă 塌ä¸ăŽĺş§ć¨ăŻ(1 , 1)ăĺłä¸ăŽĺş§ć¨ăŻ(<var>w, h</var>)ă¨ăăžăăăăăăŻăŻ <var>2 × 4</var> ăŽéˇćšĺ˝˘ă§ăăšăŚĺă大ăăă§ăăăăăăŻăŽč˛ <var>c</var> 㯠1 (ç˝)ă2 (éť)ă3 (çˇ)ă4 (é)ă5 (辤) ăŽăăăăă§ăăăăăăŻăŽăăźăä¸ă§ăŽĺă <var>d</var> 㯠横ćšĺăŤéˇăĺ ´ĺ 0 ă 縌ćšĺăŤéˇăĺ ´ĺ 1 ă¨ăăžăă ăăăăŻăŽä˝ç˝ŽăŻăăăăŻăŽĺˇŚä¸ăŽĺş§ć¨ (<var>x, y</var>) ăŤăăŁăŚčĄ¨ăăăžăăăŞăăăăăăŻăŽä˝ç˝ŽăŻäťăŽăăăăŻă¨éăŞăăă¨ăŻçĄăăăăźăăăăŻăżĺşăăă¨ăăăăžăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăă ĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>w</var> <var>h</var>
<var>xs</var> <var>ys</var>
<var>xg</var> <var>yg</var>
<var>n</var>
<var>c<sub>1</sub></var> <var>d<sub>1</sub></var> <var>x<sub>1</sub></var> <var>y<sub>1</sub></var>
<var>c<sub>2</sub></var> <var>d<sub>2</sub></var> <var>x<sub>2</sub></var> <var>y<sub>2</sub></var>
:
<var>c<sub>n</sub></var> <var>d<sub>n</sub></var> <var>x<sub>n</sub></var> <var>y<sub>n</sub></var>
</pre>
<p>
1 čĄçŽăŤăăźăăŽĺ¤§ăă<var>w, h</var> (4 ≤ <var>w, h</var> ≤ 100) ăä¸ăăăăžăă2 čĄçŽăŤăšăżăźăăŽĺş§ć¨ <var>xs, ys</var>ă3 čĄçŽăŤă´ăźăŤăŽĺş§ć¨ <var>xg, yg</var> ăä¸ăăăăžăă
</p>
<p>
4 čĄçŽăŤăăăăŻăŽĺć° <var>n</var> ăä¸ăăăăžăăçśă <var>n</var> čĄăŤ <var>i</var> çŞçŽăŽăăăăŻăŽč˛ <var>c<sub>i</sub></var>ăĺă <var>d<sub>i</sub></var>ăä˝ç˝Ž <var>x<sub>i</sub>, y<sub>i</sub></var> ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 30 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăĺ¤ĺĽçľćăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
20 20
1 1
9 9
7
2 0 1 1
5 1 1 3
2 1 3 3
1 1 5 2
5 1 7 3
2 0 2 7
2 0 6 8
20 20
9 9
1 1
6
2 0 1 1
1 0 5 1
2 1 1 3
5 0 1 7
3 1 5 5
4 1 8 5
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
OK
NG
</pre>
| [
[
"20 20\n1 1\n9 9\n7\n2 0 1 1\n5 1 1 3\n2 1 3 3\n1 1 5 2\n5 1 7 3\n2 0 2 7\n2 0 6 8\n20 20\n9 9\n1 1\n6\n2 0 1 1\n1 0 5 1\n2 1 1 3\n5 0 1 7\n3 1 5 5\n4 1 8 5\n0 0\n",
"20 20\n1 1\n9 9\n7\n2 0 1 1\n5 1 1 3\n2 1 3 3\n1 1 5 2\n5 1 7 3\n2 0 2 7\n2 0 6 8\n20 20\n9 9\n1 1\n6\n2 0 1 1\n1 0 5 1\n2 1 1 3\n5 0 1 7\n3 1 5 5\n4 1 8 5\n0 0\n"
]
] |
p00208 | Room Numbers of a Hospital |
<H1>ç
é˘ăŽé¨ĺąçŞĺˇ </H1>
<p>
ăŚăŠăźăżăźăăăłăŤä˝ăĺťşçŻĺŽśăŽăăăłăăźăăăŽăă¨ăŤăĺ¤ă大ç
é˘ăćščŁ
ăăäťäşăŽäžé źăčăčžźăă§ăăžăăă
</p>
<p>
ĺ˝ăŤăăŁăŚăŻĺżăżć°(ăăżăă)ă¨ăăŚĺŤăăăć°ĺăé¨ĺąçŞĺˇăŤç¨ăăăăŞăäşşăăăžă(ćĽćŹă§ăŻ 4 㨠9 ăćĺă§ă)ăăăăăăăŽç
é˘ăŽé¨ĺąçŞĺˇăŻĺżăżć°ăŤé˘äżăŞăă1 ăăé çŞăŤäťăăăăŚăăžăăă
</p>
<p>
ăăăć°ăŤăŞăŁăăăăłăăźăăăŻăćŠćăăăăăŽĺ
Ľăćżăăĺ
¨ăŚçľăăĺăŤăŚăŠăźăżăźăăăłăŽĺżăżć°ă§ăăă4ăă¨ă6ăăé¤ăăć°ĺă§é¨ĺąçŞĺˇăäťăăŞăăăŚăăžăăžăăăăăăăĺ
Ľăćżăä˝ćĽăŻć§é¨ĺąçŞĺˇă§č¨çťăăŚăăăŽă§ăćŽăăŽä˝ćĽă確ĺŽăŤčĄăăŤăŻć§é¨ĺąçŞĺˇăć°é¨ĺąçŞĺˇăŤĺ¤ćăăĺż
čŚăăăăžăăč¨çŽăčŚćăŞăăăłăăźăăăŻăăŽăă¨ăŤć°ăĽăăŚćçśă¨ăăŚăăžăă
</p>
<p>
ăăăŞăăăłăăźăăăŽăăăŤăć§é¨ĺąçŞĺˇăĺ
Ľĺă¨ă寞ĺżăăć°é¨ĺąçŞĺˇăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<p>
15 çŞçŽăžă§ăŽé¨ĺąçŞĺˇăŽĺŻžĺżčĄ¨ăŻäťĽä¸ăŽăăăŤăŞăăžăă
</p>
<center>
<table border=1 cellpadding=0 cellspacing=0>
<tr>
<td width=100>ć§é¨ĺąçŞĺˇ</td><td width=24> 1</td><td width=24> 2</td><td width=24> 3</td><td width=24> 4</td><td width=24> 5</td><td width=24> 6</td><td width=24> 7</td><td width=24> 8 </td><td width=24> 9 </td><td width=24> 10 </td><td width=24> 11</td><td width=24> 12</td><td width=24> 13</td><td width=24> 14</td><td width=24> 15</td>
</tr>
<tr>
<td>ć°é¨ĺąçŞĺˇ</td><td> 1</td><td> 2</td><td> 3</td><td> 5 </td><td>7</td><td> 8</td><td> 9</td><td> 10</td><td> 11</td><td> 12</td><td> 13</td><td> 15</td><td> 17</td><td> 18 </td><td>19</td>
</tr>
</table>
</center>
<br/>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăă¨ăăŚăć§é¨ĺąçŞĺˇă襨ăć´ć° <var>n</var> (1 ≤ <var>n</var> ≤ 1,000,000,000) ăďźčĄăŤä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 30000 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăć°é¨ĺąçŞĺˇăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
15
100
1000000000
3
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
19
155
9358757000
3
</pre>
| [
[
"15\n100\n1000000000\n3\n0\n",
"15\n100\n1000000000\n3\n0\n"
]
] |
p00209 | Scene in a Picture |
<H1>ĺçăŤĺăŁăŚăăćŻč˛ăŻ?</H1>
<p>
A ĺăŻäźć´ĽăŤčŚłĺ
ăŤăăŁăŚăăžăăă县ćłăăăăăŤăŽçŞăăăŻäźć´Ľçĺ°ăä¸ćă§ăăžăăćŻč˛ăçşăăŚăăă¨ăĺşăŤĺçăŽĺă獯ăč˝ăĄăŚăăăŽăŤć°ăă¤ăăžăăăăŠăăăçŞăăĺ¤ăŽćŻč˛ăćŽăŁăăăă§ăăăăŠăŽčžşăăćŽăŁăăŽăăŞăă¨ăA ĺăŻçŞăŽĺ¤ăŽćŻč˛ă¨ĺçăĺă大ăăăŤăŞăăăăŤĺçăăăăăŚăĺçă¨çŞăŽĺ¤ăŽćŻč˛ăä¸č´ăăĺ ´ćăć˘ăĺ§ăăžăăă
</p>
<p>
ăăă§ăŻăA ĺăăăŁăŚăăăă¨ăăłăłăăĽăźăżă§ăăŁăŚăżăžăăăăçŞăŽĺ¤ăŽćŻč˛ă <var>n × n</var> ăăšăŽćŁćšĺ˝˘ăŤĺĺ˛ăăžă (<var>n</var> ăćŻč˛ăŽĺ¤§ăăă¨ĺźăłăžă)ăĺăăšăŤăŻăăăŽăăšăŽçťĺăŽć
ĺ ąă襨ă 0 䝼ä¸ăŽć´ć°ăć¸ăăăŚăăžăăăăšăŽä˝ç˝ŽăŻĺş§ć¨ (<var>x, y</var>) ă§čĄ¨ăăžăăĺăăšăŽĺş§ć¨ăŻäťĽä¸ăŽéăăŤăŞăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_reflectedScene1"><br/>
</center>
<br/>
<p>
ĺçăŽĺă獯ăŻă<var>m × m</var> ăăšăŽćŁćšĺ˝˘ă§čĄ¨ăăăžă (<var>m</var> ăĺçăŽĺă獯ăŽĺ¤§ăăă¨ĺźăłăžă) ăăăŽćŁćšĺ˝˘ăŽä¸ă§ăĺă獯ăŽé¨ĺăŽăăšăŤăŻçťĺăŽć
ĺ ąăăĺă獯ăŤĺŤăžăăŞăé¨ĺăŽăăšăŤăŻ -1 ăć¸ăăăŚăăžăăăă¨ăă°ăä¸ĺłă§ăŻăč˛ăĺĄăăăŚăăé¨ĺăĺŽéăŽĺçăŽĺă獯ăŽĺ˝˘ă襨ăăŚăăžăăĺă獯ăŤçŠ´ăéăăŚăăăă¨ăŻăăăžăăăĺż
ă 1 ă¤ăŤă¤ăŞăăŁăŚăăžăă (0 䝼ä¸ăŽĺ¤ăăă¤ăăšăé çšă ăă§ćĽăăŚăăă¨ăăŻăă¤ăŞăăŁăŚăăŞăăăŽă¨ăżăŞăăžăă) ăžăăĺ¤ -1 ăŽăăšă縌ăžăăŻć¨Ş 1 ĺăŤçŤŻăă獯ăžă§ä¸Śăśăă¨ăŻăăăžăăă
</p>
<br>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_reflectedScene2">
</center>
<br>
<p>
çŞăăčŚăăćŻč˛ăŽä¸ă§ăĺçăŽĺă獯ă 0ă90ă180ă270 庌ĺ蝢ăăăăăăăă¨ä¸č´ăăé ĺăć˘ăăžăăăă¨ăă°ăćŻč˛ăä¸ĺłăŽăăăŤčĄ¨ăăăă¨ăăä¸ĺłăŽĺă獯ăĺćč¨ĺăăŤ90 庌ĺ蝢ăăăă¨ăč˛ăĺĄăăăé ĺăŤä¸č´ăăžăă
</p>
<br>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_reflectedScene3">
</center>
<br>
<p>
çŞăăčŚăăćŻč˛ă¨ĺçăŽĺă獯ăŽć
ĺ ąăĺ
Ľĺă¨ăăćŻč˛ăŽä¸ă§ăĺă獯ă 0ă90ă180ă270 庌ĺ蝢ăăăăăăăă¨ä¸č´ăăé ĺăŽćăä¸çŤŻăŤčżăăăšăŽăăĄăćă塌獯ăŤčżăăăšăŽĺş§ć¨ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<p>
ä¸č´ăăé ĺăč¤ć°ăăĺ ´ĺăŻăăăăăŽé ĺĺ
ăŤăăăăšăŽä¸ă§ăćăä¸çŤŻăŤčżăăăšăŽăăĄăćă塌獯ăŤčżăăăšăŽĺş§ć¨ăĺşĺăăŚăă ăăăä¸č´ăăé ĺăăŞăă¨ăăŻăNA ă¨ĺşĺăăžăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var> <var>m</var>
<var>w<sub>11</sub></var> <var>w<sub>12</sub></var> ... <var>w<sub>1n</sub></var>
<var>w<sub>21</sub></var> <var>w<sub>22</sub></var> ... <var>w<sub>2n</sub></var>
:
<var>w<sub>n1</sub></var> <var>w<sub>n2</sub></var> ... <var>w<sub>nn</sub></var>
<var>p<sub>11</sub></var> <var>p<sub>12</sub></var> ... <var>p<sub>1m</sub></var>
<var>p<sub>21</sub></var> <var>p<sub>22</sub></var> ... <var>p<sub>2m</sub></var>
:
<var>p<sub>m1</sub></var> <var>p<sub>m2</sub></var> ... <var>p<sub>mm</sub></var>
</pre>
<p>
1 čĄçŽăŤ<var>n, m</var> (1 ≤ <var>n</var> ≤ 100, 1 ≤ <var>m</var> ≤ 50, <var>m</var> ≤ <var>n</var>) ăä¸ăăăăžăă
</p>
<p>
çśă <var>n</var> čĄăŤçŞăăčŚăăćŻč˛ăŽć
ĺ ą <var>w<sub>ij</sub></var> (0 ≤ <var>w<sub>ij</sub></var> ≤ 15)ăçśă <var>m</var> čĄăŤĺçăŽĺă獯ăŽăăźăżăŽć
ĺ ą <var>p<sub>ij</sub></var> (-1 ≤ <var>p<sub>ij</sub></var> ≤ 15) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăăăšăŽä˝ç˝ŽăŽĺş§ć¨ăžă㯠NA ăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
8 4
2 1 3 1 1 5 1 3
2 3 2 4 1 0 2 1
0 3 1 2 1 1 4 2
1 2 3 2 1 1 5 4
0 2 0 1 1 3 2 1
1 3 1 2 2 4 3 2
5 1 2 1 4 1 1 5
4 1 1 0 1 2 2 1
2 -1 -1 -1
0 3 -1 -1
-1 2 2 4
-1 1 -1 1
5 3
1 0 2 3 5
2 3 7 2 1
2 5 4 2 2
8 9 0 3 3
3 6 0 4 7
-1 -1 2
-1 3 5
0 4 -1
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4 2
NA
</pre>
| [
[
"8 4\n2 1 3 1 1 5 1 3\n2 3 2 4 1 0 2 1\n0 3 1 2 1 1 4 2\n1 2 3 2 1 1 5 4\n0 2 0 1 1 3 2 1\n1 3 1 2 2 4 3 2\n5 1 2 1 4 1 1 5\n4 1 1 0 1 2 2 1\n2 -1 -1 -1\n0 3 -1 -1\n-1 2 2 4\n-1 1 -1 1\n5 3\n1 0 2 3 5\n2 3 7 2 1\n2 5 4 2 2\n8 9 0 3 3\n3 6 0 4 7\n-1 -1 2\n-1 3 5\n0 4 -1\n0 0\n",
"8 4\n2 1 3 1 1 5 1 3\n2 3 2 4 1 0 2 1\n0 3 1 2 1 1 4 2\n1 2 3 2 1 1 5 4\n0 2 0 1 1 3 2 1\n1 3 1 2 2 4 3 2\n5 1 2 1 4 1 1 5\n4 1 1 0 1 2 2 1\n2 -1 -1 -1\n0 3 -1 -1\n-1 2 2 4\n-1 1 -1 1\n5 3\n1 0 2 3 5\n2 3 7 2 1\n2 5 4 2 2\n8 9 0 3 3\n3 6 0 4 7\n-1 -1 2\n-1 3 5\n0 4 -1\n0 0\n"
]
] |
p00210 | The Squares |
<H1>ăśăťăšăŻă¨ă˘ăźăş</H1>
<p>
ăăŽĺşŚăćĺăŞăăźăăăźăŻăŤă塨大迡衯ăśăťăšăŻă¨ă˘ăźăşăć°ăăĺŽćăăžăăă ćśé˛ç˝˛ăŽćĺ°ăŤăăéżéŁč¨çˇ´ăăăŞăăă°ăŞăăžăăăă塨大迡衯ăŞă ăăŤč¨çˇ´ăŤăăăćéăäşć¸Źăăăă¨ăă§ăăžăăăăăă§ăăăŞăăŻäťĽä¸ăŽäťć§ăăă¨ăŤéżéŁč¨çˇ´ăˇăăĽăŹăźăżăéçşăăăă¨ăŤăŞăăžăăă
</p>
<p>
塨大迡衯ăŻĺł 1 ăŤç¤şăăăăŤă横 <var>W</var> ă縌 <var>H</var> ㎠<var>W × H</var> ĺăŽăăšçŽă§čĄ¨ăăăăžăăĺăăšçŽăŻăé衯(ç˝ăăăšçŽ)ăĺŁ(čśč˛ăăăšçŽ) ăé常ĺŁ(çˇăŽăăšçŽ)ăŽăăăăă§ăăĺłä¸ăŽâăŻäşşă襨ăăăăŽä¸ăŽčąĺ°ćĺ(EăWăSăN)ăŻăăŽäşşăĺăăŚăăćšč§(ćąčĽżĺĺ)ă襨ăăŚăăžăăĺłăŻä¸ćšĺăĺăŤăŞăăăăŤćăăăŚăăžăă
</p>
<br>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_squares">
<p>ĺł1</p>
</center>
<br/>
<p>
塨大迡衯ĺ
ăŤăăäşşăŻćĺăćąčĽżĺĺăŽăăăăăŽćšĺăĺăăŚçŤăŁăŚăăžăăĺ人㯠1 ç§ĺä˝ă§ĺćăŤćŹĄăŤç¤şăćé ă§ç§ťĺă芌ăżăžăă
</p>
<ol>
<li>çžĺ¨ĺăăŚăăćšĺăŽăĺłăĺă塌ăĺžăŽăăšçŽăé çŞăŤčŞżăšăćĺăŤčŚă¤ăăă犺ăăŚăăé衯ăžăăŻé常ĺŁăŽćšĺăŤĺăăĺ¤ăăžăăăăŽăăăŞăăšçŽăçĄăĺ ´ĺăŻĺăăĺ¤ăăžăăă</li>
<li> çŽăŽĺăŽăăšçŽă犺ăăŚăăŚăäťăŽäşşăŽçŽăŽĺăŽăăšçŽăŤăŞăŁăŚăăŞăĺ ´ĺăŻç§ťĺăăžăăĺăăăšçŽăçŽăŽĺăŽăăšă¨ăăäşşăč¤ć°ăăĺ ´ĺăŻăăăŽăăšçŽăŽăćąăĺă輿ăĺăŽăăšçŽăŤăăäşşăŽé ă§é¸ćăăă 1 äşşă秝ĺăăžăă
</li>
</ol>
<p>
秝ĺĺžăŤé常ĺŁăŤĺ°çăăäşşăŻăçĄäşéżéŁă迡衯ĺ
ăăćśăăžăă
</p>
<p>
ä¸ăăăă塨大迡衯ă¨äşşăŽä˝ç˝Žć
ĺ ąăĺ
Ľĺă¨ăăĺ
¨ăŚăŽäşşăéżéŁăçľăăćéăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă čąĺşăŤ 180 ç§ăăéˇăćéăčŚăăĺ ´ĺ㯠NA ă¨ĺşĺăăŚä¸ăăă 迡衯ă¨äşşăŽä˝ç˝Žć
ĺ ąăŻă <var>H</var> čĄ <var>W</var> ĺăŽćĺăŤăăŁăŚä¸ăăăăžăăĺćĺăŽćĺłăŻäťĽä¸ăŽă¨ăăă§ăă
</p>
<p>
<span>#</span> : ĺŁ<br>
<span>.</span> : ĺş<br>
<span>X</span> : é常ĺŁ<br>
<span>E</span> : ćąăĺăăŚăăäşş<br>
<span>N</span> : ĺăĺăăŚăăäşş<br>
<span>W</span> : 輿ăĺăăŚăăäşş<br>
<span>S</span> : ĺăĺăăŚăăäşş<br>
</p>
<p>
ăŞăă迡衯ă¨ĺ¤é¨ă¨ăŽĺ˘çăŻĺŁ <span>#</span> ăžăăŻéĺ¸¸ĺŁ <span>X</span> ăŽăăăăă§ăăăžăă塨大迡衯ăŽä¸ăŤăŻăäşşăĺż
ăďźäşşäťĽä¸ăăžăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăă ĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>W</var> <var>H</var>
<var>str<sub>1</sub></var>
<var>str<sub>2</sub></var>
:
<var>str<sub>H</sub></var>
</pre>
<p>
1 čĄçŽăŤčżˇčˇŻăŽć¨ŞćšĺăŽĺ¤§ăă <var>W</var>ă縌ćšĺăŽĺ¤§ăă <var>H</var> (1 ≤ <var>W, H</var> ≤ 30) ăä¸ăăăăžăăçśă <var>H</var> čĄăŤčżˇčˇŻăŽ <var>i</var> čĄçŽă襨ăćĺĺ <var>str<sub>i</sub></var> (éˇă <var>W</var>) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăĺ
¨ăŚăŽäşşăéżéŁăçľăăćéăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
10 3
##########
#E.......X
##########
4 4
####
#N.#
#..X
####
5 5
#####
#N..#
###.X
#S..#
#####
6 6
######
#..#X#
#.EE.#
####N#
#....#
######
8 8
##X#####
#....E.#
#####.##
#.#...##
#.W.#..#
#.#.N#.X
#X##.#.#
########
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
NA
9
16
10
</pre>
| [
[
"10 3\n##########\n#E.......X\n##########\n4 4\n####\n#N.#\n#..X\n####\n5 5\n#####\n#N..#\n###.X\n#S..#\n#####\n6 6\n######\n#..#X#\n#.EE.#\n####N#\n#....#\n######\n8 8\n##X#####\n#....E.#\n#####.##\n#.#...##\n#.W.#..#\n#.#.N#.X\n#X##.#.#\n########\n0 0\n",
"10 3\n##########\n#E.......X\n##########\n4 4\n####\n#N.#\n#..X\n####\n5 5\n#####\n#N..#\n###.X\n#S..#\n#####\n6 6\n######\n#..#X#\n#.EE.#\n####N#\n#....#\n######\n8 8\n##X#####\n#....E.#\n#####.##\n#.#...##\n#.W.#..#\n#.#.N#.X\n#X##.#.#\n########\n0 0\n"
]
] |
p00211 | Jogging |
<H1>ăżăăŞă§ă¸ă§ăŽăłă°</H1>
<p>
辤ăăłĺ°ĺŚć Ąă§ăŻăçĺžĺ
¨ĺĄăĺĺ ăăăăĄăăŁă¨ĺ¤ăăŁăă¸ă§ăŽăłă°ăăăžăăçĺžăŻăăăăăçŹčŞăŽĺ¨ĺăłăźăšăăčŞĺăŽăăźăšă§čľ°ăăžăăăăăăčŞĺăŽăłăźăšă 1 ĺ¨ăăă¨ĺ°ĺŚć ĄăŤćťăŁăŚăăžăăĺ
¨ĺĄăĺ°ĺŚć ĄăĺćăŤăšăżăźăăăŚăăăĺ
¨ĺĄăĺćăŤĺ°ĺŚć Ąă§ćĺăŤĺşäźăăŽăŻăăăăăä˝ĺ¨ăăă¨ăă§ăăăă?
</p>
<p>
çĺžăŽäşşć° <var>n</var>ăĺçĺžăŽăłăźăšăŽ 1 ĺ¨ăŽčˇé˘ <var>d</var> (km) ăĺçĺžăŽčľ°ăéă <var>v</var> (km/ćé)ăĺ
Ľĺă¨ăăĺ
¨ĺĄăĺ°ĺŚć ĄăĺćăŤăšăżăźăăăŚăă揥ăŤĺćăŤĺ°ĺŚć ĄăŤä˝ç˝ŽăăăŽăŻăĺçĺžăăăăăä˝ĺ¨ăăă¨ăăăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăŞăăĺçĺžăŻ 2<sup>31</sup>-1 ĺ¨ăčś
ăăŚčľ°ăăă¨ăŻăăăžăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>d<sub>1</sub></var> <var>v<sub>1</sub></var>
<var>d<sub>2</sub></var> <var>v<sub>2</sub></var>
:
<var>d<sub>n</sub></var> <var>v<sub>n</sub></var>
</pre>
<p>
1 čĄçŽăŤçĺžăŽäşşć° <var>n</var> (2 ≤ <var>n</var> ≤ 10) ăä¸ăăăăžăăçśă <var>n</var> čĄăŤ <var>i</var> äşşçŽăŽçĺžăŽăłăźăšăŽďźĺ¨ăŽčˇé˘ <var>d<sub>i</sub></var> (1 ≤ <var>d<sub>i</sub></var> ≤ 10000) ă¨čľ°ăéă <var>v<sub>i</sub></var> (1 ≤ <var>v<sub>i</sub></var> ≤ 10000) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 2000 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăĺçĺžăŽĺ¨ĺć°ăĺşĺăăžăăĺçĺžăŽĺ¨ĺć°ăŻĺ
ĽĺăŽé çŞăŤĺžăŁăŚăăăăďźčĄăŤĺşĺăăŚăă ăăă
</p>
<H2>Sample Input</H2>
<pre>
2
4 3
5 4
5
789 289
166 46
9 4
617 252
972 303
2
8 5
32 20
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
15
16
1598397732
1209243492
1939462992
1782294192
1360317793
1
1
</pre>
| [
[
"2\n4 3\n5 4\n5\n789 289\n166 46\n9 4\n617 252\n972 303\n2\n8 5\n32 20\n0\n",
"2\n4 3\n5 4\n5\n789 289\n166 46\n9 4\n617 252\n972 303\n2\n8 5\n32 20\n0\n"
]
] |
p00212 | Highway Express Bus |
<H1> éŤéăăš</H1>
<p>
A ĺăŻéŤć ĄăŽäźăżăĺŠç¨ăăŚăéŤéăăš(䝼ä¸ăăăăšă )ă§ä¸äşşć
ăăăč¨çťăçŤăŚăŚăăžăăăžăăA ĺăŻä¸çŞčĄăŁăŚăżăăçşăé¸ăă§ăăăçŽçĺ°ăŤăăžăăă揥ăŤĺşçşĺ°ăăçŽçĺ°ăžă§ăăšăäšăçśăă§ăăăŤăźăăćąşăăŞăăă°ăŞăăžăăăäšăçśăăăăă¨ăăŻăăăšăéăăŚăăĺĽăŽăăšăŤäšăćăăăŽă§ăăăăăăŽăăšăŽäščťĺ¸ăĺż
čŚăŤăŞăăžăă
</p>
<p>
A ĺăŻčŚŞćăŽăăăăăăăăšăŽĺ˛ĺźĺ¸ăä˝ćăăăăăžăăă ăăŽĺ¸ă 1 ć使ăă¨äščťĺ¸ 1 ćăĺéĄă§čłźĺ
Ľă§ăăžăăäžăă°ăĺł 1 ăŽĺşçşĺ°5ăăçŽçĺ°1ă¸čĄăĺ ´ĺăŤăŻă5â4â6â2â1ă¨5â3â1ăŽäşă¤ăŽçľčˇŻăčăăăăžăăĺ˛ĺźĺ¸ă 2 ćăăă¨ăăă¨ă交é貝ăćăĺŽăăăăŤăŻ5â4â6â2â1ăŽçľčˇŻăăăŠăŁăĺ ´ĺă4â6ă¨6â2ăŽčˇŻçˇăŤĺ˛ĺźăĺŠç¨ăăĺč¨ćé㯠4600ĺă¨ăŞăăžăăä¸ćšă5â3â1ăŽçľčˇŻăăăŠăŁăĺ ´ĺă5â3ă¨3â1ăŽčˇŻçˇăŤĺ˛ĺźăĺŠç¨ăăĺč¨ćé㯠3750 ĺă¨ăŞăăžăă
</p>
<p>
A ĺăŻčŚłĺ
ăŤăéăĺăăăăŽă§ă交é貝ăŻă§ăăă ăĺ°ăŞăăăăă¨čăăŚăăžăăăă㧠A ĺăŻăĺşçşĺ°ăăçŽçĺ°ăžă§ăŽćăĺŽă交é貝ăćąăăăăă°ăŠă ăä˝ćăăăă¨ăŤăăžăăă
</p>
<br>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_highwayBus">
<p>
ĺł1
</p>
</center>
<p>
ĺ˛ĺźĺ¸ăŽćć°ăăăšăă¤ăŞăçşăŽć°ăăăšăŽčˇŻçˇć°ăĺăăšăŽčˇŻçˇć
ĺ ąăĺ
Ľĺă¨ăăĺşçşĺ°ăăçŽçĺ°ăžă§ăŽćăĺŽă交é貝ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăĺăăšăŻĺćšĺăŤĺä¸ćéă§éčĄăăŚăăžăăăžăăçşăŽć°ă <var>n</var> ă¨ăăă¨ăçşăŤăŻăăăăç°ăŞă 1 ăă <var>n</var> ăžă§ăŽçŞĺˇăćŻăăăŚăăžăăĺşçşĺ°ăăçŽçĺ°ăžă§ăŽçľčˇŻăŻĺż
ăĺĺ¨ăăăăŽă¨ăăžăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăă ĺ
ĽĺăŽçľăăăŻăźăăďźă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>c</var> <var>n</var> <var>m</var> <var>s</var> <var>d</var>
<var>a<sub>1</sub></var> <var>b<sub>1</sub></var> <var>f<sub>1</sub></var>
<var>a<sub>2</sub></var> <var>b<sub>2</sub></var> <var>f<sub>2</sub></var>
:
<var>a<sub>m</sub></var> <var>b<sub>m</sub></var> <var>f<sub>m</sub></var>
</pre>
<p>
1 čĄçŽăŤĺ˛ĺźĺ¸ăŽćć° <var>c</var> (1 ≤ <var>c</var> ≤ 10)ăăăšăă¤ăŞăçşăŽć° <var>n</var> (2 ≤ <var>n</var> ≤ 100)ăăăšăŽčˇŻçˇć° <var>m</var> (1 ≤ <var>m</var> ≤ 500)ăĺşçşĺ°ăŽçşçŞĺˇ <var>s</var> ă¨çŽçĺ°ăŽçşçŞĺˇ <var>d</var> (<var>s ≠ d</var>) ăä¸ăăăăžăă
</p>
<p>
çśă <var>m</var> čĄăŤçŹŹ <var>i</var> ăŽăăšăŽčˇŻçˇć
ĺ ą <var>a<sub>i</sub>, b<sub>i</sub>, f<sub>i</sub></var> (1 ≤ <var>a<sub>i</sub>, b<sub>i</sub></var> ≤ <var>n</var>, 1000 ≤ <var>f<sub>i</sub></var> ≤ 10000) ăä¸ăăăăžăă<var>a<sub>i</sub>, b<sub>i</sub></var> ăŻăăšăŽčˇŻçˇăŽĺ§çšă¨çľçšăŽçşçŞĺˇă<var>f<sub>i</sub></var> ăŻăăŽčˇŻçˇăŽćéă襨ă100 ĺťăżăŽć´ć°ă§ăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăćăĺŽă交é貝ăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
1 3 3 1 3
1 3 2000
1 2 1000
2 3 1000
2 3 3 1 3
1 3 2300
1 2 1000
2 3 1200
2 6 6 5 1
1 2 1500
1 3 4500
2 6 2000
5 4 1000
6 4 2200
3 5 3000
0 0 0 0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1000
1100
3750
</pre>
| [
[
"1 3 3 1 3\n1 3 2000\n1 2 1000\n2 3 1000\n2 3 3 1 3\n1 3 2300\n1 2 1000\n2 3 1200\n2 6 6 5 1\n1 2 1500\n1 3 4500\n2 6 2000\n5 4 1000\n6 4 2200\n3 5 3000\n0 0 0 0 0\n",
"1 3 3 1 3\n1 3 2000\n1 2 1000\n2 3 1000\n2 3 3 1 3\n1 3 2300\n1 2 1000\n2 3 1200\n2 6 6 5 1\n1 2 1500\n1 3 4500\n2 6 2000\n5 4 1000\n6 4 2200\n3 5 3000\n0 0 0 0 0\n"
]
] |
p00213 | Subdivide The Land |
<H1>>ĺĺ°ĺĺ˛</H1>
<p>
ăăŚă¸ăłă°ăĄăźăŤăźăŽĺąąç°ăăŚăšăŻăć°ăăŞçŽçĺĺă¨ăăŚăĺŚć Ąăç
é˘ăŞăŠç°ĺ˘ăĺ
ĺŽăăŚăăçˇăăźă ăżăŚăłăŽĺč˛ĺ°ă売ăĺşăăžăăăăăŽĺč˛ĺ°ăŻč¤ć°ăŽĺşçťăŤĺĺ˛ăăăŚăăă弽ăăŞă ăčłźĺ
Ľă§ăăžăăăčłźĺ
Ľăăĺşçťăĺăăăĺĺ°ăŽĺ˝˘çśăŻéˇćšĺ˝˘(ćŁćšĺ˝˘ăĺŤă)ă§ăŞăăă°ăŞăăžăăă
</p>
<p>
ĺąąç°ăăŚăšăŻăĺ
¨ĺşçťăĺŽĺŁ˛ăăĺč˛ĺ°ă玥çăăăăčłźĺ
Ľč
ăă¨ăŤĺ˘ççˇăĺźăăăăŽĺşçťăŽ 1ă¤ăŤčłźĺ
Ľč
çŞĺˇăć¸ăăçćżăč¨ç˝ŽăăŚăăăžăăăĺ˘ççˇăŻĺ°é˘ăŤć¨ăŽćă§çˇăĺźăăă ăăŽăăŽă§ăăŁăăăăć°ćĽĺžăŽčąŞé¨ăŤăăćśăăŚăăžăçćżă ăăćŽăăžăăăĺł 1 ăŻçćżăŽăăŁăĺşçťăŤăăăŽĺşçťă財ăŁăčłźĺ
Ľč
çŞĺˇăč¨ăăăăŽă§ăăăăă§ăŻĺč˛ĺ°ăăŠăŽăăăŤč˛ˇăăăăĺăăăžăăăćăăŻäşĺćăŽĺźăĺşăăŤăăŁăčłźĺ
Ľč
çŞĺˇ <var>b</var> ă¨čłźĺ
Ľĺşçťć° <var>k</var> ăŽăĄă˘(ĺł 2)ăčŚă¤ăăŁăăă¨ă§ăă
</p>
<br>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_partitionTable"><br/>
<p>ĺłďźďźĺˇŚďźďźçćżăŽé
罎ăĺł2ďźĺłďźďźăĄă˘</p>
</center>
<p>
ăăă°ăŠăăźă§ăăăăŞăăŻăăăă°ăŠă ăć¸ăăŚĺąąç°ăăŚăšăĺŠăăăă¨ăŤăŞăăžăăăĺč˛ĺ°ăŽĺ¤§ăă <var>X × Y</var> ăčłźĺ
Ľč
ć° <var>n</var> ăăĄă˘ăŽć
ĺ ą <var>b</var>ă <var>k</var> ăĺăłçćżăŽä˝ç˝Žć
ĺ ą <var>s</var> ăĺ
Ľĺă¨ăăĺł 3 ăŤç¤şăăăăŤĺĺşçťăŽčłźĺ
Ľč
ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<br>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_partition2R"><br/>
<p>
ĺł3ďźĺĺşçťăŽčłźĺ
Ľč
</p>
</center>
<p>
ä¸ăăăăć
ĺ ąăŤă¤ăăŚă䝼ä¸ăŽĺ ´ĺ㯠NA ă¨ĺşĺăăžăă
</p>
<ul>
<li> ĺşçťăĺşĺĽăăćšćłăĺĺ¨ăăŞăĺ ´ĺ</li>
<li> ĺşçťăĺşĺĽăăćšćłăč¤ć°ĺĺ¨ăăĺ ´ĺ</li>
</ul>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăďźă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>X</var> <var>Y</var> <var>n</var>
<var>b<sub>1</sub></var> <var>k<sub>1</sub></var>
<var>b<sub>2</sub></var> <var>k<sub>2</sub></var>
:
<var>b<sub>n</sub></var> <var>k<sub>n</sub></var>
<var>s<sub>11</sub></var> <var>s<sub>21</sub></var> ... <var>s<sub>X1</sub></var>
<var>s<sub>12</sub></var> <var>s<sub>22</sub></var> ... <var>s<sub>X2</sub></var>
:
<var>s<sub>1Y</sub></var> <var>s<sub>2Y</sub></var> ... <var>s<sub>XY</sub></var>
</pre>
<p>
1 čĄçŽăŤ<var>X, Y, n</var> (1 ≤ <var>X, Y</var> ≤ 10, 1 ≤ <var>n</var> ≤ 15) ăä¸ăăăăžăăçśă <var>n</var> čĄăŤăĄă˘ăŽ <var>i</var> čĄçŽăŤć¸ăăăć
ĺ ą <var>b<sub>i</sub></var> (1 ≤ <var>b<sub>i</sub></var> ≤ <var>n</var>), <var>k<sub>i</sub></var> (1 ≤ <var>k<sub>i</sub></var> ≤ 100) ăä¸ăăăăžăă
</p>
<p>
çśă <var>Y</var> čĄăŤĺşçťć
ĺ ąăŽ <var>i</var> čĄçŽăŽć
ĺ ą <var>s<sub>ij</sub></var> ăä¸ăăăăžăă<var>s<sub>ij</sub></var> ăŻ<var>i</var> čĄçŽăŽĺˇŚăă <var>j</var> çŞçŽăŽĺşçťăŽçćżć
ĺ ąă襨ăăžăăçćżăŽć
ĺ ą <var>s<sub>ij</sub></var> ă¨ăăŚăăăŽĺşçťăŤçćżăçĄăĺ ´ĺ㯠0 ăçćżăăăĺ ´ĺăŻăăŽĺşçťăŽčłźĺ
Ľč
çŞĺˇăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăčłźĺ
Ľč
ć
ĺ ąăžăăŻNA ăĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
5 4 6
1 6
2 4
3 3
4 4
5 1
6 2
0 0 1 0 0
0 0 0 2 0
0 0 0 3 0
0 4 5 0 6
3 3 1
1 9
0 0 1
0 0 0
0 0 0
4 4 4
1 6
2 2
3 4
4 4
0 1 0 0
0 0 0 2
0 0 3 0
0 4 0 0
0 0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1 1 2 2
1 1 1 2 2
4 4 3 3 3
4 4 5 6 6
1 1 1
1 1 1
1 1 1
NA
</pre>
| [
[
"5 4 6\n1 6\n2 4\n3 3\n4 4\n5 1\n6 2\n0 0 1 0 0\n0 0 0 2 0\n0 0 0 3 0\n0 4 5 0 6\n3 3 1\n1 9\n0 0 1\n0 0 0\n0 0 0\n4 4 4\n1 6\n2 2\n3 4\n4 4\n0 1 0 0\n0 0 0 2\n0 0 3 0\n0 4 0 0\n0 0 0\n",
"5 4 6\n1 6\n2 4\n3 3\n4 4\n5 1\n6 2\n0 0 1 0 0\n0 0 0 2 0\n0 0 0 3 0\n0 4 5 0 6\n3 3 1\n1 9\n0 0 1\n0 0 0\n0 0 0\n4 4 4\n1 6\n2 2\n3 4\n4 4\n0 1 0 0\n0 0 0 2\n0 0 3 0\n0 4 0 0\n0 0 0\n"
]
] |
p00214 | Autumnal Illumination |
<H1>ç§ăŽă¤ăŤăăăźăˇă§ăł</H1>
<p>
ĺč§ĺ˝˘ă大弽ăăŞäşşăĺ¤ăä˝ăĺč§çşă§ăŻăĺč§ĺ˝˘ăŽéťĺ
ćżăçľăżĺăăăă¤ăŤăăăźăˇă§ăłă§çşä¸ă彊ăăçĽăăéĺŹăăăžăă<!--ăăŽă¤ăŤăăăźăˇă§ăłăŤăŻĺč§ĺ¤§ĺŚă§éçşăăăçšćŽăŞéťĺ
ćżă使ăăžăă-->ăăŽéťĺ
ćżăŻéťć°ăćľăă¨çşĺ
ăăçşĺ
ăăŚăăćżăŤćĽăăŚăăćżăçşĺ
ăăžăăăăăăŁăŚăéťĺ
ćżăä˝ć使ăŁăŚăăăăšăŚăă˛ă¨ăăăžăăŤćĽăăŚăăă°éťćşăă˛ă¨ă¤ă§ć¸ăă¨ăăĺŞăăăŽă§ăă
</p>
<p>
ăçĽăĺŽčĄĺ§ĺĄäźă§ăŻăĺč§ĺ˝˘ăçľăżĺăăăăăśă¤ăłăçşć°ăăĺéăĺ¤ć°ăŽă¤ăŤăăăźăˇă§ăłăä˝ćăăžăăĺă¤ăŤăăăźăˇă§ăłăŻăăăśă¤ăłăć§ćăăĺč§ĺ˝˘ăŽé
罎ăŤăăŁăŚĺż
čŚă¨ăŞăéťćşăŽĺć°ăĺ¤ăăăăăĺż
čŚăŞéťćşăŽĺć°ăććĄăăä˝ćĽăŤ<!--ćŻĺš´-->大ăăŞćéăăăăăžăă<!--äťĺš´ăŻäžĺš´ăăĺ¤ăăŽăăśă¤ăłăéăžăŁăăăăăçĽăăžă§ăŤćşĺăéăŤĺăăŞăćăăĺşăŚăăžăăă-->ăăă§ă<!--ăçĽă弽ăăŞ-->ăăŞăăŻĺč§ĺ˝˘ăŽé
罎ă調ăšăĺż
čŚăŞéťćşăŽĺć°ăč¨çŽăăăăă°ăŠă ăä˝ćăăŚĺŽčĄĺ§ĺĄäźăćĺŠăăăăă¨ăŤăăžăăă
</p>
<br>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_illumination">
</center>
<br>
<p>
ă¤ăŤăăăźăˇă§ăłăŽĺć°ăĺă¤ăŤăăăźăˇă§ăłăć§ćăăĺč§ĺ˝˘ăŽć
ĺ ąăĺ
Ľĺă¨ăăă¤ăŤăăăźăˇă§ăłăă¨ăŤĺż
čŚăŞéťćşăŽĺć°ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăéăŞăŁăŚăăăćĽăăŚăăăăăĺč§ĺ˝˘ă 1 ă¤ăŽăžă¨ăžăă¨čăă1 ă¤ăŽăžă¨ăžăăŤĺŻžăăŚéťćşăŽĺć°ăŻ 1 ă¤ă¨ć°ăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>N</var>
<var>M<sub>1</sub></var>
<var>xa<sub>1</sub></var> <var>ya<sub>1</sub></var> <var>xb<sub>1</sub></var> <var>yb<sub>1</sub></var> <var>xc<sub>1</sub></var> <var>yc<sub>1</sub></var> <var>xd<sub>1</sub></var> <var>yd<sub>1</sub></var>
<var>xa<sub>2</sub></var> <var>ya<sub>2</sub></var> <var>xb<sub>2</sub></var> <var>yb<sub>2</sub></var> <var>xc<sub>2</sub></var> <var>yc<sub>2</sub></var> <var>xd<sub>2</sub></var> <var>yd<sub>2</sub></var>
:
<var>xa<sub>M<sub>1</sub></sub></var> <var>ya<sub>M<sub>1</sub></sub></var> <var>xb<sub>M<sub>1</sub></sub></var> <var>yb<sub>M<sub>1</sub></sub></var> <var>xc<sub>M<sub>1</sub></sub></var> <var>yc<sub>M<sub>1</sub></sub></var> <var>xd<sub>M<sub>1</sub></sub></var> <var>yd<sub>M<sub>1</sub></sub></var>
<var>M<sub>2</sub></var>
:
:
<var>M<sub>N</sub></var>
:
:
</pre>
<p>
1 čĄçŽăŤă¤ăŤăăăźăˇă§ăłăŽĺć° <var>N</var> (1 ≤ <var>N</var> ≤ 100) ăä¸ăăăăžăăçśăăŚă<var>N</var> ĺăŽă¤ăŤăăăźăˇă§ăłăŽć
ĺ ąăä¸ăăăăžăă珏 <var>i</var> ăŽă¤ăŤăăăźăˇă§ăłăŽć
ĺ ąă¨ăăŚăă¤ăŤăăăźăˇă§ăłăć§ćăăĺč§ĺ˝˘ăŽĺć° <var>M<sub>i</sub></var> (1 ≤ <var>M<sub>i</sub></var> ≤ 100) ăďźčĄăŤä¸ăăăăžăăçśă <var>M<sub>i</sub></var> čĄăŤ <var>j</var> ĺçŽăŽĺč§ĺ˝˘ăŽé çš <var>xa<sub>j</sub></var>, <var>ya<sub>j</sub></var>, <var>xb<sub>j</sub></var>, <var>yb<sub>j</sub></var>, <var>xc<sub>j</sub></var>, <var>yc<sub>j</sub></var>, <var>xd<sub>j</sub></var>, <var>yd<sub>j</sub></var> (-1000 äťĽä¸ 1000 䝼ä¸ăŽć´ć°) ăä¸ăăăăžăă
</p>
<p>
ĺ
Ľĺăăăĺč§ĺ˝˘ăŽé çšĺş§ć¨ăŻăćč¨ĺăăŽé ăŤĺžăŁăŚĺ
Ľĺăăăžăăăă ăăĺ
ĽĺăăźăżăŽĺč§ĺ˝˘ăŻăăšăŚĺ¸ăŞĺč§ĺ˝˘ă¨ăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 10 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăă¤ăŤăăăźăˇă§ăłăă¨ăŤĺż
čŚăŞéťćşăŽĺć°ăĺşĺăăžăăĺşĺăăéťćşăŽĺć°ăŻĺă¤ăŤăăăźăˇă§ăłăĺ
Ľĺăăăé çŞăŤĺžăŁăŚăă ăăă
</p>
<H2>Sample Input</H2>
<pre>
3
1
0 0 0 1 1 1 1 0
2
0 0 0 1 1 1 1 0
100 100 100 200 200 200 200 100
2
0 0 0 100 100 100 100 0
10 10 10 20 20 20 20 10
2
1
30 40 40 50 40 20 20 10
1
30 40 40 50 40 20 20 10
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1
2
1
1
1
</pre>
| [
[
"3\n1\n0 0 0 1 1 1 1 0\n2\n0 0 0 1 1 1 1 0\n100 100 100 200 200 200 200 100\n2\n0 0 0 100 100 100 100 0\n10 10 10 20 20 20 20 10\n2\n1\n30 40 40 50 40 20 20 10\n1\n30 40 40 50 40 20 20 10\n0\n",
"3\n1\n0 0 0 1 1 1 1 0\n2\n0 0 0 1 1 1 1 0\n100 100 100 200 200 200 200 100\n2\n0 0 0 100 100 100 100 0\n10 10 10 20 20 20 20 10\n2\n1\n30 40 40 50 40 20 20 10\n1\n30 40 40 50 40 20 20 10\n0\n"
]
] |
p00215 | Pachimon Creature |
<H1>ăăă˘ăłăŻăŞăźăăŁăź</H1>
<p>
ćĺ˝ă§<!--ççşç-->大人ć°ăŽă˛ăźă ăăăă˘ăłăŻăŞăźăăŁăźăćĽćŹă§ăŞăĄă¤ăŻăăăŚçşĺŁ˛ăăăžăăă ă˛ăźă ă大弽ăăŞăăŞăăŻă ăăŽă˛ăźă ă<!--äťăžă§č˛Żăăăĺ°éŁăă§čłźĺ
Ľăăä˝ĺşŚăăăŹă¤ăăžăăăăăăŚă-->ä˝ĺşŚăăăŹă¤ăăăăĄăŤăŠăăăăćéă§ăŻăŞă˘ă§ăăăŽăčăăăăăŤăŞăăžăăăăăăăăăăčăăŚăćéăŽćťçĽćšćłăăăăăŞăăŁăăăŞăăŻăăŠăă ăćŠăă˛ăźă ăăŻăŞă˘ă§ăăăăćąăăăăă°ăŠă ăä˝ćăăăă¨ăŤăăžăăă
</p>
<p>
ă˛ăźă ăŽčŠłç´°ăŻäťĽä¸ăŽéăă§ăă
</p>
<!--
<p>
ăăă˘ăłăŻăŞăźăăŁăź(䝼ä¸ăăăăŻăŞ)ă¨ăăççŠăĺ¤ăĺĺ¨ăăä¸çăă˛ăźă ăŽčĺ°ă§ăăĺăăăŻăŞăŻăçŤĺąć§ăć°ˇĺąć§ăć¨ĺąć§ăĺĺąć§ăć°´ĺąć§ăŽ 5 税éĄăŽĺąć§ăŽăăăăä¸ĺąć§ăćăĄăžăăă˛ăźă ăŽä¸ťäşşĺ
Źă§ăă E ĺăŻăčżćăŤä˝ăă§ăă茪ĺăŞăăăăăă弽ăăŞĺąć§ăŽăăăŻăŞä¸ĺšăĺéşăŽăăźăăăźă¨ăăŚĺăĺăăžăăăăŽăăăŻăŞă¨ĺ
ąăŤă´ăźăŤăçŽćăăă´ăźăŤăŤăăăŠă¤ăăŤăĺăăŚăăăŻăŞăăšăżăźăŤăŞăăă¨ă丝人ĺ
ŹăŽĺ¤˘ă§ăăăă˛ăźă ăŻăŞă˘ă§ăăăăžăă
</p>
-->
<p>
ăăă˘ăłăŻăŞăźăăŁăź(䝼ä¸ăăăăŻăŞ)ă¨ăăççŠăĺ¤ăĺĺ¨ăăä¸çăă˛ăźă ăŽčĺ°ă§ăăĺăăăŻăŞăŻăçŤĺąć§ăć°ˇĺąć§ăć¨ĺąć§ăĺĺąć§ăć°´ĺąć§ăŽ 5 税éĄăŽĺąć§ăŽăăăăďźă¤ăŽĺąć§ăćăĄăžăăă˛ăźă ăŽä¸ťäşşĺ
ŹăŻăă˛ăźă éĺ§ćăŤĺĽ˝ăăŞĺąć§ăŽăăăŻăŞä¸ĺšăĺéşăŽăăźăăăźă¨ăăŚé¸ăłăžăăăăŽăăăŻăŞă¨ĺ
ąăŤă´ăźăŤăçŽćăăă´ăźăŤăŤăăăŠă¤ăăŤăĺăăŚăăăŻăŞăăšăżăźăŤăŞăăă¨ăă˛ăźă ăŽçŽçă§ăă
</p>
<p>
ăăăăăŠă¤ăăŤăĺăăăăŤăŻĺ
¨ĺąć§ăŽăăăŻăŞăăăŞăă¨ĺăŚăŞăăŽă§ăéä¸ă§ĺ
¨ĺąć§ăŽăăăŻăŞăćăžăăŞăăă°ăŞăăžăăăăăăŻăŞăćăžăăăŤăŻĺąć§ăăŤăŽă¨ăŞăăžăăçŤĺąć§ăŽăăăŻăŞăŻć°ˇĺąć§ăŽăăăŻăŞăćăžăăăă¨ăă§ăăĺć§ăŤăć°ˇĺąć§ăŻć¨ĺąć§ăć¨ĺąć§ăŻĺĺąć§ăĺĺąć§ăŻć°´ĺąć§ăć°´ĺąć§ăŻçŤĺąć§ăćăžăăăă¨ăă§ăăžăăĺąć§ăŽé˘éŁăŻäťĽä¸ăŽĺłăŽăăăŤăŞăăžăă
</p>
<br>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_pachimon1" width="30%" >
</center>
<br>
<p>
䝼ä¸ăŽĺłăŻă˛ăźă ăčĄăăăăăăăŽä¸äžă襨ăăŚăăžăă
</p>
<br>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_pachimon2" width="60%" >
</center>
<br>
<p>
丝人ĺ
ŹăŻăăăŻăŞăä¸ĺšăăŁăŚăšăżăźăĺ°çšă§ăăăSăăăĺşçşăăä¸ăăšăă¤ç§ťĺăăŞăăă´ăźăŤĺ°çšă§ăăăGăăçŽćăăžăăăăŽéä¸ă§ăćĺăŤćăŁăŚăăăăăŻăŞäťĽĺ¤ăŽ 4 ă¤ăŽĺąć§ăŽăăăŻăŞăćăžăăă´ăźăŤĺ°çšă§ăăăăšçŽăŤç§ťĺăăă¨ă˛ăźă çľäşă¨ăŞăăžăă
</p>
<p>
丝人ĺ
ŹăŻăäťăăăăšçŽăăăčžşăĺ
ąćăăéŁăŽăăšçŽăŤç§ťĺăăăă¨ăă§ăăăăăä¸ĺăŽç§ťĺă¨ć°ăăžăă丝人ĺ
ŹăăăăŻăŞăŽăăăăšăŤç§ťĺăăĺ ´ĺăăăŽăăăŻăŞăćăžăăăăĺąć§ăŽăăăŻăŞăćăŁăŚăăă°ăăŽăăăŻăŞăćăžăăăă¨ăŤăŞăăžăăăăŽăăšăŤăăăăăŻăŞăćăžăăăăăăŽĺŻĺŚăŤăăăăăăăăšăŚăŽăăšăŤä˝ĺşŚă§ă秝ĺăăăă¨ăă§ăăžăă
</p>
<p>
ăăăăŽĺ¤§ăă(横ćšĺăŽĺć°ă縌ćšĺăŽčĄć°)ă¨ăăăăŽĺćçść
ăĺ
Ľĺă¨ăăĺăăŤé¸ăă ăăăŻăŞăŽĺąć§ă¨ăăă䝼ĺ¤ăŽ 4 ă¤ăŽĺąć§ăŽăăăŻăŞăćăžăăăŽăŤăăăăăšăżăźăĺ°çšăăă´ăźăŤĺ°çšăŤčłăćĺ°ç§ťĺć°ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>W</var> <var>H</var>
<var>c<sub>11</sub></var><var>c<sub>12</sub></var>...<var>c<sub>1W</sub></var>
<var>c<sub>21</sub></var><var>c<sub>22</sub></var>...<var>c<sub>2W</sub></var>
:
<var>c<sub>H1</sub></var><var>c<sub>H2</sub></var>...<var>c<sub>HW</sub></var>
</pre>
<p>
1 čĄçŽăŤăăăăŽć¨ŞćšĺăŽĺć° <var>W</var> ă¨ç¸ŚćšĺăŽčĄć° <var>H</var> (2 ≤ <var>W, H</var> ≤ 1000) ăä¸ăăăăžăăçśă <var>H</var> čĄăŤăăă㎠<var>i</var> čĄçŽăŽć
ĺ ąăä¸ăăăăžăăĺ
ĽĺăăăăăăăŤăŻĺăăšăŽçść
ăä¸ăăăăžăă ăSăăŻä¸ťäşşĺ
ŹăŽăšăżăźăĺ°çšăă ăGăăŻă´ăźăŤĺ°çšăăă1ăă2ăă3ăă4ăă5ăăŻăăăŤăăăăăŻăŞăŽĺąć§ă( 1:çŤĺąć§ă 2:ć°ˇĺąć§ă 3:ć¨ĺąć§ă 4:ĺĺąć§ă 5:ć°´ĺąć§ ăăăăă襨ăăžă)ă ă.(ăăŞăŞă) ăăŻä˝ăăŞăăăšăăăăă襨ăăžăă
ĺĺąć§ăŽăăăŻăŞăŽć°ăŻăăăă 0 äťĽä¸ 1000 䝼ä¸ă¨ăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ140 ăčś
ăăžăăăăžăăăăźăżăťăă㎠80 % ăŤă¤ăăŚă<var>W, H</var> ăŻ100 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăćĺăŤé¸ăă ăăăŻăŞăŽĺąć§ă¨ćĺ°ç§ťĺć°ăďźčĄăŤĺşĺăăžăăăŞăăăŠăŽăăăŤĺăăŽăăăŻăŞăé¸ăă§ăăăŠăŽăăăŞçľčˇŻă§ç§ťĺăăŚăăăă 4 ă¤ăŽĺąć§ăŽăăăŻăŞăćăžăăăă¨ăă§ăăŞăĺ ´ĺ㯠NA ă¨ĺşĺăăŚăă ăăă ăžăăćĺ°ç§ťĺć°ăĺăăŤăŞăăăăŞćĺăŽăăăŻăŞăŽé¸ăłćšăč¤ć°ăăĺ ´ĺăŻăĺąć§ăŽć°ĺăĺ°ăăăăŽăĺşĺăăŚăă ăăă
</p>
<H2>Sample Input</H2>
<pre>
6 6
S.1..4
3..5..
..4.1.
4....5
.2.32.
5.1..G
3 2
...
S.G
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 10
NA
</pre>
| [
[
"6 6\nS.1..4\n3..5..\n..4.1.\n4....5\n.2.32.\n5.1..G\n3 2\n...\nS.G\n0 0\n",
"6 6\nS.1..4\n3..5..\n..4.1.\n4....5\n.2.32.\n5.1..G\n3 2\n...\nS.G\n0 0\n"
]
] |
p00216 | Cutting Down Water Bills |
<H1>ć°´éćé</H1>
<p>
<!--ăăăĽĺŚĺé˝ĺ¸ăŤä˝ăă§ăă-->ćžĺšłăăăŻăćŽćŽľăăă¨ăłăŤć°ăäťăăŚçć´ťăăăŚăăžăăĺ
ćăŽć°´éćéă 4280 ĺă¨ăŞăăăă¤ăçŽć¨ă¨ăăŚăă 4000 ĺăčś
ăăŚăăžăŁăăŽă§ăäťćăŻçŻć°´ăŤĺŞăăŚăăžăăăĺ
ćă¨ćŻăšăŚć°´éćéăŻăŠăŽăăăçŻç´ă§ăăăŽă§ăăăăă
</p>
<p>
äťćăŽä˝żç¨ć°´é <var>w</var> [m<sup>3</sup>] ăĺ
Ľĺă¨ăăĺ
ćăŽć°´éćéă§ăă 4280 ĺă¨ćŻčźăăŚăăŠăŽăăăć°´éćéăçŻç´ă§ăăăăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<p>
ăŞăăć°´éćéăŻćŹĄăŽăăăŤč¨çŽăăăžăă
</p>
<p>
(ć°´éćé) = (ĺşćŹćé) + (ć°´éăŤăăćé)
</p>
<p>
ć°´éăŤăăćéăŻä¸čĄ¨ăŽăăăŤä˝żç¨éăŤĺżăăŚč¨çŽăăăžăă
</p>
<center>
<table>
<tr>
<th width="180"> 掾é</th><th width="240"> ć°´é </th><th width="240"> ćé</th>
</tr>
<tr>
<td>珏 1 掾éćé </td><td> 10 [m<sup>3</sup>] ăžă§ </td><td> ĺşćŹćé 1150 ĺ </td>
</tr>
<tr>
<td>珏 2 掾éćé </td><td> 10 [m<sup>3</sup>] čś
é 20 [m<sup>3</sup>] ăžă§</td><td> 1 [m<sup>3</sup>] ăăă 125 ĺ </td>
</tr>
<tr>
<td>珏 3 掾éćé </td><td> 20 [m<sup>3</sup>] čś
é 30 [m<sup>3</sup>] ăžă§ </td><td>1 [m<sup>3</sup>] ăăă 140 ĺ </td>
</tr>
<tr>
<td>珏 4 掾éćé </td><td> 30 [m<sup>3</sup>] čś
éĺ </td><td> 1 [m<sup>3</sup>] ăăă 160 ĺ </td>
</tr>
</table>
</center>
<br/>
<p>
äžăă°ă使ç¨ć°´é 40 [m<sup>3</sup>] ăŽĺ ´ĺăŻă
ĺşćŹćé 1150 ĺ(珏 1 掾é) + 10 [m<sup>3</sup>] × 125 ĺ(珏 2 掾é) + 10 [m<sup>3</sup>] × 140 ĺ(珏 3 掾é) + 10 [m<sup>3</sup>] × 160 ĺ(珏 4 掾é) = 5400 ĺ
ă¨ăŞăăžăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăă㯠-1 ă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
</p>
<p>
ĺăăźăżăťăăă¨ăăŚă äťćăŽä˝żç¨ć°´éă襨ăć´ć° <var>w</var> (0 ≤ <var>w</var> ≤ 100) ăďźčĄăŤä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 200 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăĺ
ćăŽć°´éćéă¨ăŽĺˇŽă1čĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
29
40
0
-1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
620
-1120
3130
</pre>
| [
[
"29\n40\n0\n-1\n",
"29\n40\n0\n-1\n"
]
] |
p00217 | Walking in the Hospital |
<H1>ăŚăŠăźăăłă°</H1>
<p>
äźć´ĽăŞăăźăľă¤ăăăšăăżăŤă§ăŻăăŞăăăŞă¨ĺĽĺşˇĺ˘é˛ăŽăăăĺ
Ľé˘ćŁč
ăä¸ćĽäşĺăŽăŚăŠăźăăłă°ăčĄăŁăŚăăžăăĺ
ć°ăŤéé˘ăăăăăŤăăŚăŠăźăăłă°ă§ä˝ĺăĺ垊ăăăă¨é ĺźľăäşşăćĽăŤćĽăŤĺ˘ăăăăă¨ăăăé˘éˇăăä¸ćĽă§ä¸çŞéˇăčˇé˘ăćŠăăäşşăŤăăŹăźăłăăăăăă!ăă¨ăăäźçťăçŤăĄä¸ăăžăăă
</p>
<!--
<p>
äźć´ĽăŞăăźăľă¤ăăăšăăżăŤă§ăŻăăŞăăăŞă¨ĺĽĺşˇĺ˘é˛ăŽăăăĺ
Ľé˘ćŁč
ăä¸ćĽäşĺăŽăŚăŠăźăăłă°ăčĄăŁăŚăăžăăĺ
ć°ăŤéé˘ăăăăăŤăăŚăŠăźăăłă°ă§ä˝ĺăĺ垊ăăăă¨é ĺźľăäşşăćĽăŤćĽăŤĺ˘ăăŚăăăžăăăĺĽĺşˇăŤăŞăăŤă¤ăăć°ćăĄăćăăçŹéĄăčŚăăăăăăŤăŞăŁăăă¨ăăăé˘éˇĺ
çăă ăä¸ćĽă§ä¸çŞéˇăčˇé˘ăćŠăăäşşăŤăăŹăźăłăăăăăă!ăă¨ăăäźçťăçŤăĄä¸ăăžăăă
</p>
-->
<p>
ćŁč
ăŽć° <var>n</var> (1 ≤ <var>n</var> ≤ 10000)ăăăăăăŽćŁč
ăŽçŞĺˇ <var>p<sub>i</sub></var> (1 ≤ <var>p<sub>i</sub></var> ≤ 10000)ăä¸ĺçŽăŤćŠăăčˇé˘ <var>d1<sub>i</sub></var>ăäşĺçŽăŤćŠăăčˇé˘ <var>d2<sub>i</sub></var> (0 ≤ <var>d1<sub>i</sub></var>, <var>d2<sub>i</sub></var> ≤ 5000) ăĺ
Ľĺă¨ăăćŠăăčˇé˘ăŽĺč¨ăćăéˇăćŁč
ăŽçŞĺˇă¨ăăŽčˇé˘ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăä¸ćĽăŤćŠăăčˇé˘ăĺăćŁč
ăŻăăŞăăăŽă¨ăăžăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>p<sub>1</sub></var> <var>d1<sub>1</sub></var> <var>d2<sub>1</sub></var>
<var>p<sub>2</sub></var> <var>d1<sub>2</sub></var> <var>d2<sub>2</sub></var>
:
<var>p<sub>n</sub></var> <var>d1<sub>n</sub></var> <var>d2<sub>n</sub></var>
</pre>
<p>
ĺ
ĽĺăŻăăšăŚć´ć°ă§ä¸ăăăăžăăăăźăżăťăăăŽć°ăŻ50 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăćăéˇăĺč¨čˇé˘ăćŠăăćŁč
ăŽçŞĺˇă¨ăăŽćŠăăčˇé˘ăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
5
263 2345 2504
1 3210 1985
5000 1501 4132
10000 503 3107
51 1758 2690
3
345 5000 2396
7 3910 1590
6789 2525 3616
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
5000 5633
345 7396
</pre>
| [
[
"5\n263 2345 2504\n1 3210 1985\n5000 1501 4132\n10000 503 3107\n51 1758 2690\n3\n345 5000 2396\n7 3910 1590\n6789 2525 3616\n0\n",
"5\n263 2345 2504\n1 3210 1985\n5000 1501 4132\n10000 503 3107\n51 1758 2690\n3\n345 5000 2396\n7 3910 1590\n6789 2525 3616\n0\n"
]
] |
p00218 | Dividing Students |
<H1>ăŻăŠăšĺă</H1>
<p>
äźć´Ľé˛ĺŚĺĄžă§ăŻăçĺžă奞ăŤĺ
ĽăéăŤĺŽĺăăšăăčĄăŁăŚăŻăŠăšĺăăăăžăăăăšăăŻć°ĺŚăčąčŞăĺ˝čŞăŽ 3 ç§çŽčĄăăçĺžă A,B,C ăŻăŠăšăŤăŻăŠăšĺăăăžăăA ăŻăŠăšăŽăŹăăŤăä¸çŞéŤăăé ăŤä˝ăăŞăŁăŚăăăžăă
</p>
<p>
ăŻăŠăšĺăăŽĺ¤ćăŻäťĽä¸ăŽčĄ¨ăŤĺşăĽăăžăă
</p>
<center>
<table border=1>
<tr>
<th width="460"> ćĄäťś </th><th width="80"> ăŻăŠăš</th>
</tr>
<tr>
<td>100 çšăŽç§çŽăăă </td><td> A </td>
</tr>
<tr>
<td>ć°ĺŚă¨čąčŞăŽĺšłĺçšă 90 çšäťĽä¸ </td><td> A </td>
</tr>
<tr>
<td>3 ç§çŽăŽĺšłĺçšă 80 çšäťĽä¸ </td><td> A</td>
</tr>
<tr>
<td>3 ç§çŽăŽĺšłĺçšă 70 çšäťĽä¸ </td><td> B</td>
</tr>
<tr>
<td>3 ç§çŽăŽĺšłĺçšă 50 çšäťĽä¸ă§ć°ĺŚăčąčŞă 80 çšäťĽä¸ </td><td> B</td>
</tr>
<tr>
<td>ä¸ăŽćĄäťśăćşăăăŞă </td><td> C</td>
</tr>
</table>
</center>
<br/>
<p>
č¤ć°ăŽćĄäťśăćşăăĺ ´ĺăŻăăăăŹăăŤăŽéŤăăŻăŠăšăŤĺăăăăžăă
</p>
<p>
çĺžăŽäşşć° <var>n</var> (1 ≤ <var>n</var> ≤ 10000)ăĺçĺžăŽć°ĺŚăŽçšć° <var>pm<sub>i</sub></var> (0 ≤ <var>pm<sub>i</sub></var> ≤ 100)ăčąčŞăŽçšć° <var>pe<sub>i</sub></var> (0 ≤ <var>pe<sub>i</sub></var> ≤ 100)ăĺ˝čŞăŽçšć° <var>pj<sub>i</sub></var> (0 ≤ <var>pj<sub>i</sub></var> ≤ 100) ăĺ
Ľĺă¨ăăĺçĺžăŽăŻăŠăšA,B,C (ĺč§čąĺ) ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>pm<sub>1</sub></var> <var>pe<sub>1</sub></var> <var>pj<sub>1</sub></var>
<var>pm<sub>2</sub></var> <var>pe<sub>2</sub></var> <var>pj<sub>2</sub></var>
:
<var>pm<sub>n</sub></var> <var>pe<sub>n</sub></var> <var>pj<sub>n</sub></var>
</pre>
<p>
ĺ
ĽĺăŻăăšăŚć´ć°ă§ä¸ăăăăžăăăăźăżăťăăăŽć°ăŻ 1000 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăĺçĺžăŽăŻăŠăšăé çŞăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
4
100 70 20
98 86 55
80 34 36
65 79 65
2
99 81 20
66 72 90
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
A
A
B
C
A
B
</pre>
| [
[
"4\n100 70 20\n98 86 55\n80 34 36\n65 79 65\n2\n99 81 20\n66 72 90\n0\n",
"4\n100 70 20\n98 86 55\n80 34 36\n65 79 65\n2\n99 81 20\n66 72 90\n0\n"
]
] |
p00219 | A Popular Ice-cream Shop |
<H1>ăăšăă°ăŠă </H1>
<p>
ăăłă˘ă¤ăšăŻăŞăźă ă¨ăăĺĺăŽă˘ă¤ăšăŻăŞăźă ĺąăăăăăăžăăăăŽăĺşă§ăŻĺ¸¸ăŤ 10 税éĄăŽă˘ă¤ăšăŻăŞăźă ăĺşé ăŤä¸ŚăśăăăŤăăŚăăžăăăĺşăŽĺşéˇăŻĺĺéçşăŽĺčăŤăăăăăŤăă˘ă¤ăšăŻăŞăźă ăŽĺŁ˛ăĺ
ˇĺă襨ăă°ăŠăăćŻćĽä˝ćăăŚăăžăă
</p>
<p>
ăăăŞĺşéˇăŽăăăŤăăăŞăăŻĺă˘ă¤ăšăŻăŞăźă ăŽč˛ŠĺŁ˛ć°ăă°ăŠăă§čĄ¨ç¤şăăăăă°ăŠă ăä˝ćăăăă¨ăŤăŞăăžăăă
</p>
<p>
ä¸ćĽăŤč˛ŠĺŁ˛ăăăă˘ă¤ăšăŻăŞăźă ăŽçˇć°ă¨ĺŁ˛ăăă˘ă¤ăšăŻăŞăźă ăŽçŞĺˇăĺ
Ľĺă¨ăăă˘ă¤ăšăŻăŞăźă ăŽç¨ŽéĄăă¨ăŤč˛ŠĺŁ˛ăăć°ă ă * (ĺč§ă˘ăšăżăŞăšăŻ) ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăă˘ă¤ăšăŻăŞăźă ăŽç¨ŽéĄă 0 ăă 9 ăžă§ăŽć´ć°ă§čĄ¨ăăăžăăăžăă貊売ĺć°ăăźăăŽă˘ă¤ăšăŻăŞăźă ăŻă- (ĺč§ăă¤ăăł) ăă˛ă¨ă¤ĺşĺăăžăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>c<sub>1</sub></var>
<var>c<sub>2</sub></var>
:
<var>c<sub>n</sub></var>
</pre>
<p>
1 čĄçŽăŤä¸ćĽăŤč˛ŠĺŁ˛ăăăă˘ă¤ăšăŻăŞăźă ăŽçˇć° <var>n</var> (1 ≤ <var>n</var> ≤ 10000) ăä¸ăăăăžăăçśă <var>n</var> čĄăŤçŹŹ <var>i</var> ăŽă˘ă¤ăšăŻăŞăźă ăŽç¨ŽéĄ <var>c<sub>i</sub></var> (0 ≤ <var>c<sub>i</sub></var>≤ 9) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 20 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăĺă˘ă¤ăšăŻăŞăźă ăŽç¨ŽéĄăŽçŞĺˇé ăŤč˛ŠĺŁ˛ć°ăĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
15
2
6
7
0
1
9
8
7
3
8
9
4
8
2
2
3
9
1
5
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
*
*
***
*
*
-
*
**
***
**
-
*
-
-
-
*
-
-
-
*
</pre>
| [
[
"15\n2\n6\n7\n0\n1\n9\n8\n7\n3\n8\n9\n4\n8\n2\n2\n3\n9\n1\n5\n0\n",
"15\n2\n6\n7\n0\n1\n9\n8\n7\n3\n8\n9\n4\n8\n2\n2\n3\n9\n1\n5\n0\n"
]
] |
p00220 | Binary Digit A Doctor Loved |
<H1>ĺ壍ăćăăďźé˛ć°</H1>
<p>
ăĺăŽé´ăŽăľă¤ăşăŻăăă¤ăăă <br/>
<br/>
ĺ寞é˘ăŽç§ăŤăăăăŞăĺ壍ăŻĺ°ăăžăăă<br/>
<br/>
ă 23.5 ă§ăă<br/>
ăăťăăĺŽăŤăăăŽăăć°ĺă ă2 ㎠4 äšăŤ 2 ㎠2 äšă¨ 2 ㎠1 äšă¨ 2 ㎠0 äšă¨ 2 ㎠-1 äšă ĺ ăăć°ă ă<br/>
<br/>
çśăăŚĺ壍ăŻĺ°ăăžăăă<br/>
<br/>
ăĺă躍éˇăŻăăă¤ăăă<br/>
ăăŻăă158.1 ă§ăă<br/>
<br/>
ĺ壍ăŻč
çľăżăăăŚçŽăéăăžăăăăă°ăăăŽć˛éťăŽĺžăĺŁăéăăžăăă<br/>
<br/>
ăăăĄ~ă<br/>
<br/>
ăăŽĺžä¸çˇăŤéăăăćéăŽä¸ă§ăĺ壍ăŽčĄĺăă ăă ăç解ă§ăăăăăŤăŞăăžăăă
</p>
<p>
ăžăă ç§ăĺ壍ăŽćąăăŤĺżăăŚĺŽć°ăč¨ăăžăăĺŽć°ăć´ć°é¨ 8 ćĄäťĽĺ
ă§ĺ°ć°é¨ 4 ćĄäťĽĺ
㎠2 é˛ć°ă§čĄ¨ăăăĺ ´ĺăĺ壍㯠2 é˛ć°ă¸ăŽĺ¤ćçľćăćşčśłăăŤčŞăăžăăăăă§ăŞăĺ ´ĺăć˛ăăăŤăăăĄ~ă ă¨éł´ăăžăăăăăŻăç§ăč˛ ăŽĺŽć°ăč¨ăăžă§çš°ăčżăăăăŽă§ăă
</p>
<p>
ăăŚăĺ壍ăŻĺš´é˝˘ă¨ă¨ăăŤă ăă ăăŤéˇăč¨çŽăéŁăăăŞăŁăŚăăžăăăăăă§ăăżăŞăăăĺ壍ăŤäťŁăăŁăŚăĺŽć°ăĺ
Ľĺă 2 é˛ć°ăŤĺ¤ćăťĺşĺăăăăă°ăŠă ăä˝ăŁăŚăăăŚăă ăăăăă ăă2 é˛čĄ¨çžăĺśéćĄć° (ć´ć°é¨ 8 ćĄäťĽĺ
+ ĺ°ć°é¨ 4 ćĄäťĽĺ
) ăŤĺăžăăŞăĺ ´ĺăŻăNA (ĺč§čąĺ) ăĺşĺăăŚăă ăăăĺ
ĽĺăăăĺŽć°ăŻć´ć°é¨ 8 ćĄäťĽĺ
ăĺ°ć°é¨ 4 ćĄäťĽĺ
ăŤĺăžăăăŽă¨ăăĺşĺăă 2 é˛čĄ¨çžăŻć´ć°é¨ 8 ćĄăĺ°ć°é¨ 4 ćĄă§ĺşĺăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻč˛ ăŽĺŽć°ă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăă¨ăăŚďźă¤ăŽĺŽć° <var>n</var> ăďźčĄăŤä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 1200 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤ 2 é˛ć°ă¸ăŽĺ¤ćçľćăĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
23.5
158.1
-1.0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
00010111.1000
NA
</pre>
| [
[
"23.5\n158.1\n-1.0\n",
"23.5\n158.1\n-1.0\n"
]
] |
p00221 | FizzBuzz |
<H1>FizzBuzz</H1>
<p>
ăFizz Buzzăă¨č¨ăăăć°ĺă使ăŁăă˛ăźă ăăăăžăăăăŽă˛ăźă ăŻč¤ć°ăŽăăŹă¤ă¤ăźă§ć°ĺă1 ăăé ăŤă˛ă¨ă¤ăă¤ć°ăä¸ăăŚăăăăŽă§ăĺăăŹă¤ă¤ăźăŻç´ĺăŽăăŹă¤ă¤ăźăçşč¨ăă揥ăŽć°ĺăă˛ă¨ă¤ă ăçşč¨ăăžăăăăŽćă3 ă§ĺ˛ăĺăăĺ ´ĺ㯠ăFizză, 5 ă§ĺ˛ăĺăăĺ ´ĺ㯠ăBuzzăă严č
ă§ĺ˛ăĺăăĺ ´ĺăŻăFizzBuzzăă¨ć°ăŽäťŁăăăŤçşč¨ăăŞăăă°ăŞăăžăăăäžăă°ăćĺ㎠16 ăžă§ăŽçşč¨ăŻäťĽä¸ăŽăăăŤăŞăăžăă
</p>
<p>
1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz, 16, ăťăťăť
</p>
<p>
太éĺăŻĺéă¨ăFizz BuzzăăăăŚéăśăă¨ăŤăăžăăă太éĺăăĄăŻăŤăźăŤă揥ăŽăăăŤćąşăăžăăă <br/>
<br/>
ăééăăäşşăŻčąč˝ăăăăăŽćŹĄăŽäşşăŻééăăć°ăŽćŹĄăŽć°ăăĺ§ăăăă¤ăžăă1, 2, 3 ă¨çşč¨ăăĺ ´ĺă3 ă§ééăăăŽă§ćŹĄăŻ 4 ăăĺ§ăăăă¨ăŤăŞăăă<br/>
<br/>
ăăŽăŤăźăŤăŤĺžăŁăŚă˛ăźă ăčĄăăŽă§ăăăă˛ăźă ăŤć
ŁăăŚăăŞăăăăééăăăă¨ăŤć°äťăăŞăăă¨ăăăăĺ
ŹĺšłăŞĺ¤ćăă§ăăžăăăăăă§ăăŞăăŻĺ¤ŞéĺăăĄăăăŽă˛ăźă ă漽ăăăăăăŤăćąşăăăăçşč¨ĺć°ăçľăăŁăćçšă§ćŽăŁăŚăăäşşăĺşĺăăăăă°ăŠă ăä˝ćăăăă¨ăŤăăžăăă
</p>
<p>
ăăŹă¤ă¤ăźć°ăă˛ăźă ä¸ăŤçşč¨ăăăĺć°ăăăăăăŽçşč¨ăĺ
Ľĺă¨ăăĺ
ĽĺăçľăăŁăćçšă§ćŽăŁăŚăăăăŹă¤ă¤ăźăŽçŞĺˇăĺ°ăăé ăŤĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăăăŹă¤ă¤ăźăŤăŻ 1 ăăçŞĺˇăĺ˛ăćŻăăăŚăăăçşč¨é çŞă 1 çŞçŽăŽăăŹă¤ă¤ăźăăé ăŤčĄăăä¸éăçşč¨ăçľăăă¨ăĺ庌 1 çŞçŽăŽăăŹă¤ă¤ăźăăçşč¨ăăăă¨ă¨ăăžăăé çŞăŽĺăŁăŚăăăăŹă¤ă¤ăźăć˘ăŤčąč˝ăăŚăăĺ ´ĺăŻăăăŽćŹĄăŽăăŹă¤ă¤ăźăçşč¨ăăžăăăžăăăăŽăăă°ăŠă ăŻăăăŹă¤ă¤ăźăä¸äşşăŤăŞăŁăćçšă§ăăăŽĺžăŽçşč¨ăçĄčŚăăŞăăă°ăŞăăžăăă
<!--ăžăăĺ
ĽĺăçľăăŁăćçšă§ăŻĺż
ăăăŹă¤ă¤ăźăŽčŞ°ăăćŽăŁăŚăăăăŽă¨ăăžăă-->
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>m</var> <var>n</var>
<var>s<sub>1</sub></var>
<var>s<sub>2</sub></var>
:
<var>s<sub>n</sub></var>
</pre>
<p>
1 čĄçŽăŤăăŹă¤ă¤ăźć° <var>m</var> (2 ≤ <var>m</var> ≤ 1000) ă¨çşč¨ĺć° <var>n</var> (1 ≤ <var>n</var> ≤ 10000) ăä¸ăăăăžăă
</p>
<p>
çśă <var>n</var> čĄăŤ <var>i</var> çŞçŽăŽçşč¨ <var>s<sub>1</sub></var> ăä¸ăăăăžăă <var>s<sub>i</sub></var> ăŻć´ć°ăFizzăBuzzăăžă㯠FizzBuzz ă示ăćĺĺďź8ćĺ䝼ä¸ďźă§ăă
</p>
<!--
<p>
çśă <var>n</var> čĄăŤ <var>i</var> çŞçŽăŽçşč¨ <var>s<sub>1</sub></var> ăä¸ăăăăžăă <var>s<sub>i</sub></var> ăŻć°ĺăFizzăBuzzăFizzBuzzăăăăăŻééăŁăçşč¨ă示ăăăŽäťăŽćĺĺ (20 ćĺ䝼ä¸) ă§ăă
</p>
-->
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăćĺŽăăăçşč¨ĺć°ăžă§ĺ
Ľĺăăăă¨ăăŤćŽăŁăŚăăăăŹă¤ă¤ăźăŽçŞĺˇăĺ°ăăé ăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
5 7
1
2
Fizz
4
Buzz
6
7
3 5
1
2
3
4
5
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
2 3 4 5
1
</pre>
| [
[
"5 7\n1\n2\nFizz\n4\nBuzz\n6\n7\n3 5\n1\n2\n3\n4\n5\n0 0\n",
"5 7\n1\n2\nFizz\n4\nBuzz\n6\n7\n3 5\n1\n2\n3\n4\n5\n0 0\n"
]
] |
p00222 | Prime Quadruplet |
<H1>ĺă¤ĺç´ ć°</H1>
<p>
(<var>a, a+2, a+6, a+8</var>) ăŽăăăŤä¸Śăă 4 ă¤ăŽç´ ć°ăŽçľăĺă¤ĺç´ ć°ă¨ăăăžăăĺă¤ĺç´ ć°ăć§ćăăĺă¤ăŽç´ ć°ăŽăăĄăć大ăŽć°ăăăŽĺă¤ĺç´ ć°ăŽĺ¤§ăăă¨ĺźăłăžăăäžăă°ăćăĺ°ăă大ăăăŽĺă¤ĺç´ ć°ăŻă(5, 7, 11, 13) ăŽçľă§ăăăăăŽĺ¤§ăă㯠13 ă§ăă揥ăŤĺ¤§ăăĺă¤ĺç´ ć°ăŻă(11, 13, 17, 19) ăŽçľă§ăăăŽĺ¤§ăă㯠19 ă§ăă
</p>
<p>
ć´ć° <var>n</var> (13 ≤ <var>n</var> ≤ 10,000,000) ăĺ
Ľĺă¨ăă大ăăă <var>n</var> 䝼ä¸ăŤăŞăăăăŞĺă¤ĺç´ ć°ăŽăăĄăć大ă¨ăŞăăăŽăŽĺ¤§ăăăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăă¨ăăŚďźă¤ăŽć´ć° <var>n</var> ăďźčĄăŤä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 2000 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăć大ă¨ăŞăĺă¤ĺç´ ć°ăŽĺ¤§ăăă1čĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
13
14
15
16
17
18
19
20
10000
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
13
13
13
13
13
13
19
19
9439
</pre>
| [
[
"13\n14\n15\n16\n17\n18\n19\n20\n10000\n0\n",
"13\n14\n15\n16\n17\n18\n19\n20\n10000\n0\n"
]
] |
p00223 | Stray Twins |
<H1>迡ĺăŽĺĺ</H1>
<p>
ăăăăĺă¨ăăăăĺăŻäť˛čŻăăŽĺĺă§ăăăčĄĺăçéă§ăă äžăă°ăăăăăĺă輿ăŤčĄăă°ăăăăăĺăŻćąă¸čĄăăăăăăĺăĺă¸čĄăă°ăăăăăĺăŻĺă¸čĄăăžăă çžĺ¨ 2 äşşăŻăăăźăăŤćĽăŚăăăĺĽă
ăŽĺ ´ćăŤăăžăăçéăŤç§ťĺăăŚăăžă 2 äşşăă§ăăă ăćŠăĺşäźăăăăŤăŻăŠăăăăăăă§ăăăă?
</p>
<p>
ăăăźăăŻć¨Ş <var>W</var> ĺ × ç¸Ś <var>H</var> ĺăŽăăšă§ć§ćăăăă°ăŞăăă§čĄ¨ăăă2 äşşăŻĺä˝ćéăŤćąčĽżĺĺ㍠1 ăăšĺ秝ĺăăăă¨ăă§ăăžăăăă ăăă°ăŞăăăŽçŻĺ˛ĺ¤ăé厳çŠăŽăăăăšăŤç§ťĺăăăă¨ăŻă§ăăžăăă
</p>
<p>
ĺłăŽăăăŤăă°ăŞăăăŽăăšăŽä˝ç˝ŽăŻĺş§ć¨ (<var>x</var>, <var>y</var>) ă§čĄ¨ăăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_straytwins"><br/>
</center>
<p>
ă°ăŞăăăŽć
ĺ ąă¨ 2 äşşăŽĺćä˝ç˝Žăĺ
Ľĺă¨ăă2 äşşăĺşäźăăžă§ăŽćçăŽćéăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăĺşäźăăă¨ăă§ăăŞăĺ ´ĺăăĺşäźăăŽăŤ 100 䝼ä¸ăŽćéăčŚăăĺ ´ĺăŻăNA ă¨ĺşĺăăŚăă ăăăă°ăŞăăăŽć
ĺ ąăŻă<var>H</var> čĄ <var>W</var> ĺăŽć°ĺă2 äşşăŽä˝ç˝Žć
ĺ ąăŻĺş§ć¨ăŤăăŁăŚä¸ăăăăžăă
</p>
<p>
秝ĺĺžăŤăăăăĺăăăăăĺăŽăăĄăăŠăĄăăä¸ćšăé厳çŠăă°ăŞăăăŽçŻĺ˛ĺ¤ăŤä˝ç˝ŽăăŚăăžăă¨ăăŤăŻă秝ĺăă§ăăŞăăŽă§ăé厳çŠăă°ăŞăăăŽçŻĺ˛ĺ¤ăŤä˝ç˝ŽăăćšăŻĺ
ăŽĺ ´ćăŤćťăăžăăăăăă§ăŞăćšăŻĺ
ăŽĺ ´ćăŤćťăăă¨ăŞăĺăăă¨ăă§ăăžăă
</p>
<p>
ăŞăă2 äşşăĺşäźăă¨ăŻă秝ĺĺžăŤ 2 äşşăĺăăăšăŤć˘ăžăăă¨ăč¨ăăžăă2 äşşăăăéăŁăŚăăĺşäźăŁăăă¨ăŤăŻăŞăăžăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>W</var> <var>H</var>
<var>tx</var> <var>ty</var>
<var>kx</var> <var>ky</var>
<var>d<sub>11</sub></var> <var>d<sub>21</sub></var> ... <var>d<sub>W1</sub></var>
<var>d<sub>12</sub></var> <var>d<sub>22</sub></var> ... <var>d<sub>W2</sub></var>
:
<var>d<sub>1H</sub></var> <var>d<sub>2H</sub></var> ... <var>d<sub>WH</sub></var>
</pre>
<p>
1 čĄçŽăŤăăăźăăŽĺ¤§ăă<var>W</var>, <var>H</var> (1 ≤ <var>W, H</var> ≤ 50) ăä¸ăăăăžăă2 čĄçŽăŤăăăăĺăŽĺćä˝ç˝Ž <var>tx, ty</var>ă3 čĄçŽăŤăăăăĺăŽĺćä˝ç˝Ž <var>kx, ky</var> ăä¸ăăăăžăă
</p>
<p>
çśă <var>H</var> čĄăŤăăăźăăŽć
ĺ ąăä¸ăăăăžăă<var>d<sub>i,j</sub></var> ăŻăăš (<var>i, j</var>) ăŽç¨ŽéĄă襨ăă0 ăŽă¨ă秝ĺĺŻč˝ăŞăăšă1 ăŽă¨ăé厳çŠăăăăăšă襨ăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăćçăŽćéăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
6 6
2 4
6 2
0 0 0 0 1 0
0 1 0 0 0 0
0 1 0 0 0 0
0 0 0 1 0 0
0 0 0 0 0 1
0 0 0 0 0 0
3 3
1 1
3 3
0 0 0
0 1 0
0 0 0
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
3
NA
</pre>
| [
[
"6 6\n2 4\n6 2\n0 0 0 0 1 0\n0 1 0 0 0 0\n0 1 0 0 0 0\n0 0 0 1 0 0\n0 0 0 0 0 1\n0 0 0 0 0 0\n3 3\n1 1\n3 3\n0 0 0\n0 1 0\n0 0 0\n0 0\n",
"6 6\n2 4\n6 2\n0 0 0 0 1 0\n0 1 0 0 0 0\n0 1 0 0 0 0\n0 0 0 1 0 0\n0 0 0 0 0 1\n0 0 0 0 0 0\n3 3\n1 1\n3 3\n0 0 0\n0 1 0\n0 0 0\n0 0\n"
]
] |
p00224 | Bicycle Diet |
<H1>čŞčť˘čťă§ăă¤ă¨ăă</H1>
<p>
A ăăăŻçăăăŽă大弽ăă§ăăăćčżăŻĺĽĽăăăăăă¤ă¨ăăăăăăăŤč¨ăăăŚăăžăăăăćĽăA ăăăčŞĺŽ
ăăĺ¸ĺ˝šćăŤĺşăăăă¨ăă弼ăăăŻčŞčť˘čťă§čĄăăă¨ăĺ§ăăžăăăăăă§A ăăăŻăăśăăśčŞčť˘čťăŤäšăŁăŚĺşăăăžăăăăçăçŠăŽĺĽ˝ă㪠A ăăăŻăéä¸ăŤăăăąăźăĺąăăăŤçŤăĄĺŻăăąăźăăŽéŁăšćŠăăăăăă¨ćăă¤ăăžăăă
</p>
<p>
čŞčť˘čťăăăă°čľ°čĄčˇé˘ăŤĺżăăŚăŤăăŞăźăćśč˛ťăăăžăăăăąăźăăéŁăšăă°ăăŽĺăŤăăŞăźăćĺăăăžăăćŁĺłăŽćśč˛ťăŤăăŞăźăŻăčŞčť˘čťăăăă§ćśč˛ťăăăŤăăŞăźăăăąăźăăéŁăšăŚćĺăăăŤăăŞăźăĺźăăĺ¤ăŤăŞăăžăăăăăăŁăŚăćŁĺłăŽćśč˛ťăŤăăŞăźă 0 ăăĺ°ăăăŞăăă¨ăăăăžăă
</p>
<p>
ăąăźăĺąăăă§ăąăźăă財ăŁăăă AăăăŻăăŽĺ ´ă§ăąăźăăĺ
¨é¨éŁăšăŚăăžăăžăă AăăăăăšăŚăŽăąăźăĺąăăăŤçŤăĄĺŻăă¨ăŻéăăžăăăăăąăźăĺąăăăĺĺ¨ăăĺ°çšăéăă¨ăăŤăŻăĺż
ăçŤăĄĺŻăŁăŚăąăźăă 1 ă¤č˛ˇăŁăŚéŁăšăăăŽă¨ăăžăăăă ăăĺăăąăźăĺąăăăŽĺăä˝ĺşŚăéăăŽăŻăăăăŤć°ăă˛ăăăŽă§ăĺăąăźăĺąăăăŤč¨ŞăăăăăŽăŻ 1 ĺă ăă¨ăăžăăăžăăçŽçĺ°ăŽĺ¸ĺ˝šćăăăŁăăéăéăăŚăăăąăźăĺąăăăŤçŤăĄĺŻăăăăŽĺžă§ĺ¸ĺ˝šćăŤćťăŁăŚç¨ăć¸ăžăăŚăăăăăŽă¨ăăăąăźăĺąăă䝼ĺ¤ăŻä˝ĺşŚč¨ŞăăŚăčŻăăăŽă¨ăăžăă
</p>
<p>
A ăăăŽčŞĺŽ
ăăĺ¸ĺ˝šćăžă§ăŽĺ°ĺłć
ĺ ąă¨ăăăŽéä¸ăŤăăăąăźăĺąăăă§éŁăšăăăăąăźăăŽăŤăăŞăźăŽä¸čŚ§ăĺä˝čˇé˘ăŽčľ°čĄăŤăăćśč˛ťăŤăăŞăźăĺ
Ľĺă¨ăăčŞĺŽ
ăĺşçşăăŚăăĺ¸ĺ˝šćăŤĺ
Ľăăžă§ăŽćŁĺłăŽćśč˛ťăŤăăŞăźăŽćĺ°ĺ¤ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<p>
ĺ°ĺłăŤăŻăA ăăăŽčŞĺŽ
ă¨ĺ¸ĺ˝šćăăąăźăĺąăăă¨ăŠăłăăăźăŻ(çŽĺ°)ăŤăŞăĺťşçŠăć¸ăăăŚăăžăăĺ°ĺłă襨ăĺ
ĽĺăăźăżăŻăA ăăăŽčŞĺŽ
ăĺ¸ĺ˝šćăăąăźăĺąăăă¨ăŠăłăăăźăŻăŽĺĺ°çšăŽéăă¤ăŞăéăăăă¨ăă2 ă¤ăŽĺ°çšă襨ăč¨ĺˇă¨ăăŽéăŽčˇé˘ăăăŞăčĄăĺŤăżăžăăăă¨ăă°ă5 çŞçŽăŽăąăźăĺąăă㨠3 çŞçŽăŽăŠăłăăăźăŻăŽéăŽčˇé˘ă 10 ăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽăăăŞčĄăĺŤăżăžăă
</p>
<pre>
C5 L3 10
</pre>
<p>
ăăŽăăăŤăąăźăĺąăăăŤăŻ CăăŠăłăăăźăŻăŤăŻ L ăçŞĺˇăŽĺăŤă¤ăăŚčĄ¨ăăžăăăžăăA ăăăŽčŞĺŽ
㯠Hăĺ¸ĺ˝šć㯠D ă§čĄ¨ăăžăăĺ
ĽĺăăźăżăŤ 2 ă¤ăŽĺ°çšă¨ăăŽéăŽčˇé˘ăä¸ăăăăŚăăăŞăă2 ĺ°çšăŽéăăŠăĄăĺăăŤăé˛ăăžăăăă¨ăă°ăä¸ăŽäžă§ăŻăąăźăĺąăăăăăŠăłăăăźăŻă¸ăăăăŽéĺăă¸ăé˛ăăă¨ăă§ăăžăăăžăăčŞĺŽ
ăăĺ¸ĺ˝šćăžă§ăŻĺż
ăăăŠăçăăăăŽă¨ăăžăăăă䝼ĺ¤ăŤä¸ăăăăĺ
ĽĺăăźăżăŻăăąăźăĺąăăăŽć° <var>m</var>ăăŠăłăăăźăŻăŽć° <var>n</var>ăĺä˝čˇé˘ăăăăŽćśč˛ťăŤăăŞăź <var>k</var>ă 1 çŞçŽăŽăąăźăĺąăăăă <var>m</var> çŞçŽăŽăąăźăĺąăăăžă§ăŽăăăăă§č˛ˇăăăąăźăăŽăŤăăŞăźă襨ă <var>m</var> ĺăŽăăźăżăčˇé˘ăŽăăźăżăŽçˇć° <var>d</var> ă§ăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻĺă¤ăŽ 0 ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>m</var> <var>n</var> <var>k</var> <var>d</var>
<var>c<sub>1</sub></var> <var>c<sub>2</sub></var> ... <var>c<sub>m</sub></var>
<var>s<sub>1</sub></var> <var>t<sub>1</sub></var> <var>e<sub>1</sub></var>
<var>s<sub>2</sub></var> <var>t<sub>2</sub></var> <var>e<sub>2</sub></var>
:
<var>s<sub>d</sub></var> <var>t<sub>d</sub></var> <var>e<sub>d</sub></var>
</pre>
<p>
1 čĄçŽăŤăąăźăĺąăăăŽć° <var>m</var> (1 ≤ <var>m</var> ≤ 6)ă ăŠăłăăăźăŻăŽć° <var>n</var> (1 ≤ <var>n</var> ≤ 100) ăĺä˝čˇé˘ăăăăŽćśč˛ťăŤăăŞăź <var>k</var> (1 ≤ <var>k</var> ≤ 5)ăčˇé˘ăŽăăźăżăŽçˇć° <var>d</var> (5 ≤ <var>d</var> ≤ 256) ăä¸ăăăăžăă
</p>
<p>
2 čĄçŽăŤĺăąăźăĺąă§č˛ˇăăąăźăăŽăŤăăŞăź <var>c<sub>i</sub></var> (1 ≤ <var>c<sub>i</sub></var> ≤ 100) ăä¸ăăăăžăă
</p>
<p>
çśă <var>d</var> čĄăŤ <var>i</var> çŞçŽăŽ 2 ă¤ăŽĺ°çšéăŽčˇé˘ăăźăż <var>s<sub>i</sub></var>, <var>t<sub>i</sub></var>, <var>e<sub>i</sub></var> (1 ≤ <var>e<sub>i</sub></var> ≤ 20) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăĺ
¨ä˝ăŽćśč˛ťăŤăăŞăźăŽćĺ°ĺ¤ăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
1 1 2 5
35
H L1 5
C1 D 6
C1 H 12
L1 D 10
C1 L1 20
2 1 4 6
100 70
H L1 5
C1 L1 12
C1 D 11
C2 L1 7
C2 D 15
L1 D 8
0 0 0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1
-2
</pre>
| [
[
"1 1 2 5\n35\nH L1 5\nC1 D 6\nC1 H 12\nL1 D 10\nC1 L1 20\n2 1 4 6\n100 70\nH L1 5\nC1 L1 12\nC1 D 11\nC2 L1 7\nC2 D 15\nL1 D 8\n0 0 0 0\n",
"1 1 2 5\n35\nH L1 5\nC1 D 6\nC1 H 12\nL1 D 10\nC1 L1 20\n2 1 4 6\n100 70\nH L1 5\nC1 L1 12\nC1 D 11\nC2 L1 7\nC2 D 15\nL1 D 8\n0 0 0 0\n"
]
] |
p00225 | Kobutanukitsuneko |
<H1>ăăśăăŹăă¤ăă</H1>
<p>
AĺăăăŽĺŽśăŤčŚŞćăŽBçˇĺăăăŁăŚăăžăăă彟ăŻ3ćłă§ćă大弽ăă§ăă彟ăŻĺšźç¨ĺă§ăŞăăŁăăăăśăăŹăă¤ăăă(ĺąąćŹç´ç´ä˝čŠăťä˝ć˛)ă¨ăăćăä¸çć¸ĺ˝ăŤćăŁăŚăăžăăăăŽćă§ăŻă4ă¤ăŽăă¨ă°ăăăśăă ăăăŹăă ăăă¤ăăăăăăăé ăŤăăă¨ăăŤăŞăŁăŚăăŚăăăăŤćĺžăŽéłă¨ćĺăŽéłăĺăăŤăŞăŁăŚăăžăăBçˇĺăŻăAĺăăăŤăĺăăăăŞăăă¨ăăăBçˇĺăč¨ăŁăĺčŞăăä˝ăăăćăăŚćŹ˛ăăă¨č¨ăăăžăăă
</p>
<p>
ăăă§ăAĺăăăĺŠăăăăăŤăä¸ăăăăĺčŞăăăăăŽĺčŞăăăšăŚä˝żăŁăŚăé ăŤăăă¨ăăă¤ăăăăăŽä¸ă§ă 珏1 ăŽĺčŞăŽćĺăŽćĺă¨ćçľăŽĺčŞăŽćĺžăŽćĺăĺăă§ăăăăăŤă§ăăăĺŚăăĺ¤ĺŽăăăăă°ăŠă ăä˝ćăăžăăăă
</p>
<p>
<var>n</var> ĺăŽĺčŞăĺ
Ľĺă¨ăăăăăăŽĺčŞăŽçľăăăăă¨ăăä˝ćă§ăăăĺŚăăĺ¤ĺŽăăĺŻč˝ăŞĺ ´ĺăŻOK ă¨ăä¸ĺŻč˝ăŞĺ ´ĺ㯠NG ă¨ĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>word<sub>1</sub></var>
<var>word<sub>2</sub></var>
:
<var>word<sub>n</sub></var>
</pre>
<p>
1 čĄçŽăŤĺčŞăŽĺć° <var>n</var> (2 ≤ <var>n</var> ≤ 10000) ăä¸ăăăăžăăçśă <var>n</var> čĄăŤ <var>n</var> ĺăŽĺčŞ <var>word<sub>i</sub></var> (32 ćĺ䝼ä¸ăŽĺč§čąĺ°ćĺă ăăăăŞăćĺĺ) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăĺ¤ĺŽçľćăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
5
apple
yellow
georgia
king
email
7
apple
yellow
georgia
king
email
wink
lucky
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
NG
OK
</pre>
| [
[
"5\napple\nyellow\ngeorgia\nking\nemail\n7\napple\nyellow\ngeorgia\nking\nemail\nwink\nlucky\n0\n",
"5\napple\nyellow\ngeorgia\nking\nemail\n7\napple\nyellow\ngeorgia\nking\nemail\nwink\nlucky\n0\n"
]
] |
p00226 | Hit and Blow |
<H1>ăăăă˘ăłăăăăź</H1>
<p>
太éĺă¨čąĺăăăŻăăăă˘ăłăăăăźă§éăśăă¨ăŤăăžăăăăăăă˘ăłăăăăźăŽăŤăźăŤăŻă䝼ä¸ăŽéăă§ăă
</p>
<ul>
<li> ĺşéĄč
ă¨ĺçč
ăŤĺăăăŚčĄăă</li>
<li> ĺşéĄč
ăŻăéč¤ăăć°ăĺŤăžăŞă 4 ćĄăŽć°ĺ(ćŁč§Ł)ăćąşăăă</li>
<li> ĺçč
ăŻăă㎠4 ćĄăŽć°ĺ(ĺç)ăč¨ăĺ˝ăŚăă</li>
<li> ĺçăŤĺŻžăăŚăĺşéĄč
ăŻăăăă¨ăăăźăŽć°ă§ăăłăăä¸ăăă</li>
<li> ĺçă¨ćŁč§ŁăćŻăšăŚăć°ă¨ćĄä˝ç˝ŽăŽä¸Ąćšăĺăă§ăăăă¨ăăăăă¨ĺźăłăć°ă ăăĺăă§ćĄä˝ç˝Žăç°ăŞăăă¨ăăăăźă¨ĺźăśăăă¨ăă°ăćŁč§Łă 1234 ă§ăĺçă 1354 ăŞăăĺşéĄč
ăŻă2 ăăăă1 ăăăźăă¨ăăăăłăăä¸ăăćŁč§Łăžă§ăăăçš°ăčżăă</li>
<li> ĺşéĄč
ă¨ĺçč
ăŻäş¤äťŁăăŚă˛ăźă ăčĄăăăăĺ°ăŞăĺçă§ćŁč§Łăč¨ăĺ˝ăŚăćšăĺăĄă¨ăăă</li>
</ul>
<p>
太éĺă¨čąĺăăăŻăăăăăŽć°ă¨ăăăźăŽć°ăăăŽé˝ĺşŚĺ¤ćăăăă¨ăĺ°ăé˘ĺăŤćăăŚăăăăă§ăăăăăŞäşäşşăŽăăăŤăăăăăŽć°ă¨ăăăźăŽć°ăĺłĺş§ăŤĺăăăăă°ăŠă ăä˝ćăăŚăăăžăăăă
</p>
<p>
ćŁč§Ł <var>r</var> ă¨ĺç <var>a</var> ăĺ
Ľĺă¨ăăăăăăŽć°ă¨ăăăźăŽć°ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă<var>r</var>ă<var>a</var> ăŻăăăă 0 ăă 9 ăŽć°ĺ 4 ă¤ăăăŞăć°ĺăŽĺă§ăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăă¨ăăŚă<var>r</var> 㨠<var>a</var> ă犺ç˝ĺşĺăă§ďźčĄăŤä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 12000 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăăăăăŽć°ă¨ăăăźăŽć°ăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
1234 5678
1234 1354
1234 1234
1230 1023
0123 1234
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
0 0
2 1
4 0
1 3
0 3
</pre>
| [
[
"1234 5678\n1234 1354\n1234 1234\n1230 1023\n0123 1234\n0 0\n",
"1234 5678\n1234 1354\n1234 1234\n1230 1023\n0123 1234\n0 0\n"
]
] |
p00227 | Thanksgiving |
<H1>ă厢ć§ĺ¤§ćčŹçĽ</H1>
<p>
ćŞĺ¤ŠĺăçśăéčăŽäžĄć źăéŤé¨°ăăä¸ăăťăăłăăźăă§ăŻă厢ć§ăŤéčăŽăžă¨ă財ăăťăźăŤăĺŽć˝ăăŚăăžăă ćĽăăăŞăăŞăĺşé ăŤä¸Śă°ăŞăéčăăćé äžĄć źă§ćăŤĺ
Ľăă¨ăăŁăŚă ĺşĺ
ăŻă¨ăŚăčłăăŁăŚăăžăă
</p>
<p>
ăăćĽăćžéˇĺŁĺ°ăŤä˝ă䝲čŻă 3 äşşçľăăťăăłăăźăăŽĺşĺăćăŤčŠąăŤčąăĺ˛ăăăŚăăžăăăäťĺăŽăťăźăŤăŻăă厢ć§ĺ¤§ćčŹçĽăă¨éćăŁăă ăăŤăč˘čŠ°ăăăéčăŽä¸ă§ćăĺŽăăăŽăçĄćăŤăŞăăŽăçŽçă¨ăŞăŁăŚăăžăăĺşĺăčŞăă§ăżăă¨ăăŠăăă䝼ä¸ăŽăăăŞăťăźăŤăŽăăă§ăă
</p>
<ul>
<li> 1 ă¤ăŽč˘ăŤăŻ <var>m</var> ĺăžă§éčă芰ăăăăă</li>
<li> éčă <var>m</var> ĺ芰ăăŚăăč˘ăŤă¤ăăŚăŻăăăŽä¸ă§ćăĺŽăéčăçĄćă¨ăŞăă</li>
<li> éčăŽĺć°ă <var>m</var> ĺăŤéăăŞăč˘ăŻĺ˛ĺźăŽĺŻžčąĄĺ¤ă</li>
</ul>
<p>
3äşşăŻćŠéăťăăłăăźăă¸č˛ˇăçŠăŤčĄăăžăăă
</p>
<p>
財ăçŠăçľăăă ăĺşăŽĺ¤ă§ĺž
ăĄĺăăă 3 äşşăŻĺŽăăŚăăăăčłźĺ
Ľă§ăăăă¨ăŤćşčśłăăć§ĺă§čŠąăăăŚăăă¨ăăŠăăă 3 äşşă¨ăĺăéčăčłźĺ
ĽăăŚăăăă¨ăĺăăăžăăăăăä¸äşşăăăćŹĺ˝ăŤĺŽăăăăăăăăă§XXXĺă ăăŽ!ăă¨č¨ăă¨ăăăä¸äşşăŻăăă?ç§ăŻăăăă**ĺéŤăăŁăă!ăŠăăăŚ?ăă¨éŠăăăžăăćŽăăŽä¸äşşăŻăŹăˇăźăăčŚăŚčŞĺăä¸çŞĺŽăčłźĺ
Ľăăăă¨ăŤć°äťăăžăăă
</p>
<p>
ăăŚăăŠăŽăăăŤč˘čŠ°ăăăă°čłźĺ
ĽäžĄć źăä¸çŞĺŽăă§ăăă§ăăăăă čłźĺ
ĽăăéčăŽĺć°ăč˘ăŤĺ
ĽăéčăŽĺć°ăĺéčăŽĺ¤ćŽľăĺ
Ľĺă¨ăăćä˝čłźĺ
ĽäžĄć źăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var> <var>m</var>
<var>p<sub>1</sub></var> <var>p<sub>2</sub></var> ... <var>p<sub>n</sub></var>
</pre>
<p>
1 čĄçŽăŤčłźĺ
ĽăăéčăŽĺć° <var>n</var> (1 ≤ <var>n</var> ≤ 1000) ă¨č˘ăŤĺ
ĽăéčăŽĺć° <var>m</var> (1 ≤ <var>m</var> ≤ 1000)ăăä¸ăăăăžăăďźčĄçŽăŤĺéčăŽĺ¤ćŽľ <var>p<sub>i</sub></var> (10 ≤ <var>p<sub>i</sub></var> ≤ 10000) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăćä˝čłźĺ
ĽäžĄć źăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
4 2
50 40 100 80
7 3
400 300 100 700 200 600 500
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
150
2100
</pre>
| [
[
"4 2\n50 40 100 80\n7 3\n400 300 100 700 200 600 500\n0 0\n",
"4 2\n50 40 100 80\n7 3\n400 300 100 700 200 600 500\n0 0\n"
]
] |
p00228 | Seven Segments |
<H1>7 ăťă°ăĄăłă</H1>
<p>
éťĺăŞăŠă§ăăçŽăŤăăăă¸ăżăŤć°ĺă襨示ăăŚăăçťé˘ăŻăăă¸ăżăŤć°ĺă 7 ă¤ăŽé¨ĺ(ăťă°ăĄăł
ă)ă§ć§ćăăăăă¨ăăăă7ăťă°ăĄăłăăăŁăšăăŹă¤ăă¨ĺźă°ăăŚăăžăă
</p>
<p>
ăŻăŤăă礞ă§ć°ăă売ăĺşăäşĺŽăŽčŁ˝ĺăŻă<!--ăă¸ăżăŤć°ĺăŽčĄ¨ç¤şăĺż
é ăŽăăă-->7ăťă°ăĄăłăăăŁăšăăŹă¤ă製ĺăŤçľăżčžźăăă¨ăŤăŞăă礞ĺĄă§ăăăăŞăăŻăä¸ăăăăć°ĺă 7 ăťă°ăĄăłăăăŁăšăăŹă¤ăŤčĄ¨ç¤şăăăăă°ăŠă ăä˝ćăăăă¨ăŤăŞăăžăăă
</p>
<p>
ăăŽ7ăťă°ăĄăłăăăŁăšăăŹă¤ăŻă揥ăŽĺăćżăăŽć示ăéăăăŚăăăžă§čĄ¨ç¤şçść
ăŻĺ¤ăăăžăăă7 ăăăăăăŞăăˇă°ăăŤăéăăă¨ă§ăăăăă寞ĺżăăăťă°ăĄăłăăŽčĄ¨ç¤şć
ĺ ąăĺăćżăăäşăă§ăăžăăăăăă¨ăŻ 1 ă 0 ăŽĺ¤ăćă¤ăăŽă§ăăăă§ăŻ 1 ăăĺăćżăăă0 ăăăăŽăžăžăă襨ăăžăă
</p>
<!--
<p>
ĺăăăă¨ăťă°ăĄăłăăŽĺŻžĺżé˘äżăŻä¸ăŽĺłăŽăăăŤăŞăŁăŚăăžăăăˇă°ăăŤăŻ 7 ă¤ăŽăăăă"gfedcba"ăŽé çŞăŤăŞăŁăŚăăžăăäžăă°ăé襨示ăŽçść
ăăă0ăă襨示ăăăăăŤăŻ"0111111"ăăˇă°ăăŤă¨ăăŚăăŁăšăăŹă¤ăŤéăăŞăăă°ăŞăăžăăăă0ăăăă5ăăŤĺ¤ć´ăăĺ ´ĺăŤăŻ"1010010"ăéăăžăăçśăăŚă5ăăă1ăăŤĺ¤ć´ăăĺ ´ĺăŤăŻ"1101011"ăéăăžăă
</p>
-->
<p>
ĺăăăă¨ăťă°ăĄăłăăŽĺŻžĺżé˘äżăŻä¸ăŽĺłăŽăăăŤăŞăŁăŚăăžăăăˇă°ăăŤăŻ 7 ă¤ăŽăăăă"gfedcba"ăŽé çŞăŤéăăžăăäžăă°ăé襨示ăŽçść
ăăă0ăă襨示ăăăăăŤăŻ"0111111"ăăˇă°ăăŤă¨ăăŚăăŁăšăăŹă¤ăŤéăăŞăăă°ăŞăăžăăăă0ăăăă5ăăŤĺ¤ć´ăăĺ ´ĺăŤăŻ"1010010"ăéăăžăăçśăăŚă5ăăă1ăăŤĺ¤ć´ăăĺ ´ĺăŤăŻ"1101011"ăéăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_7segments" width="60%" ><br/>
<br/>
</center>
<p>
襨示ăăă <var>n</var> (1 ≤ <var>n</var> ≤ 100) ĺăŽć°ĺăĺ
Ľĺă¨ăăăăăăŽć°ĺ <var>d<sub>i</sub></var> (0 ≤ <var>d<sub>i</sub></var> ≤ 9) ăé ㍠7 ăťă°ăĄăłăăăŁăšăăŹă¤ăŤćŁăă襨示ăăăăăŤĺż
čŚăŞăˇă°ăăŤĺăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăŞăă7 ăťă°ăĄăłăăăŁăšăăŹă¤ăŽĺćçść
ăŻĺ
¨ăŚé襨示ăŽçść
ă§ăăăăŽă¨ăăžăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻ-1 ă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>d<sub>1</sub></var>
<var>d<sub>2</sub></var>
:
<var>d<sub>n</sub></var>
</pre>
<p>
ăăźăżăťăăăŽć°ăŻ 120 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăć°ĺăăăŁăšăăŹă¤ăŤćŁăăĺşĺăăăăăŤĺż
čŚăŞăˇă°ăăŤăŽĺăĺşĺăăŚăă ăăă
</p>
<H2>Sample Input</H2>
<pre>
3
0
5
1
1
0
-1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
0111111
1010010
1101011
0111111
</pre>
| [
[
"3\n0\n5\n1\n1\n0\n-1\n",
"3\n0\n5\n1\n1\n0\n-1\n"
]
] |
p00229 | Big Hit ! |
<H1>大ĺ˝ăă!</H1>
<p>
ăăăĽĺŚĺ大ĺŚéĺąéŤć ĄăŽĺ¤§éżčśłăăăĺăŻăăšăăăăăˇăźăłă§éăśăă¨ăŤăăžăăă
</p>
<p>
ăăŽăăˇăźăłăŻăăĄăăŤăćĺ
Ľăăă¨ă3 ă¤ăŽăŞăźăŤăĺ蝢ăĺ§ăăĺăŞăźăŤăčŞĺçăŤć˘ăžăăžăăé常ăŽ1ă˛ăźă (é常ă˛ăźă )㯠3 ćăŽăĄăăŤăćĺ
Ľăăĺłćăćăă¨ăăăŽĺłćăŤĺżăăŚćŹĄăŽă¨ăăăĄăăŤăĺžăăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_bighit"><br/>
<br/>
</center>
<p>
ĺłćăŽćăćšăŤăăŁăŚăŻçšĺĽăŞăľăźăăšăéĺ§ăăăžăă 7 ăŽĺłćă 3 ă¤ćăă¨ăăă°ăăźăăšăĺ§ăžăăăăźăăšă˛ăźă ă 5 ă˛ăźă čĄăăă¨ăă§ăăžăăăžăăBAR ăŽĺłćă 3 ă¤ćăă¨ăŹăŽăĽăŠăźăăźăăšăĺ§ăžăăăăźăăšă˛ăźă ă 3 ă˛ăźă čĄăăă¨ăă§ăăžăă
</p>
<p>
ăšăżăźăŽĺłćă 3 ă¤ćăă¨çĄćă˛ăźă ăéĺ§ăăăăĄăăŤăĺžăăă¨ăŻă§ăăžăăăă揥ăŽă˛ăźă ăăĄăăŤăŽćĺ
ĽăŞăĺ§ăăăă¨ăă§ăăžăă
</p>
<p>
ăăźăăšă˛ăźă ä¸ăŻ 1 ă˛ăźă ăăă 2 ćăŽăĄăăŤăćĺ
Ľăăă¨ăčŞĺă§ăăăŚăŽĺłćă 3 ă¤ćăăăĄăăŤă 15 ćĺžăăă¨ăă§ăăžăă
</p>
<p>
大éżčśłĺ㯠100 ćăŽăĄăăŤăćăŁăŚăăˇăźăłă§éăłĺ§ăăžăăăăă°ăăéăłăé常ă˛ăźă ăŤăŞăŁăçść
ă§çľäşăăžăăăćĺ
ăŤćŽăŁăăĄăăŤăŻä˝ćă¨ăŞăŁăă§ăăăăă
</p>
<p>
ăăŹă¤ć
ĺ ąăĺ
Ľĺă¨ăăćĺ
ăŤćŽăŁăăĄăăŤăŽć°ăĺşĺăăăăă°ăŠă ăä˝ćăăŚä¸ăăă ăăŹă¤ć
ĺ ąă¨ăăŚăăăă°ăăźăăšăŽĺć° <var>b</var>ăăŹăŽăĽăŠăźăăźăăšăŽĺć° <var>r</var>ăé常ă˛ăźă ä¸ăŤăăăŚăćăŁăĺć° <var>g</var>ăăă§ăŞăźăćăŁăĺć° <var>c</var>ăăšăżăźăćăŁăĺć° <var>s</var>ăçˇă˛ăźă ć° <var>t</var> ăä¸ăăăăžăă
</p>
<p>
ăŞăă<var>t</var> ăŤăŻăăźăăšă˛ăźă ăŽĺć°ăĺŤăżăžăăăžăăăĄăăŤăŻă˛ăźă ăŽéä¸ăŤăŞăăŞăăă¨ăŻăăăžăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăăŁă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
<pre>
<var>b</var> <var>r</var> <var>g</var> <var>c</var> <var>s</var> <var>t</var>
</pre>
<p>
<var>b, r, g, c, s</var> ăŻăăăă 0 äťĽä¸ 200 䝼ä¸ăŽć´ć°ă<var>t</var> 㯠1000 䝼ä¸ăŽć´ć°ă§ăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 120 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăćĺ
ăŤćŽăŁăăĄăăŤăŽćć°ăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
3 2 30 3 26 226
9 0 18 3 20 118
5 5 12 2 15 203
7 4 19 2 22 197
7 4 24 4 17 209
0 0 0 0 0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
127
793
414
629
617
</pre>
| [
[
"3 2 30 3 26 226\n9 0 18 3 20 118\n5 5 12 2 15 203\n7 4 19 2 22 197\n7 4 24 4 17 209\n0 0 0 0 0 0\n",
"3 2 30 3 26 226\n9 0 18 3 20 118\n5 5 12 2 15 203\n7 4 19 2 22 197\n7 4 24 4 17 209\n0 0 0 0 0 0\n"
]
] |
p00230 | Ninja Climbing |
<H1>ĺżč
ăŽăăŤçťă</H1>
<p>
ĺżč
ăŽăă¤ăăăăŻăćŻćĽććŠăăăĺ¤é
ăăžă§ĺżč
ăăŤăŽĺąä¸ăăçşăčŚĺăăŚăăžăăăăŽĺżč
ăăŤăŻăéŁćĽăă 2 ă¤ăŽĺăéć°ăŽăăŤă§ăăăăă¤ăăăăŻčŚĺăŽăăăŤăăăŤă¨ăăŤăŽéăă¸ăŁăłăăăŞăăĺąä¸ă¸ĺăăăă¨ăćĽčŞ˛ă¨ăăŚăăžăă
</p>
<p>
ă㎠2 ă¤ăŽăăŤăŻé ťçšăŤć¸
ćăčĄăăăăăăăăŤçťăăŽĺŠăă¨ăŞăăŻăăăé厳ă¨ăŞăćťăăăăé¨ĺăăăăžăă ăăăăăŻăăăćťăăăăé¨ĺăŽä˝ç˝ŽăŻćŻćĽĺ¤ăăăžăă ăăŽăăăă¤ăăăăŻăĺąä¸ă¸ĺăăćšćłăćŻćĽčăăŞăăă°ăăăžăăă<!--ăă¤ăăăăŻăä˝ĺăŽă¸ăŁăłăă§ĺąä¸ăŤăăŠăçăăă§ăăăă?-->
</p>
<p>
ăă¤ăăăăŻäşă¤ä¸Śăă ĺăéć°ăŽăăŤăŽĺŁă衳ăłç§ťăăŞăăăăăŤăŽĺąä¸ăçŽćăăžăăă¸ăŁăłă
ăŻăŠăĄăăä¸ćšăŽăăŤăŽ1éăăĺ§ăăăăžăăĺăăĺ´ăŽăăŤă¸ă¸ăŁăłăăăă¨ăăŤăŻăĺăéăť1ă¤ä¸ăŽéăť2 ă¤ä¸ăŽéăŽăăăăăăŤéŁăłç§ťăăă¨ăă§ăăžăă
</p>
<p>
ĺŁăŤăŻäťĽä¸ăŽ 3 税éĄăăăăăăăăăŽĺŁăŤă¸ăŁăłăăăĺžăŽç§ťĺăćąşăžăŁăŚăăžăă
</p>
<ul>
<li>0. ćŽéăŽĺŁ: ä¸ä¸ăŽç§ťĺăŻăăŞăă揥ăŽă¸ăŁăłăăŻăăăăčĄăă</li>
<li>1. ăŻăă: ăŻăă㯠2 ă¤äťĽä¸ăŽéăŤăžăăăŁăŚăăăŁăŚăăăäťăăăŻăăăŽä¸çŞä¸ăžă§ç§ťĺăăă揥ăŽă¸ăŁăłăăŻăăăăčĄăă</li>
<li>2. ăăšăĺŁ: ćŽéăŽĺŁăăŻăăăŽä¸çŞä¸ăžă§ćťăč˝ăĄăă揥ăŽă¸ăŁăłăăŻăăăăčĄăă</li>
</ul>
<p>
ăžăăĺŁăŻ 1 éăăĺąä¸ăŽăăä¸ăŽćä¸éăžă§ăăăĺąä¸ă¸ăŻăăŽăăŤăŽćä¸éăăăŽăżčĄăăă¨ă
ă§ăăžăăăžăăăăŤăŽćä¸éăŽĺŁăŻăăšăĺŁăŤăŻăŞăăžăăă
</p>
<p>
2 ă¤ăŽăăŤăŽéć° <var>n</var> 㨠2 ă¤ăŽăăŤăŽĺŁăŽç¨ŽéĄăĺ
Ľĺă¨ăăćĺ°ă§ä˝ĺçŽăŽă¸ăŁăłăă§ćä¸éăžă§ăăŠăçăăĺąä¸ăžă§čĄăăă¨ăă§ăăăăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăŞăăăŠăĄăăŽăăŤăŽĺąä¸ăŤăăŠăçăăŚăăăăăŽă¨ăăžăăăă ăăăă¤ăăăăăŠăĄăăŽăăŤăŽĺąä¸ă¸ăăăŠăçăăŞăĺ ´ĺăŻâNAâă¨ĺşĺăăŚăă ăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_ninjabill"><br/>
<br/>
</center>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> ... <var>a<sub>n</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> ... <var>b<sub>n</sub></var>
</pre>
<p>
ďźčĄçŽăŤăăŤăŽéć° <var>n</var> (3 ≤ <var>n</var> ≤ 100) ăä¸ăăăăžăăďźčĄçŽăŤďź ă¤çŽăŽăăŤăŽ 1 éăă <var>n</var> éăžă§ăŽĺŁăŽć
ĺ ą <var>a<sub>i</sub></var>ăďźčĄçŽăŤďźă¤çŽăŽăăŤăŽ 1 éăă <var>n</var> éăžă§ăŽĺŁăŽć
ĺ ą <var>b<sub>i</sub></var> ăä¸ăăăăžăă<var>a<sub>i</sub>, b<sub>i</sub></var> ăŻ<var>i</var> éçŽăŽĺŁăŽć
ĺ ąă襨ăă0 ăćŽéăŽĺŁă1 ăăŻăă(<var>i</var> é㨠<var>i</var>+1 éăŤăžăăă)ă2 ăăăšăĺŁă襨ăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 60 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăă¸ăŁăłăăŽĺć°ăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
8
0 0 0 2 2 2 0 0
1 1 1 1 0 0 0 0
4
1 1 2 2
0 0 2 2
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
NA
</pre>
| [
[
"8\n0 0 0 2 2 2 0 0\n1 1 1 1 0 0 0 0\n4\n1 1 2 2\n0 0 2 2\n0\n",
"8\n0 0 0 2 2 2 0 0\n1 1 1 1 0 0 0 0\n4\n1 1 2 2\n0 0 2 2\n0\n"
]
] |
p00231 | Dangerous Bridge |
<H1>ĺąăŞăćŠ</H1>
<p>
äźć´ĽčĽćžĺ¸ăăăăŁă¨ĺăŤä˝ç˝Žăăäźć´Ľĺ¤ćžćă§ăŻăăă¤ćŠ(ăă°ă) ăă¨ĺźă°ăăćŠăĺ¨čžşăŽćă¸ç§ťĺăăĺŻä¸ăŽć掾ă¨ăŞăŁăŚăăžăăăăŽćŠăŻéčĄäşşăĺ¤ăăŤăé˘ăăăăäťăŤăĺŁăăăăŞăťăŠčć˝ĺăé˛ăă§ăăžăŁăŚăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_dengarousBridge"><br/>
</center>
<br/>
<p>
ă¤ćŠăŻ 150 [kg] ăžă§čăăăă埡庌ăćăŁăŚăăžăăäžăă°ă80 [kg] ăŽäşşă¨ 50 [kg] ăŽäşşăĺćăŤć¸Ąăăă¨ăŻă§ăăžăăă80 [kg] ăŽäşşă渥ăŁăŚăăă¨ă㍠90 [kg] ăŽäşşă渥ăĺ§ăăă¨ăă¤ćŠăŻĺŁăăŚăăžăăžăă
</p>
<p>
ăăă¤ćŠăĺŁăăŚăăžăŁăăăäźć´Ľĺ¤ćžćăŽäşşă
ăŻĺ¨čžşăŽćă¸ç§ťĺăăć掾ă夹ăŁăŚăăžăăžăăăăă§ăćă§ĺŻä¸ăŽăăă°ăŠăăźă§ăăăăŞăăŻăćć°ăŽçć´ťăĺŽăăăăŤăćŠăŽć¸ĄăćšăăćŠăĺŁăăăĺŚăăĺ¤ĺŽăăăăă°ăŠă ăä˝ćăăăă¨ăŤăăžăăă
</p>
<p>
ćŠă渥ăéčĄäşşăŽäşşć° <var>n</var> (1 ≤ <var>n</var> ≤ 100)ăĺéčĄäşşăŽä˝é <var>m<sub>i</sub></var> (1 ≤ <var>m<sub>i</sub></var> ≤ 100)ăćŠă渥ăĺ§ăăćĺť <var>a<sub>i</sub></var>ă渥ăçľăăćĺť <var>b<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var>, <var>b<sub>i</sub></var> < 2<sup>31</sup>) ăĺ
Ľĺă¨ăăćŠăĺŁăăŞăĺ ´ĺăŻâOK âă¨ĺşĺăăĺŁăăĺ ´ĺăŻâNG âă¨ĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăŞăăćŠăŽä¸ăŤăăéčĄäşşăŽä˝éăŽçˇĺă 150 [kg] ăčś
ăăŚăăžăă¨ă¤ćŠăŻĺŁăăŚăăžăăžăăăžăă<var>a<sub>i</sub></var> ăŽćçšă§éčĄäşşăŻćŠăŽä¸ăŤăăžăăă<var>b<sub>i</sub></var> ăŽćçšă§ăŻćŠăŽä¸ăŤăăžăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>m<sub>1</sub></var> <var>a<sub>1</sub></var> <var>b<sub>1</sub></var>
<var>m<sub>2</sub></var> <var>a<sub>2</sub></var> <var>b<sub>2</sub></var>
:
<var>m<sub>n</sub></var> <var>a<sub>n</sub></var> <var>b<sub>n</sub></var>
</pre>
<p>
ăăźăżăťăăăŽć°ăŻ 1200 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăćŠăĺŁăăăĺŚăă1čĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
3
80 0 30
50 5 25
90 27 50
3
80 0 30
70 5 25
71 30 50
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
NG
OK
</pre>
| [
[
"3\n80 0 30\n50 5 25\n90 27 50\n3\n80 0 30\n70 5 25\n71 30 50\n0\n",
"3\n80 0 30\n50 5 25\n90 27 50\n3\n80 0 30\n70 5 25\n71 30 50\n0\n"
]
] |
p00232 | Life Game |
<H1>äşşçă˛ăźă </H1>
<p>
太éĺăŻăăăăĄăĺąăăăŤäźć´Ľăăăźç¤žčŁ˝ăŽäşşçă˛ăźă ă財ăăŤčĄăăžăăăäşşçă˛ăźă ăŻăăăšçŽăŽć¸ăăăăăźăă¨ăŤăźăŹăăă使ăŁăŚéăłăžăăăăźăăŤăŻĺłăŽăăăŤăšăżăźăĺ°çšă¨ă´ăźăŤĺ°çšăä¸ă¤ăă¤ăăăăăăăŻă˛ă¨ă¤ăŞăăăŽăăšçŽă§ă¤ăŞăăŁăŚăăžăăćĺăŤăăłăăŻăšăżăźăĺ°çšăŽăăšăŤç˝ŽăăăăŤăźăŹăăăĺăăŚĺşăć°ăŤăăŁăŚăłăăé˛ăăžăăăăšăŤăăŁăŚăŻăăăăŤć˘ăžăŁăăééăăăăăăă¨ă§ăéăĺžăăăăłăăŽä˝ç˝Žăĺ¤ăăăăăă¤ăăłăăăšăăăăžăăćçľçăŞĺćăŻăăłăăă´ăźăŤĺ°çšăŤĺ°éăăćçšăŽććéăŽĺ¤ĺŻĄă§ćąşăžăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_lifeGame1"><br/>
</center>
<br/>
<p>
ăăŽäźç¤žăŽäşşçă˛ăźă ăŽé˘ç˝ăă¨ăăăŻăăŤăźăŹăăăŽĺşăçŽăŽĺ¤§ăăăă´ăźăŤăžă§ăŽăăšăŽć°ăă¤ăăłăăăšăŽé
罎ăă˛ă¨ă¤ă˛ă¨ă¤ăăăąăźă¸ăă¨ăŤç°ăŞăă¨ăăă§ăăăăăăŻăąăźăšăŤć¸ăăăŚăăăăăăčŞăăă¨ă§ç˘şčŞăăăă¨ăă§ăăžăăăéăćăĺžăăăäşşçă˛ăźă ăé¸ăłăă太éĺăŻăĺžăăéăŽćĺž
ĺ¤ăä¸çŞĺ¤§ăăăăŽă財ăăăăŁăŚăăžăăăăă§ăăŞăăŻă太éĺăŽă˛ăźă é¸ăłăćäźăăă¨ăŤăăžăăă
</p>
<p>
ăŤăźăŹăăăŻăĺĺ¨ă <var>X</var> çĺăŤĺşĺăăăăăăă㍠<var>V<sub>1</sub></var>ă<var>V<sub>2</sub></var>ă...ă<var>V<sub>X</sub></var> ă¨ăăĺ¤ăč¨ĺ
ĽăăăŚăăă¨ăăžăăăăźăăŤăŻă0 çŞă1 çŞă...ă<var>Y</var> çŞă¨çŞĺˇăăľăăăăăšçŽăăăăé çŞăŤă¤ăŞăăŁăŚăăžăăăăšçŽăŽä¸ăŤăŻăă¤ăăłăăăšă¨ĺźă°ăăçšĺĽăŞăăšă <var>Z</var> ĺăăăăăăŤĺ°éăăă¨çšĺĽăŞĺä˝ăčĄăăžăăă¤ăăłăăăšăŽăăšçŽăŽçŞĺˇăŻ <var>N<sub>i</sub></var> ă§ä¸ăăăăžăăă¤ăăłăăăšăŤăŻ 1 ~ 3 ăŽç¨ŽéĄ (<var>E<sub>i</sub></var>) ăăăăăăăă揥ăŽĺä˝ăčĄăăăžăă
</p>
<center>
<table>
<tr>
<th width="80"> ç¨ŽéĄ (<var>E<sub>i</sub></var>)</th><th width="340"> çšĺĽĺä˝ </th><th width="120"> ĺ¤ (<var>A<sub>i</sub></var>) ăŽçŻĺ˛</th>
</tr>
<tr>
<td> 1 </td><td> ćĺŽăŽĺ¤ <var>A<sub>i</sub></var> ă ăĺ
ă¸é˛ă </td><td> 1~10 </td>
</tr>
<tr>
<td> 2 </td><td> ćĺŽăŽĺ¤ <var>A<sub>i</sub></var> ăŽééĄăĺžă </td><td> 1~100</td>
</tr>
<tr>
<td> 3 </td><td> ćĺŽăŽĺ¤ <var>A<sub>i</sub></var> ăŽééĄăćŻćă </td><td> 1~100</td>
</tr>
</table>
</center>
<br/>
<p>
ćĺăŽććé㯠0 ĺă§ă珏 0 ăăšçŽăăăšăżăźăăă珏 <var>Y</var> ăăšçŽăŤĺ°éăăă¨ă´ăźăŤă¨ăŞăăžăăă´ăźăŤăčśăăĺ ´ĺăă´ăźăŤă¨čŚăŞăăžăăăšăżăźăă¨ă´ăźăŤăŤă¤ăăłăăŻçĄăă1 ăăšăŤč¤ć°ăŽă¤ăăłăăéăŞăăă¨ăŻăăăžăăăă¤ăăłăăŤăăŁăŚé˛ăă ĺ
ăŽăăšăŽă¤ăăłăăŻçĄčŚăăžăăććéă 0 ĺăăĺ°ăŞăăŞăĺ ´ĺ㯠0 ĺă¨ăăžăă
</p>
<p>
äžăă°ăăăäşşçă˛ăźă ă§ĺžăăăăéăŽćĺž
ĺ¤ăŻäťĽä¸ăŽăăăŤč¨çŽă§ăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_lifeGame2"><br/>
</center>
<br/>
<p>
ăăŽäžă§ăŻăăšăżăźăăă¤ăăłăăăš(100 ĺĺ
Ľć) ăă´ăźăŤăŽ 3 ă¤ăŽăăšă¨ă1 ă 2 ăĺşăăŤăźăŹăăăăăŞăäşşçă˛ăźă ă襨ăăăŚăăžăăăžăă1 ĺçŽăŤăŤăźăŹăăăĺăăćă1 ăĺşăă°ă¤ăăłăăăšăŤĺ°éăăććé㯠100 ĺăŤăŞăăžăăä¸ćšă2 ăĺşăĺ ´ĺăŻă´ăźăŤăŤĺ°éăăććé㯠0 ĺăŽăžăžă§ăăăăăăŻăŠăĄăă 2 ĺ㎠1 ăŽç˘şçă§čľˇăăăžăă
</p>
<p>
ăăăŤă1 ĺçŽă§ă¤ăăłăăăšăŤĺ°éăăĺ ´ĺ㯠2 ĺçŽăŽăŤăźăŹăăăĺăăžăăăăŠăŽĺ¤ăĺşăŚăă´ăźăŤăŤĺ°éăăććéăŻăŠăŽĺ ´ĺă 100 ĺă§ăă
</p>
<p>
ăăŽăăăŤăĺ
¨é¨ă§ 3 éăăŽă´ăźăŤăŽäťćšăăăăžăăă´ăźăŤăăćçšăŽććéăŤççŽăăă¨ă0 ĺăŤăŞăĺ ´ĺă 1 éăă§ăăŽç˘şç㯠2 ĺ㎠1ă100 ĺăŤăŞăĺ ´ĺă 2 éăă§ăăŽç˘şçă 4 ĺ㎠1 ă§ăăăăŽĺ ´ĺăă´ăźăŤă§ăŽććéăŽćĺž
ĺ¤ăŻăă´ăźăŤăŽäťćšăă¨ăŽ (ććé × ăăŽç˘şç) ăčśłăăĺ¤ă§ăăăăăŽäşşçă˛ăźă ăŽćĺž
ĺ¤ăŻ 50 ĺăŤăŞăăžăă
</p>
<p>
ăŤăźăŹăăăŽć
ĺ ąă¨ăăźăăŽć
ĺ ąăĺ
Ľĺă¨ăăă´ăźăŤćăŽććéăŽćĺž
ĺ¤ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăżăŁă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>X</var> <var>Y</var> <var>Z</var>
<var>V<sub>1</sub></var> <var>V<sub>2</sub></var> ... <var>V<sub>X</sub></var>
<var>N<sub>1</sub></var> <var>E<sub>1</sub></var> <var>A<sub>1</sub></var>
<var>N<sub>2</sub></var> <var>E<sub>2</sub></var> <var>A<sub>2</sub></var>
:
<var>N<sub>Z</sub></var> <var>E<sub>Z</sub></var> <var>A<sub>Z</sub></var>
</pre>
<p>
<var>X</var> (1 ≤ <var>X</var> ≤ 4)ă<var>V<sub>i</sub></var> (1 ≤ <var>V<sub>i</sub></var> ≤ 10)ă<var>Y</var> (1 ≤ <var>Y</var> ≤ 50)ă<var>N<sub>i</sub></var> (1 ≤ <var>N<sub>i</sub></var> ≤ <var>Y</var>-1)ă<var>Z</var> (0 ≤ <var>Z</var> ≤ <var>Y</var>-1)ă<var>E<sub>i</sub></var> (1 ≤ <var>E<sub>i</sub></var> ≤ 3)ă <var>A<sub>i</sub></var> (1 ≤ <var>A<sub>i</sub></var> ≤ 100) ăŻć´ć°ă§ä¸ăăăăžăă
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăćçľçăŞććéăŽćĺž
ĺ¤ăďźčĄăŤĺşĺăăžăăăŞăăććéăŽćĺž
ĺ¤ăŻĺ°ć°çšäťĽä¸ĺăć¨ăŚăŽć´ć°ă§ĺşĺăăŚăă ăăă
</p>
<H2>Sample Input</H2>
<pre>
1 2 0
1
1 2 1
1
1 2 100
1 2 1
2
1 2 100
2 2 1
1 2
1 2 100
4 5 3
1 2 3 4
1 1 2
2 2 100
4 3 60
0 0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
0
100
0
50
20
</pre>
| [
[
"1 2 0\n1\n1 2 1\n1\n1 2 100\n1 2 1\n2\n1 2 100\n2 2 1\n1 2\n1 2 100\n4 5 3\n1 2 3 4\n1 1 2\n2 2 100\n4 3 60\n0 0 0\n",
"1 2 0\n1\n1 2 1\n1\n1 2 100\n1 2 1\n2\n1 2 100\n2 2 1\n1 2\n1 2 100\n4 5 3\n1 2 3 4\n1 1 2\n2 2 100\n4 3 60\n0 0 0\n"
]
] |
p00233 | Book Arrangement |
<H1>ĺłć¸ć´ç</H1>
<p>
ć°ăŽčĄ¨ăăćšăŤăŻč˛ă
ăŞç¨ŽéĄăăăăç§ăăĄăćŽćŽľä˝żăŁăŚăă 10 é˛ć°ăŻä¸ă¤ăŽäťŁčĄ¨çăŞăăŽă§ăăăăăžăăăăłăłăăĽăźăżé˘éŁăŽçĽčăăăäşşăŤăŻă2 é˛ć°ă16 é˛ć°ăăăăŻă¨ăŚă躍čżăŞăăŽă§ăă
</p>
<p>
N ăăăŻĺ¸ć¸čłć źăć´ťăăăŚĺ¸ć¸ăŽäťäşăŤĺ°ąăăžăăăćĺăŽäťäşăŻĺłć¸ć´çă§ăăăăŽĺłć¸é¤¨ă§ăŻăä¸ĺăă¨ăŤä¸č˛ŤăăŚçŞĺˇăä¸ăăăăŚăăăăăăŤĺžăŁăŚćŹăć´çăăŚăăžăă
</p>
<p>
ăăŽĺłć¸é¤¨ă§ăŻćŹăŽçŞĺˇăăă¤ăăšĺé˛ć°ă§čĄ¨ăăă¨ăŤăŞăŁăŚăăžăă
</p>
<p>
ăă¤ăăšĺé˛ć°ăŻă<var>a<sub>n</sub>a<sub>n−1</sub>a<sub>n−2</sub></var>...<var>a<sub>2</sub>a<sub>1</sub>a<sub>0</sub></var> (ĺ<var>a<sub>i</sub></var> 㯠0~9 ăŽć°ĺ) ă¨čĄ¨č¨ăăćšćłă§ăăăăăŽć°ăŻćŹĄăŽć°ă襨ăăžăă
</p>
<p>
<var>a<sub>n</sub>×(−10)<sup>n</sup> + a<sub>n−1</sub>×(−10)<sup>n−1</sup> +</var> ... <var>+ a<sub>2</sub>×(−10)<sup>2</sup> + a<sub>1</sub>×(−10)<sup>1</sup> + a<sub>0</sub>×(−10)<sup>0</sup></var>
</p>
<p>
ăă¨ăă°ăăă¤ăăšĺé˛ć°ăŽ 2156 ăŻă䝼ä¸ăŽă¨ăăĺé˛ć°ăŽ-1944 ăŤĺŻžĺżăăŚăăžăă
</p>
<p>
2×(-10)<sup>3</sup> + 1×(-10)<sup>2</sup> + 5×(-10)<sup>1</sup> + 6×(-10)<sup>0</sup> = <br>
2×(-1000) + 1×(100) + 5×(-10) + 6×(1) = <br>
-2000 + 100 - 50 + 6 = -1944
</p>
<p>
ĺé˛ć°ăŽçŞĺˇăăă¤ăăšĺé˛ć°ăŤç´ăăŽăŻĺ¤§ĺ¤ăŞăŽă§ăN ăăăŻĺ¤§ĺ¤ä¸čŞçąăŞćăăăăŚăăžăă
</p>
<p>
ćŹăŽçŞĺˇăĺ
Ľĺă¨ăă ăăŽçŞĺˇăŽăă¤ăăšĺé˛ć°čĄ¨č¨ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăă¨ăăŚăćŹăŽçŞĺˇă襨ăć´ć° <var>A</var> (-2<sup>31</sup> ≤ <var>A</var> < 2<sup>31</sup>) ăďźčĄăŤä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 1200 ăčś
ăăžăăă
</p>
<H2>Output</H2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăçŞĺˇăŽăă¤ăăšĺé˛ć°čĄ¨č¨ăďźčĄăŤĺşĺăăžăă
</p>
<H2>Sample Input</H2>
<pre>
9
10
-10
-1944
-305432133
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9
190
10
2156
1715573947
</pre>
| [
[
"9\n10\n-10\n-1944\n-305432133\n0\n",
"9\n10\n-10\n-1944\n-305432133\n0\n"
]
] |
p00234 | Aizu Buried Treasure |
<H1>äźć´ĽăŽĺčľé</H1>
<p>
äźć´ĽăŤăŻĺ¤ăăăäźăăĺčľéăŽäźčŞŹăăăăžăăăăŞăăŻăéăŤĺčľéăĺăžăŁăŚăăĺ ´ćăçŞăć˘ăăžăăăĺčľéăĺăžăŁăŚăă桹ăăćăé˛ăăĺ°ĺą¤ăŽçść
ăĺăăŁăŚăăăŽă§ăçśżĺŻăŤč¨çťăçŤăŚăă°ćĺ°č˛ťç¨ă§ĺčľéăžă§ĺ°éăăăă¨ăă§ăăžăăăăă§ăăŞăăŻăĺ°ĺą¤ăŽçść
ăčŞăżĺăŁăŚĺčľéăŽĺăžăŁăŚăă桹ăăžă§ćĺ°č˛ťç¨ă§ĺ°éăăăŤăźăăçŽĺşăăăăă°ăŠă ăä˝ćăăăă¨ăŤăăžăăă
</p>
<p>ĺ°ĺą¤ăŽçść
㯠2 揥ĺ
ć źĺçśăŤé
罎ăăăăťăŤă§čĄ¨ăăăăĺăťăŤăŽä˝ç˝ŽăŻĺş§ć¨ (x,y) ă§čĄ¨ăăăžăă塌ä¸ă (1,1) ă¨ăăx 座ć¨ăŻĺłăŤčĄăăŤă¤ăăŚĺ¤§ăăăŞăăy 座ć¨ăŻä¸ăŤćˇąăăŞăăŤă¤ăăŚĺ¤§ăăăŞăăăŽă¨ăăžăăăăŞă㯠y 座ć¨ăŽä¸çŞĺ°ăăăťăŤăŽăăĄä¸ă¤ăé¸ăă§ăăăăćăĺ§ăăy 座ć¨ăŽä¸çŞĺ¤§ăăăťăŤăŽä¸ă¤ăžă§ćăé˛ăăžăăĺ°ĺą¤ăŤăŻäťĽä¸ăŽ 2 税éĄăŽăťăŤăăăăžăďź
</p>
<ol>
<li>ĺăŽčŠ°ăžăŁăăťăŤăćăăŽăŤăăťăŤăă¨ăŤćąşăăăă貝ç¨ăăăăă</li>
<li>é
¸ç´ ăŽăăžăŁăăťăŤăćăĺż
čŚăŻăŞăăăťăŤăă¨ăŤćąşăžăŁăéăŽé
¸ç´ ăčŁçľŚă§ăăăä¸ĺşŚé
¸ç´ ăčŁçľŚăăăťăŤăŽé
¸ç´ ăŻăŞăăŞăăĺ庌ăŽčŁçľŚăŻă§ăăŞăăăžăăăăŽăťăŤăŤčžżăă¤ăăăĺż
ăé
¸ç´ ăŽčŁçľŚăăăŞăăă°ăŞăăŞăă</li>
</ol>
<p>
ăăăťăŤăăćăăă¨ăă§ăăăŽăŻĺˇŚĺłă¨ä¸ćšĺăŽăťăŤăŽăżă§ăă
ä¸ĺşŚćăŁăăťăŤă塌ĺłăŤç§ťĺăăăă¨ăŻă§ăăžăăăä¸ăŤç§ťĺăăăă¨ăŻă§ăăžăăă
</p>
<p>çşćăŤăăăŁăŚăŻăé
¸ç´ ăăłăăćşĺ¸ŻăăŞăăă°ăŞăăžăăăé
¸ç´ ăăłăăŽćŽéă 0 ăŤăŞăŁăçŹéă秝ĺăçşćăé
¸ç´ ăŽčŁçľŚăă§ăăŞăăŞăăžăăćŽéăŻăťăŤă秝ĺăăăăłăŤ 1 ć¸ăăžăăé
¸ç´ ăăłăăŽćŽéă 0 ă§ĺčľéăŽĺăžăŁăŚăă桹ăăžă§ĺ°éăăŚăăĺ°éăăă¨ăżăŞăăăžăăăăžăăé
¸ç´ ăŽăăžăŁăăťăŤă§ăŻé
¸ç´ ăčŁçľŚăăăă¨ăă§ăăžăăă厚éăčś
ăăĺăŻĺťćŁăăăžăă</p>
<p>
ĺ°ĺą¤ăŽăľă¤ăş ăçşć貝ç¨ăé
¸ç´ ăăłăăŽĺŽšéăĺćçść
ă§ćăŁăŚăăé
¸ç´ ăŽéăĺ°ĺą¤ăŽć
ĺ ąăĺ
Ľĺă¨ăăä¸çŞćˇąăăťăŤăžă§ăăŠăă¤ăăăăŽćĺ°č˛ťç¨ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăćĺ°č˛ťç¨ăçşć貝ç¨ăčś
ăăŚăăžăĺ ´ĺăăăŠăŽăăăŤćăé˛ăăŚăĺčľéăŤăăŠăă¤ăăŞăĺ ´ĺăŻâNAâă¨ĺşĺăăŚăă ăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_aizuTreasure">
</center>
<br>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăă
ĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>W</var> <var>H</var>
<var>f</var> <var>m</var> <var>o</var>
<var>c<sub>1,1</sub></var> <var>c<sub>2,1</sub></var> ... <var>c<sub>W,1</sub></var>
<var>c<sub>1,2</sub></var> <var>c<sub>2,2</sub></var> ... <var>c<sub>W,2</sub></var>
...
<var>c<sub>1,H</sub></var> <var>c<sub>2,H</sub></var> ... <var>c<sub>W,H</sub></var>
</pre>
<p>
ďźčĄçŽăŤĺ°ĺą¤ăŽć¨ŞćšĺăŽăľă¤ăş <var>W</var>, 縌ćšĺăŽăľă¤ăş <var>H</var> (3 ≤ <var>W</var>, <var>H</var> ≤ 10) ăä¸ăăăăă ďźčĄçŽăŤăăŞăăŽçşć貝ç¨ă襨ăć´ć° <var>f</var> (1 ≤ <var>f</var> ≤ 10000)ăé
¸ç´ ăăłăăŽĺŽšéă襨ăć´ć° <var>m</var> (3 ≤ <var>m</var> ≤ 50)ăĺćçść
ă§ćăŁăŚăăé
¸ç´ ăŽéă襨ăć´ć° <var>o</var> (o ≤ <var>m</var>) ăä¸ăăăăă
</p>
<p>çśă <var>H</var> čĄăŤĺ°ĺą¤ăŽć
ĺ ą <var>c<sub>i,j</sub></var> ăä¸ăăăăă<var>c<sub>i,j</sub></var> ăŻăĺş§ć¨ (<var>i</var>, <var>j</var>) ăŤĺŻžăăăťăŤăŽć
ĺ ąă襨ăă䝼ä¸ăŽĺ˝˘ĺźă§ä¸ăăăăďź<br>
č˛ ăŽĺ¤ăŽĺ ´ĺăĺăŽčŠ°ăžăŁăăťăŤă§ăĺ¤ăŻč˛ťç¨ă襨ă<br>
ćŁăŽĺ¤ăŽĺ ´ĺăé
¸ç´ ăŽăăžăŁăăťăŤă§ăĺ¤ăŻé
¸ç´ ăŽéă襨ă<br>
ăă ăăé
¸ç´ ăŽăăžăŁăăťăŤăŻ 50 çŽć䝼ĺ
ă§ăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ50 ăčś
ăăŞăă
</p>
<H2>Output</H2>
<p>
ăăźăżăťăăăă¨ăŤăćĺ°č˛ťç¨ăžă㯠NA ă1čĄăŤĺşĺăăă
</p>
<H2>Sample Input</H2>
<pre>
3 3
100 10 10
-100 -20 -100
-100 -20 -100
-100 -20 -100
3 3
100 10 10
-100 -20 -100
-100 -20 -20
-100 -60 -20
3 3
100 10 3
-100 -20 -100
-20 -20 -20
-20 -100 -20
3 3
100 3 3
-100 -20 -30
-100 -20 2
-100 -20 -20
4 5
1500 5 4
-10 -380 -250 -250
-90 2 -80 8
-250 -130 -330 -120
-120 -40 -50 -20
-250 -10 -20 -150
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
60
80
NA
50
390
</pre>
| [
[
"3 3\n100 10 10\n-100 -20 -100\n-100 -20 -100\n-100 -20 -100\n3 3\n100 10 10\n-100 -20 -100\n-100 -20 -20\n-100 -60 -20\n3 3\n100 10 3\n-100 -20 -100\n-20 -20 -20\n-20 -100 -20\n3 3\n100 3 3\n-100 -20 -30\n-100 -20 2\n-100 -20 -20\n4 5\n1500 5 4\n-10 -380 -250 -250\n-90 2 -80 8\n-250 -130 -330 -120\n-120 -40 -50 -20\n-250 -10 -20 -150\n0 0\n",
"3 3\n100 10 10\n-100 -20 -100\n-100 -20 -100\n-100 -20 -100\n3 3\n100 10 10\n-100 -20 -100\n-100 -20 -20\n-100 -60 -20\n3 3\n100 10 3\n-100 -20 -100\n-20 -20 -20\n-20 -100 -20\n3 3\n100 3 3\n-100 -20 -30\n-100 -20 2\n-100 -20 -20\n4 5\n1500 5 4\n-10 -380 -250 -250\n-90 2 -80 8\n-250 -130 -330 -120\n-120 -40 -50 -20\n-250 -10 -20 -150\n0 0\n"
]
] |
p00235 | Sergeant Rian |
<H1>ăľăźă¸ă§ăłăăťăŠă¤ă˘ăł</H1>
<p>
ăăŠă¤ă˘ăłčťćšăćăăă¨ăăć䝤ăŽăă¨ăă˘ă¤ă
čťăŽćĺşé¨éăŻăă¤ăăŞăźăŽć°´ä¸é˝ĺ¸ă§ćľčťă¨ćżăăćŚéăçš°ăĺşăăŚăăžăăă彟ăăŻçĄäşăŤčťćšă¨ĺćľăăžăăăăćľăŽćŚčťăĺ¤ăăćĺşăăŞăĺźăšăăŤăăžăăăăăă§ă彟ăăŻćľăŽćŚčťă桡䚹ăăăăăăé˝ĺ¸ăŤăăćŠăĺ
¨ăŚçç ´ăăă¨ăăä˝ćŚăĺŽčĄăăăă¨ăŤăăžăăă
</p>
<p>
ä˝ćŚăŻăăăŤĺ¸äť¤é¨ăŤäźăăăăćĺşăăŞăŽćşĺăé˛ăăăăžăăăćĺşăăŞăéŁă°ăăăăŤăŻăăă¤ćŠăĺ
¨ăŚçç ´ăăăăăäşć¸ŹăăŞăăă°ăŞăăžăăăčťăŽăăă°ăŠăă§ăăăăŞăăŽäťťĺăŻăćĺşé¨éăĺ
¨ăŚăŽćŠăŽçç ´ăŤĺż
čŚăŞćéăč¨çŽăăăă¨ă§ăă
</p>
<p>
ć°´ä¸é˝ĺ¸ăŻ <var>N</var> ĺăŽĺłśă§ć§ćăăăŚăăăĺłśă¨ĺłśă¨ăŽéăŤăŻćŠăăăăŁăŚăăžăăăăšăŚăŽĺłśăŻăăŞăźçśăŤçšăăŁăŚăăžă(ä¸ĺłĺç
§) ăăăĺłśăăăăĺłśă¸ăŽçľčˇŻăŻăä¸éăă ăĺĺ¨ăăžăăĺćŠă渥ăăŤăŻăćŠăă¨ăŤćąşăăăăćéăăăăăăŠăĄăăŽćšĺăŤăăăŽćéă§ćŠă渥ăăă¨ăĺŻč˝ă§ăă
</p>
<p>
ćĺşé¨éăŻăăźăăŞăŠć°´ä¸ă秝ĺăăć掾ăćăŁăŚăăŞăăŽă§ĺłśă¨ĺłśăŽéă秝ĺăăăŤăŻćŠăéăäťăăăžăăăćĺşé¨éăŻăăăŽćăăĺłśăŤéŁćĽăăŚăăćŠăŽăăĄăĺż
čŚăŞăăŽăä¸çŹă§çç ´ăăăă¨ăă§ăăžăăćĺşé¨éăĺ
¨ăŚăŽćŠăçç ´ăăăŽăŤĺż
čŚăŞćĺ°ăŽćéăŻăăăă§ăăăăăăă ăăĺłśăŽä¸ă§ăŽç§ťĺćéăŻčăăžăăă
</p>
<p>
ĺłśăŽć°ăăăăăăŽćŠć
ĺ ąăĺ
Ľĺă¨ăăćŠăĺ
¨ăŚçç ´ăăăŽăŤĺż
čŚăŞćĺ°ăŽćéăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăĺłśăŻăăăă 1 ăă <var>N</var> ăŽçŞĺˇă§čĄ¨ăăăžăăćŠăŻ <var>N</var>-1 ćŹăăăžăăćŠć
ĺ ąăŻăăăŽćŠăéŁćĽăăŚăăäşă¤ăŽĺłśăŽçŞĺˇ(<var>a</var>, <var>b</var>)ă¨ăăăŽćŠă渥ăăŽăŤĺż
čŚăŞćé <var>t</var> ă§ć§ćăăăžăăćĺşé¨éăŻĺłśçŞĺˇ 1 ăŽĺłśăăăšăżăźăăăăăŽă¨ăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_sergeant">
</center>
<br>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var>
<var>a<sub>1</sub></var> <var>b<sub>1</sub></var> <var>t<sub>1</sub></var>
<var>a<sub>2</sub></var> <var>b<sub>2</sub></var> <var>t<sub>2</sub></var>
:
<var>a<sub>N-1</sub></var> <var>b<sub>N-1</sub></var> <var>t<sub>N-1</sub></var>
</pre>
<p>
ĺ
ĽĺăŻăăšăŚć´ć°ă§ä¸ăăăăă1 čĄçŽăŤĺłśăŽć° <var>N</var> (2 ≤ <var>N</var> ≤ 20) ăä¸ăăăăă
</p>
<p>
çśă <var>N</var>-1 čĄăŤ <var>i</var> çŞçŽăŽćŠăŽć
ĺ ąăä¸ăăăăă <var>a<sub>i</sub></var>, <var>b<sub>i</sub></var>, <var>t<sub>i</sub></var> (1 ≤ <var>t<sub>i</sub></var> ≤ 500) ăŻă<var>i</var> çŞçŽăŽćŠăéăŁăŚĺłś <var>a<sub>i</sub></var> ă¨ĺłś <var>b<sub>i</sub></var> ăŽéăćé <var>t<sub>i</sub></var> ă§ç§ťĺă§ăăăă¨ă襨ăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăŞăă
</p>
<H2>Output</H2>
<p>
ăăźăżăťăăăă¨ăŤăćŠăĺ
¨ăŚçç ´ăăăŽăŤĺż
čŚăŞćĺ°ăŽćéă1čĄăŤĺşĺăăă
</p>
<H2>Sample Input</H2>
<pre>
7
1 2 5
2 3 2
3 4 3
2 5 3
5 6 3
5 7 8
0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
12
</pre>
| [
[
"7\n1 2 5\n2 3 2\n3 4 3\n2 5 3\n5 6 3\n5 7 8\n0\n",
"7\n1 2 5\n2 3 2\n3 4 3\n2 5 3\n5 6 3\n5 7 8\n0\n"
]
] |
p00236 | Alien Messages |
<H1>ĺŽĺŽäşşăŽăĄăăťăźă¸</H1>
<p>
ĺŽĺŽäşş Mr.X ăŻĺ°çă¸ăŽćĽćč¨ĺżľă¨ăăŚăĺ°çäşşăŤĺăăŚăŽăĄăăťăźă¸ăćŽăăžăăă Mr.X ăăĄăăťăźă¸ăćŽăĺ ´ćăŤé¸ăă ăŽăŻĺ¤äťŁéşčˇĄă¨ăăŚćĺăŞ"ăăăłăłéşčˇĄ"ă§ăăă ăăăŻăăăăăŞĺ¤§ăăăŽç˘ç¤ăŽăăšçŽăŤăĺĽćăŞçłĺăçĄé ä˝ăŤé
罎ăăăŚăăä¸ćč°ăŞĺ ´ćă§ăăă
</p>
<p>
Mr.X ăŻăăĄăăťăźă¸ă¨ăăŚăçłĺă罎ăăăŚăăŞăĺ
¨ăŚăŽăăšçŽăä¸ĺşŚă ăéăăĺä¸ăŽéć˛çˇăćăăžăăăMr.X ăŻă¨ăŚă賢ăăăăŽăăăŞéć˛çˇăćăăă¨ăĺŻč˝ăŞç˘ç¤ă§ăăă°ĺż
ăéć˛çˇăćăăăĄăăťăźă¸ăćŽăăžăăăăăăăçłĺăŽé
罎ăŤăăŁăŚăŻăéć˛çˇăćăăă¨ăä¸ĺŻč˝ăŞç˘ç¤ăăăăăăŽĺ ´ĺăŻăĄăăťăźă¸ăćŽăăžăăă§ăăă ĺł1ăŽç˘ç¤ăŤćăăăŚăăéć˛çˇăŻăĺ
¨ăŚăŽçŠşăăŚăăăăšçŽăä¸ĺşŚă ăéăŁăŚăăžăăMr.X ăŻăăŽăăăŞéć˛çˇăăĄăăťăźă¸ă¨ăăŚćŽăăžăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_UFOMessage1"><br>
ĺł1
</center>
<br>
<p>
Mr.X ăŻăĺł2ăŽç˘ç¤ăŤćăăăŚăăăăăŞéć˛çˇăŻćăăžăăă§ăăă
</p>
<center>
<table>
<tr>
<td>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_UFOMessage2" width="160">
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_UFOMessage3" width="160">
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_UFOMessage4" width="160">
</td>
</tr></table><br>
ĺł2<br>
</center>
<p>
ĺžăŤ Mr.X ăŽăĄăăťăźă¸ăŻăĺ¤äťŁéşčˇĄă¨čŚäşăŤčŞżĺăăĺŽĺŽäşşăŽçžă¨ăăŚăĺ°çäşşăŤĺ¤˘ă¨ăăăłăä¸ăăäźčŞŹă¨ăŞăăžăăăăăăăéˇĺš´ăŤć¸Ąă風ĺăŤăăŁăŚăĄăăťăźă¸ăŻćśăăŚăăžăăäźčŞŹă ăăćŽăăžăăă
</p>
<!--
<p>
ăăăłăłéşčˇĄăŽčżăăŤä˝ăă§ăăăăŞăăŻăMr.X ăćŽăăăĄăăťăźă¸ă塥ăăă˘ăźăäźçťăăăă¨čăăŚăăăéşčˇĄăŤăăăŠăŽç˘ç¤ăŤ Mr.X ăăĄăăťăźă¸ăćŽăăăăçĽăĺż
čŚăçăăžăăă
</p>
-->
<p>
ç˘ç¤ăŽć
ĺ ąăĺ
Ľĺă¨ăăMr.X ăăăŽç˘ç¤ä¸ăŤăĄăăťăźă¸ăćŽăăĺ ´ĺ㯠Yes ă¨ăćŽăăŞăăŁăĺ ´ĺ㯠No ă¨ĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăĺ
¨ăŚăŽăăšăŤçłĺăé
罎ăăăŚăăĺ ´ĺăŻăNo ă¨ĺşĺăăăă¨ă¨ăăžăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>W</var> <var>H</var>
<var>c<sub>1,1</sub></var> <var>c<sub>1,2</sub></var> ... <var>c<sub>1,W</sub></var>
<var>c<sub>2,1</sub></var> <var>c<sub>2,2</sub></var> ... <var>c<sub>2,W</sub></var>
:
<var>c<sub>H,1</sub></var> <var>c<sub>H,2</sub></var> ... <var>c<sub>H,W</sub></var>
</pre>
<p>
1 čĄçŽăŤç˘ç¤ăŽć¨ŞćšĺăŤä¸ŚăśăăšçŽăŽć° <var>W</var>, 縌ćšĺăŤä¸ŚăśăăšçŽăŽć° <var>H</var> (1 ≤ <var>W, H</var> ≤ 7) ăä¸ăăăăă
</p>
<p>
çśă <var>H</var> čĄăŤç˘ç¤ăŽçść
ăä¸ăăăăă<var>c<sub>i,j</sub></var> ăŻç˘ç¤ăŽ <var>i</var> čĄçŽăŽĺˇŚăă <var>j</var> çŞçŽăŽăăšçŽă襨ăć´ć°ă§ăăă0 ăŽă¨ăä˝ă罎ăăăŚăăŞăăăšçŽă1 ăŽă¨ăçłĺă罎ăăăŚăăăăšçŽă襨ăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 1000 ăčś
ăăŞăă
</p>
<H2>Output</H2>
<p>
ăăźăżăťăăăă¨ăŤăYes ăžă㯠No ăďźčĄăŤĺşĺăăă
</p>
<H2>Sample Input</H2>
<pre>
5 4
0 0 0 0 0
0 1 1 0 0
0 0 1 0 1
1 0 0 0 1
5 4
0 0 0 0 0
0 1 1 0 0
0 0 0 0 1
1 0 0 0 1
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
Yes
No
</pre>
| [
[
"5 4\n0 0 0 0 0\n0 1 1 0 0\n0 0 1 0 1\n1 0 0 0 1\n5 4\n0 0 0 0 0\n0 1 1 0 0\n0 0 0 0 1\n1 0 0 0 1\n0 0\n",
"5 4\n0 0 0 0 0\n0 1 1 0 0\n0 0 1 0 1\n1 0 0 0 1\n5 4\n0 0 0 0 0\n0 1 1 0 0\n0 0 0 0 1\n1 0 0 0 1\n0 0\n"
]
] |
p00237 | The Last Door |
<H1>ćĺžăŽć</H1>
<p>
ç§ĺ˘ăŽĺ°"ăăŠăăłăĺ°ćš"<br>
ăăŽĺĽĽćˇąăć´çŞăŤç ăéťéăŽäźčŞŹăćąăăć˘ć¤ĺŽśăăă¨ăă¤ăŻăŻć§ă
ăŞĺ°éŁăŤçŤăĄĺăăăžăăăăăăăăăŠăçăăćĺžăŽćăăăŽĺ
ăŤăŻĺ¤˘ăŤčŚăéťéăĺž
ăŁăŚăăžăă
</p>
<p>
ăăŽćăŤăŻĺ¤ć°ăŽä¸č§ĺ˝˘ăćăăăŚăăžăăă芌ăăŤăă¤ăŻăă㎠1 ă¤ăŤč§ŚăăŚăżăă¨ăăăŽä¸č§ĺ˝˘ăŻĺ
ăćžăĄăžăăăĺ
ăŻä¸č§ĺ˝˘ăŽĺşčžşăăĺç´ăŤé çšćšĺă¸éˇćšĺ˝˘ăćăăŞăă䟸ăłăŚăăăăăŽĺ
ăŤăăĺĽăŽä¸č§ĺ˝˘ăŤč§Śăăžăăăăăă¨ăĺ
ăŤč§Śăăä¸č§ĺ˝˘ăĺăăăăŤĺ
ăćžăĄăăăăçš°ăčżăăŚăăăžăăă
</p>
<p>
ćăŽä¸č§ĺ˝˘ăŻĺ
¨ăŚäşçčžşä¸č§ĺ˝˘(ćŁä¸č§ĺ˝˘ăŻĺŤăžăŞă)ă§ăăŠăăĺă大ăăă§ăăŠăăéăŞăăďźăă¤č§Śăăăă¨ăŞăďźăăžăăŠăăĺ
ăŻä¸ĺŽăŽčˇé˘ă ă䟸ăłăŚăăžăăăćĺžăŽä¸č§ĺ˝˘ăĺ
ăçľăăă¨ăăăăŤăŻä˝äşăăŞăăŁăăăŽăăăŞéăăăćťăŁăŚăăžăăă
</p>
<p>
ăăăŻčŞĺăŽčśłä¸ăŤĺĽĺŚăŞăĄăăťăźă¸ăčŚă¤ăăžăăă<br>
ăăăăżăŤč§ŚăăăšăăăăćąćŁăăăăŽćăŤč§Śăăă¨ăăăăŽćăŻćžăăăă ă
</p>
<p>
ăăă¨ăă¤ăŻăŻăăŽăĄăăťăźă¸ăŽćĺłăčăăŞăăă ä˝ĺşŚăä¸č§ĺ˝˘ăŤč§ŚăăŚăżăžăăăăŞăăŞăćăŻéăăžăăă ăăăăăăăçš°ăčżăăŚăăăăĄăŤăäşäşşăŻăĄăăťăźă¸ăŽćĺłăă ăă ăĺăăŁăŚăăžăăă<br>
ă"ăăăżăŤč§Śăăăšăăă"ă¨ăŻăćăŤč§Śăăĺć°ăŻćĺ°ă¨ăăăă¨ă<br>
ă§ăăă ăĺ°ăŞăĺć°ă§č§ŚăăŚăĺ
¨ăŚăŽä¸č§ĺ˝˘ăĺ
ăăăă°ăăăŁă¨ćăŻéăăŻăă !ă<br>
</p>
<p>
äžăă°ăćăŤăŻĺł 1 ăŽăăăŤč¤ć°ăŽäşçčžşä¸č§ĺ˝˘ăćăăăŚăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_cave1"><br>
ĺł 1
</center>
<br>
<p>
ćĺăŤĺˇŚä¸ăŽä¸č§ĺ˝˘ăŤč§Śăăă¨ăĺł 2 ăŤç¤şăăăăŤăăăŽä¸č§ĺ˝˘ăŽĺşčžşăăĺç´ăŤé çšćšĺă¸ĺ
ăćžăăăăăŽĺ
ă觌ăăä¸č§ĺ˝˘ă揥ă
ăŤĺ
ăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_cave2"><br>
ĺł 2
</center>
<br>
<p>
揥ăŤĺˇŚçŤŻăŽä¸č§ĺ˝˘ăŤč§Śăăă¨ăĺł 3 ăŤç¤şăăăăŤăĺ
¨ăŚăŽä¸č§ĺ˝˘ăĺ
ăăžăăăăŽćé ăĺ
¨ăŚăŽä¸č§ĺ˝˘ăĺ
ăăăăăăŽćĺ°ăŽćć°(2 ć)ă¨ăŞăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_cave3"><br>
<p>ĺł 3</p>
</center>
<p>
ăăăăăă¨ăă¤ăŻăćĺžăŽćăéăăćĺŠăăăăăă
</p>
<p>
ćăŤćăăăŚăăä¸č§ĺ˝˘ăŽĺć°ăĺ
ăŽäź¸ăłăéˇăăăăăăăŽä¸č§ĺ˝˘ăŽé çšăŽĺş§ć¨ăĺ
Ľĺă¨ăăĺ
¨ăŚăŽä¸č§ĺ˝˘ăĺ
ăăăăăăŤćăŤč§Śăăćĺ°ăŽĺć°ăĺşĺăăăăă°ăŠă ăä˝ćăăŚä¸ăăăĺ
ăŽäź¸ăłăéˇăăŻăĺşčžşăăăŽéˇăă§ăăăăŽă¨ăăžăăăžăăĺ
ăŻăăăćžă¤ä¸č§ĺ˝˘ăŽé çšăĺŤăăăăŞĺĺăŞéˇăăćăĄăžăă
</p>
<p>
ăŞăăăăŽĺéĄă解ăăŤăăăŁăŚăŻă2 çšăŽčˇé˘ă 0.01 䝼ä¸ăŽĺ ´ĺăŤăŻăĺä¸ăŽçšă¨ĺŚçăăžăăăžăă1 çšă¨ă˛ă¨ă¤ăŽç´çˇăŽčˇé˘ă 0.01 䝼ä¸ăŽĺ ´ĺăŤăŻăăăŽçšăŻăăŽç´çˇä¸ăŤăăă¨ăăŚĺŚçăăžăă
</p>
<H2>Input</H2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăă
</p>
<pre>
<var>n</var> <var>d</var>
<var>T<sub>1</sub></var>
<var>T<sub>2</sub></var>
:
<var>T<sub>n</sub></var>
</pre>
<p>
ďźčĄçŽăŤćăŤćăăăŚăăä¸č§ĺ˝˘ăŽĺć° <var>n</var> (1 ≤ <var>n</var> ≤ 100) ă¨ĺ
ăŽäź¸ăłăéˇăă襨ăć´ć° <var>d</var> (1 ≤ <var>d</var> ≤ 1000) ăä¸ăăăăă
</p>
<p>
çśă <var>n</var> čĄăŤĺä¸č§ĺ˝˘ăŽć
ĺ ą <var>T<sub>i</sub></var> ă䝼ä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>x1</var> <var>y1</var> <var>x2</var> <var>y2</var> <var>x3</var> <var>y3</var>
</pre>
<p>
ä¸č§ĺ˝˘ăŽďźă¤ăŽé çšăŽĺş§ć¨ăć´ć°ă§ä¸ăăăă(-1000 ≤ <var>x1</var>, <var>y1</var>, <var>x2</var>, <var>y2</var>, <var>x3</var>, <var>y3</var> ≤ 1000)ă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 20 ăčś
ăăŞăă
</p>
<H2>Output</H2>
<p>
ăăźăżăťăăăă¨ăŤăćăŤč§Śăăćĺ°ăŽĺć°ă1čĄăŤĺşĺăăă
</p>
<H2>Sample Input</H2>
<pre>
3 4
1 0 3 0 2 1
2 3 2 5 3 4
5 3 5 5 6 4
3 2
1 0 3 0 2 1
2 3 2 5 3 4
5 3 5 5 6 4
0 0
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1
3
</pre>
| [
[
"3 4\n1 0 3 0 2 1\n2 3 2 5 3 4\n5 3 5 5 6 4\n3 2\n1 0 3 0 2 1\n2 3 2 5 3 4\n5 3 5 5 6 4\n0 0\n",
"3 4\n1 0 3 0 2 1\n2 3 2 5 3 4\n5 3 5 5 6 4\n3 2\n1 0 3 0 2 1\n2 3 2 5 3 4\n5 3 5 5 6 4\n0 0\n"
]
] |
p00238 | Time to Study |
<!--
<p>
ä¸ĺşŚăŽéŁŻăăă˛ăźă 弽ăăŽă ăăĺăŻćăăăăă°ă˛ăźă ă°ăăăăŚăăžăăăă§ăăăă ăăĺăéŤć Ąďźĺš´çăăŻăŠăšăŻăăĺé¨ă˘ăźăăŤĺ
ĽăŁăŚăăžăăĺé¨ĺ埡ăăăăăăŤăŻăĺ˝çśă˛ăźă ă§éăšăćéăçăăŞăŁăŚăăžăăžăăăžăăŻ1ćĽăŤĺ埡ăăăćéăćąşăăŚăćŽăŁăćéăă˛ăźă ăŞăŠăŤä˝żăăă¨ăŤăăžăăăăă ăăĺăŻäťăžă§č¨çťăĺŽăăăăăăăăăžăăă§ăăăčŚăăăăăŞăăŻăă ăăĺăŽĺ埡ćéă玥çăăăăă°ăŠă ăć¸ăăă¨ăŤăăžăăă
</p>
1ćĽăŤăăăŞăăă°ăŞăăŞăĺ埡ăŽçŽć¨ćéătăĺ埡ăéĺ§ăăćĺťăsăçľäşăăćĺťăfă¨ăăăžăă
-->
<p>
ĺ埡ăéĺ§ăăćĺťă¨çľäşăăćĺťăŽć
ĺ ąăĺşăŤă1ćĽă§ĺ埡ăăćéăŽĺč¨ă <var>t</var> 䝼ä¸ă§ăăăăăă§ăăŻăăéăăŚăăŞăĺ ´ĺăŻčśłăăŞăćéăćąăăăăă°ăŠă ăä˝ćăăžăăćéăŻ1ćéă1ĺä˝ă¨ăăĺăç§ăŻčăăŞăăăŽă¨ăăžăăćĺťăŻ24ćé襨č¨ă§1ćéĺä˝ă§čĄ¨ăăžăă
</p>
<p>
1ćĽăŽĺ埡ăŽçŽć¨ćéă¨ăĺŽéăŤĺ埡ăăćéăŽć
ĺ ąďźĺ埡ăŽĺć° <var>n</var>ăăăăăăŽĺ埡ăŽéĺ§ćĺť <var>s</var> ă¨çľäşćĺť <var>f</var>ďźăĺ
Ľĺă¨ăăĺ埡ćéăŽĺč¨ăçŽć¨ăŤéăăŚăăăă調ăšăéăăŚăăă° "OK" ăăéăăŚăăŞăĺ ´ĺăŻčśłăăŞăćéăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăăăăăčĄăŁăĺ埡ćéăŻéč¤ăăžăăă
</p>
<center>
äžďź
<table style="border: 1px #000 solid" cellpadding="3" cellspacing="3">
<tr>
<td style="border: 1px #000 solid">çŽć¨ćé</td>
<td style="border: 1px #000 solid">ĺ埡ăăćé</td>
<td style="border: 1px #000 solid">ĺ¤ĺŽ</td>
</tr>
<tr>
<td style="border: 1px #000 solid">10ćé</td>
<td style="border: 1px #000 solid"> 6ćă11ć ďź 5ćé<br>
12ćă15ć ďź 3ćé<br>
18ćă22ć ďź 4ćé</td>
<td style="border: 1px #000 solid">OK</td>
</tr>
<tr>
<td style="border: 1px #000 solid">14ćé</td>
<td style="border: 1px #000 solid">6ćă11ć ďź 5ćé<br>
13ćă20ć ďź 7ćé<br></td>
<td style="border: 1px #000 solid">2ćéä¸čśł</td>
</tr>
</table>
</center>
<br>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>t</var>
<var>n</var>
<var>s<sub>1</sub></var> <var>f<sub>1</sub></var>
<var>s<sub>2</sub></var> <var>f<sub>2</sub></var>
:
<var>s<sub>n</sub></var> <var>f<sub>n</sub></var>
</pre>
<p>
ďźčĄçŽăŤďźćĽăŽçŽć¨ćé <var>t</var> (0 ≤ <var>t</var> ≤ 22)ă ďźčĄçŽăŤĺ埡ăŽĺć° <var>n</var> (1 ≤ <var>n</var> ≤ 10)ăä¸ăăăăžăăçśă <var>n</var> čĄăŤ <var>i</var> ĺçŽăŽĺ埡ăŽéĺ§ćĺť <var>s<sub>i</sub></var> ă¨çľäşćĺť <var>f</var> (6 ≤ <var>s<sub>i</sub></var>, <var>f<sub>i</sub></var> ≤ 22) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăOK ăžăăŻčśłăăŞăćéăďźčĄăŤĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
10
3
6 11
12 15
18 22
14
2
6 11
13 20
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
OK
2
</pre> | [
[
"10\n3\n6 11\n12 15\n18 22\n14\n2\n6 11\n13 20\n0\n",
"10\n3\n6 11\n12 15\n18 22\n14\n2\n6 11\n13 20\n0\n"
]
] |
p00239 | Calorie Counting |
<H1>ăŤăăŞăźč¨çŽ</H1>
<!--
<p>
夊éŤă錏čĽăăç§ăăăăăéŁăšçŠăçžĺłăăăŞăĺŁçŻă§ăăéŤć ĄçăŽăăăĺ
ăăăăŹăăčŞć¸ăŽăäžăŤă¤ăă¤ăăčĺăŤćă䟸ăłăŚăăžăăžăăăăŽăăăćčżä˝éăŻĺ˘ăăä¸ćšă§ăĺĽĺşˇçăŤăăăăăăăăžăăăăăăăŠăăăŚăç´ăăŤééŁăăăăăăŞăăăăĺăŻăăčĺăŽć é¤ç´ ăăŤăăŞăźăĺśéăăăĺ ´ĺăŤăéŁăšăăăčĺăăéŁăšăŚăăăăčĺă¨éŁăšăŚăŻăăăŞăăčĺăŤĺéĄăăăă¨ăŤăăžăăă
</p>
-->
<p>
éŁăšçŠăŤăŻ3大ć é¤ç´ ă¨ĺźă°ăăăăăăąă質ăăč質ăăçć°´ĺçŠăăŽďźă¤ăŽć é¤ç´ ăĺŤăžăăŚăăžăăďźgďźă°ăŠă ďźăăăăăăąă質ă¨çć°´ĺçŠăŻ 4 kcalďźăăăŤăăŞăźďźăč質㯠9 kcal ă¨č¨çŽăăăžăăăă¨ăă°ăä¸ăŽčĄ¨ăŤăăă¨çŞĺˇďźăŽăąăźăăŤăŻăżăłăăŻčłŞ 7 găč質 14 găçć°´ĺçŠ 47 g ăĺŤăžăăŚăăžăăăăăăă¨ăŤĺŤăžăăăŤăăŞăźăč¨çŽăăă¨ă4 × 7 + 9 × 14 + 4 × 47 = 342 kcal ă¨ăŞăăžăăăăŽäťăĺć§ăŤč¨çŽăăăŚăăžăă
</p>
<center>
<table style="border: 1px #000 solid" border="1" cellpadding="3" cellspacing="0">
<tr>
<td width="50" style="border: 1px #000 solid">çŞĺˇ</td><td width="160" style="border: 1px #000 solid">ĺĺ</td><td style="border: 1px #000 solid">ăăăąă質(g)</td><td style="border: 1px #000 solid">č質(g)</td><td style="border: 1px #000 solid">çć°´ĺçŠ(g)</td><td style="border: 1px #000 solid">ăŤăăŞăź(kcal)</td>
</tr>
<tr>
<td style="border: 1px #000 solid">1</td><td style="border: 1px #000 solid">ăąăźă</td><td style="border: 1px #000 solid">7</td><td style="border: 1px #000 solid">14</td><td style="border: 1px #000 solid">47</td><td style="border: 1px #000 solid">342</td>
</tr>
<tr>
<td style="border: 1px #000 solid">2</td><td style="border: 1px #000 solid">ăăăăăăăš</td><td style="border: 1px #000 solid">5</td><td style="border: 1px #000 solid">35</td><td style="border: 1px #000 solid">55</td><td style="border: 1px #000 solid">555</td>
</tr>
<tr>
<td style="border: 1px #000 solid">3</td><td style="border: 1px #000 solid">ăŠăçźă</td><td style="border: 1px #000 solid">6</td><td style="border: 1px #000 solid">3</td><td style="border: 1px #000 solid">59</td><td style="border: 1px #000 solid">287</td>
</tr>
<tr>
<td style="border: 1px #000 solid">4</td><td style="border: 1px #000 solid">ăăŞăł</td><td style="border: 1px #000 solid">6</td><td style="border: 1px #000 solid">5</td><td style="border: 1px #000 solid">15</td><td style="border: 1px #000 solid">129</td>
</tr>
</table>
</center>
<br>
<p>
ĺéĄăŽĺŻžčąĄă¨ăŞăăčĺăŽĺć° <var>n</var> ă¨ĺăčĺăŽć
ĺ ąăĺśéăŽć
ĺ ąăĺ
Ľĺă¨ăăăăŽăčĺä¸ă¤ă ăăŞăĺśéăčś
ăăăă¨ăăŞăďźéŁăšăŚăăăďźăčĺăŽä¸čŚ§ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<p>
ăčĺăŽć
ĺ ąăŻăăčĺăŽçŞĺˇ <var>s</var>ăăăŽăčĺăŤĺŤăžăăăăăąă質ăŽéé <var>p</var>ăč質ăŽéé <var>q</var>ăçć°´ĺçŠăŽéé <var>r</var> ăăć§ćăăăŚăăžăăĺśéăŽć
ĺ ąăŤăŻăĺŤăăă¨ăă§ăăć大ăŽăăăąă質ăŽéé <var>P</var>ăč質ăŽéé <var>Q</var>ăçć°´ĺçŠăŽéé <var>R</var>ăăăăłćĺăăăă¨ăă§ăăć大ăŽăŤăăŞăź <var>C</var> ăăăŞăŁăŚăăăăżăłăăŻčłŞăč質ăçć°´ĺçŠăăŤăăŞăźăŽăăăăăŽä¸ă¤ă§ăčś
ăăă¨ĺśééĺă¨ăŞăăăéŁăšăŚăŻăăăŞăăčĺăă¨ĺ¤ćăăăžăă
</p>
<p>
éŁăšăŚăăăăčĺăŽä¸čŚ§ăŻăéŁăšăŚăăăăčĺăŽçŞĺˇăĺ
Ľĺé ăŤĺşĺăăŚăă ăăăăŞăăéŁăšăŚăăăăčĺăăŞăăă°âNAâă¨ĺşĺăăŚăă ăăă
ä¸ăŽčĄ¨ăŤăă4ĺăŽăčĺăŤă¤ăăŚă<var>P</var> = 10, <var>Q</var> = 15, <var>R</var> = 50, <var>C</var> = 400 ă¨ăăĺśéăŽĺ ´ĺăăąăźăă¨ăăŞăłăŻăăăăăŽć é¤ç´ ĺăłăŤăăŞăźăĺśéĺ¤äťĽä¸ăŞăŽă§éŁăšăŚăăăăčĺăŤĺéĄăăăžăăăăăăăăăăšăŻçć°´ĺçŠă¨ăŤăăŞăźăăŠăçźăăŻçć°´ĺçŠăŽéăĺśéĺ¤ăčś
ăăŚăăăăéŁăšăŚăŻăăăŞăăčĺăŤĺéĄăăăžăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>s<sub>1</sub></var> <var>p<sub>1</sub></var> <var>q<sub>1</sub></var> <var>r<sub>1</sub></var>
<var>s<sub>2</sub></var> <var>p<sub>2</sub></var> <var>q<sub>2</sub></var> <var>r<sub>2</sub></var>
:
<var>s<sub>n</sub></var> <var>p<sub>n</sub></var> <var>q<sub>n</sub></var> <var>r<sub>n</sub></var>
<var>P</var> <var>Q</var> <var>R</var> <var>C</var>
</pre>
<p>
1čĄçŽăŤăčĺăŽć° <var>n</var> (1 ≤ <var>n</var> ≤ 1000)ăä¸ăăăăžăăçśă <var>n</var> čĄăŤçŹŹ <var>i</var> ăŽăčĺăŽçŞĺˇ <var>s<sub>i</sub></var> (1 ≤ <var>s<sub>i</sub></var> ≤ 1000)ăĺć é¤ç´ ăŽééă襨ăć´ć° <var>p<sub>i</sub></var>, <var>q<sub>i</sub></var>, <var>r<sub>i</sub></var> (0 ≤ <var>p<sub>i</sub></var>, <var>q<sub>i</sub></var>, <var>r<sub>i</sub></var> ≤ 100) ăä¸ăăăăžăă
</p>
<p>
çśăčĄăŤĺć é¤ç´ ĺăłăŤăăŞăźăŽĺśéĺ¤ă襨ăć´ć° <var>P</var>, <var>Q</var>, <var>R</var> (0 ≤ <var>P</var>, <var>Q</var>, <var>R</var> ≤ 100), <var>C</var> (0 ≤ <var>C</var> ≤ 1700) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăéŁăšăŚăăăăčĺăŽçŞĺˇăžă㯠âNAâ ăĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
4
1 7 14 47
2 5 35 55
3 6 3 59
4 6 5 15
10 15 50 400
2
1 8 10 78
2 4 18 33
10 10 50 300
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
1
4
NA
</pre> | [
[
"4\n1 7 14 47\n2 5 35 55\n3 6 3 59\n4 6 5 15\n10 15 50 400\n2\n1 8 10 78\n2 4 18 33\n10 10 50 300\n0\n",
"4\n1 7 14 47\n2 5 35 55\n3 6 3 59\n4 6 5 15\n10 15 50 400\n2\n1 8 10 78\n2 4 18 33\n10 10 50 300\n0\n"
]
] |
p00240 | Interest Rates |
<H1>éĺŠč¨çŽ</H1>
<p>
éĺŠăŻéčĄăŤé ăăŚăăăéăŤäťăăăăŽč¨çŽćšćłăĺŠçăŻéčĄăŤăăŁăŚć§ă
ă§ăăĺŠćŻă¨ĺ
éăĺăăăăăŽăĺ
ĺŠă¨ĺźăłăžăăăĺ
ĺŠăŽč¨çŽćšćłă¨ăăŚăĺŠćŻăĺ
éăŤçľăżĺ
ĽăăăŤč¨çŽăăăĺĺŠăă¨ĺŠćŻăĺ
éăŤçľăżĺ
ĽăăŚč¨çŽăăăč¤ĺŠăă¨ăăăăŽăăăăăăĺ¤ăăŽĺ
ĺŠăĺžăăăăŤăŻăăŽĺˇŽç°ăç解ăăŚăăŞăăă°ăŞăăžăăăĺ
ĺŠăŽč¨çŽćšćłăŻäťĽä¸ăŽăăăŤăŞăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_1"><br>
<br>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0240_2">
</center>
<br>
<!--
<p>
ă§ăăă°ăăăăăŞéĺŠă§ăăăĺ¤ăăéăĺ˘ăăăăă¨ćăăăŽă§ăăç¸ć˛˘ăăăŽĺŽśĺşă§ăŻăäťăžă§é ăăŚăăéčĄăŻéĺŠăä˝ăäşăŤć°ăĽăăć°ăăéčĄăŤäšăćăăăă¨ăăŚăăžăăăăăăç¸ć˛˘ăăä¸ĺŽśăŻéĺŠăŽăă¨ăŤă¤ăăŚăăžă芳ăăçĽăăŞăăŁăăŽă§ăéĺŠăŤčŠłăăăăŞăăŤĺŠăăćąăăŚăăžăăăćŻčźăăšăéčĄăŽć°ăŻĺ¤ăăăăç¸ć˛˘ăăä¸ĺŽśäťĽĺ¤ăŤăĺŠăăćąăăăăăă§ăăä˝ćĽăĺšçĺăăăăăŤăăčŻăéčĄăč¨çŽăăăăă°ăŠă ăä˝ćăăŚăăăžăăăă
</p>
-->
<p>
éčĄăŽć°ăăéăé ăăĺš´ć°ăĺéčĄăŽć
ĺ ąďźéčĄçŞĺˇăéĺŠăŽç¨ŽéĄăĺš´ĺŠçďźăăźăťăłăďźďźăĺ
Ľĺă¨ăăćăĺ
ĺŠăéŤăăŞăéčĄçŞĺˇăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăćăĺ
ĺŠăéŤăăŞăéčĄăŻä¸ă¤ă ăă§ăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>y</var>
<var>b<sub>1</sub></var> <var>r<sub>1</sub></var> <var>t<sub>1</sub></var>
<var>b<sub>2</sub></var> <var>r<sub>2</sub></var> <var>t<sub>2</sub></var>
:
<var>b<sub>n</sub></var> <var>r<sub>n</sub></var> <var>t<sub>n</sub></var>
</pre>
<p>
1čĄçŽăŤéčĄăŽć° <var>n</var> (1 ≤ <var>n</var> ≤ 50)ă2čĄçŽăŤăéăé ăăĺš´ć° <var>y</var> (1 ≤ <var>y</var> ≤ 30)ăä¸ăăăăžăăçśă<var>n</var> čĄăŤ <var>i</var> çŞçŽăŽéčĄăŽéčĄçŞĺˇ <var>b<sub>i</sub></var>ăĺš´ĺŠçă襨ăć´ć° <var>r<sub>i</sub></var> (1 ≤ <var>r<sub>i</sub></var> ≤ 100)ă éĺŠăŽç¨ŽéĄ <var>t<sub>i</sub></var> (1 ăžă㯠2) ăä¸ăăăăžăăéĺŠăŽç¨ŽéĄ <var>t<sub>i</sub></var> ăŻăĺĺŠăŽĺ ´ĺăŻ1ăč¤ĺŠăŽĺ ´ĺăŻ2ă§ä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăćăĺ
ĺŠăéŤăăŞăéčĄçŞĺˇăďźčĄăŤĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
2
8
1 5 2
2 6 1
2
9
1 5 2
2 6 1
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
2
1
</pre> | [
[
"2\n8\n1 5 2\n2 6 1\n2\n9\n1 5 2\n2 6 1\n0\n",
"2\n8\n1 5 2\n2 6 1\n2\n9\n1 5 2\n2 6 1\n0\n"
]
] |
p00241 | Quaternion Multiplication |
<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>ĺĺ
ć°ăŽăăçŽ</H1>
<p>
č¤ç´ ć°ăćĄĺźľăăăăŽăŤĺĺ
ć°ă¨ĺźă°ăăăăŽăăăăžăăçŠä˝ăŽĺ蝢ăŞăŠă襨çžăăăŽăŤäžżĺŠăŞăŽă§ăăăăăăŽč
ăŽĺśĺžĄăŞăŠăŤä˝żăăäžżĺŠăŞć°ă§ăăĺĺ
ć°ăŻăďźă¤ăŽĺŽć° $x$ă$y$ă$z$ă$w$ ă¨çšĺĽăŞć°ďźčć°ăćĄĺźľăăăăŽďź$i$ă$j$ă$k$ ăç¨ăăŚă$x + yi + zj + wk$ ă¨čĄ¨ăăăžăăăăŽăăăŞĺĺ
ć°ăŽĺăŻćŹĄăŽăăăŤĺŽçžŠăăăžăă<br>
<br>
$(x_1 + y_1 i + z_1 j + w_1 k) + (x_2 + y_2 i + z_2 j + w_2 k) = (x_1 + x_2) + (y_1 + y_2)i + (z_1 + z_2)j + (w_1 + w_2)k$
</p>
<!--
<p>
(x<sub>1</sub> + y<sub>1</sub>i+z<sub>1</sub>j+w<sub>1</sub>k) + (x<sub>2</sub> + y<sub>2</sub>i + z<sub>2</sub>j + w<sub>2</sub>k) = (x<sub>1</sub> + x<sub>2</sub>) + (y<sub>1</sub> + y<sub>2</sub>)i + (z<sub>1</sub> + z<sub>2</sub>)j + (w<sub>1</sub> + w<sub>2</sub>)k
</p>
-->
<p>
ä¸ćšă1ă$i$ă$j$ă$k$ ăŽéăŽçŠăŻćŹĄăŽăăăŤä¸ăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0241_1">
</center>
<br>
<p>
ăăŽčĄ¨ăŻăďźă¤ăŽçšĺĽăŞć° $A$ 㨠$B$ ăŽçŠ $AB$ ă襨ăăŚăăžăăäžăă°ă $i$ 㨠$j$ ăŽçŠ $ij$ 㯠$k$ ă§ăăă $j$ 㨠$i$ ăŽçŠ $ji$ 㯠$-k$ ă§ăăăă¨ă襨ăăŚăăžăă
</p>
<p>
ä¸čŹăŽĺĺ
ć°ăŽçŠăŻăăăŽé˘äżăćşăăăăăŤč¨çŽăăăžăăäžăă°ă2ă¤ăŽĺĺ
ć°ă$1+2i+3j+4k$ ă¨$7+6i+7j+8k$ ăŽçŠăŻćŹĄăŽăăăŤč¨çŽăăžăă
</p>
<p>
$(1+2i+3j+4k) \times (7+6i+7j+8k)=$<br>
$7+6i+7j+8k$<br>
$+14i+12i^2+14ij+16ik$<br>
$+21j+18ji+21j^2+24jk$<br>
$+28k+24ki+28kj+32k^2$
</p>
<p>
ä¸ăŽčĄ¨ăéŠç¨ăăăă¨ăŤăă
</p>
<p>
$= -58+16i+36j+32k$
</p>
<p>
ă¨ăŞăăžăă
</p>
<p>
4ă¤ăŽäżć°$x$ă$y$ă$z$ă$w$ ăć´ć°ă§ăă¤ăăšăŚăăźăă¨ăŻăŞăăŞă2ă¤ăŽĺĺ
ć° ($x_1+y_1 i+z_1 j+w_1 k$) ă¨($x_2+y_2 i+z_2 j+w_2 k$)ăĺ
Ľĺă¨ăăăăŽçŠă($x_3+y_3 i+z_3 j+w_3 k$)ă¨ăăćăŽ$x_3$ă$y_3$ă$z_3$ă$w_3$ ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă<br>
<br>
$n$<br>
$data_1$<br>
$data_2$<br>
:<br>
$data_n$<br>
</p>
<p>
1čĄçŽăŤĺŚçăčĄăĺĺ
ć°ăŽçľăŽĺć° $n$ ($ n \leq 10$) ăä¸ăăăăžăăçśă $n$ čĄăŤ $i$ çŞçŽăŽĺĺ
ć°ăŽçľăŽć
ĺ ą $data_i$ ă揥ăŽĺ˝˘ĺźă§ä¸ăăăăžăă<br>
<br>
$x_1$ $y_1$ $z_1$ $w_1$ $x_2$ $y_2$ $z_2$ $w_2$
</p>
<p>
ä¸ăăăăäżć°ăŻăăšăŚ-1000 䝼ä¸1000 䝼ä¸ă¨ăăžăăăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăžăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăä¸ăăăăĺĺ
ć°ăŽçľăŽçŠăĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
2
1 2 3 4 7 6 7 8
5 6 7 8 3 2 3 4
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
-58 16 36 32
-50 32 28 48
</pre> | [
[
"2\n1 2 3 4 7 6 7 8\n5 6 7 8 3 2 3 4\n0\n",
"2\n1 2 3 4 7 6 7 8\n5 6 7 8 3 2 3 4\n0\n"
]
] |
p00242 | Input Candidates |
<H1>ĺ
ĽĺĺčŁ</H1>
<p>
ćşĺ¸ŻéťčŠąăŤăŻăăĄăźăŤăŞăŠăŽćçŤ ăĺšçčŻăĺ
ĽĺăăăăăŤĺ
ĽĺĺčŁă襨示ăăćŠč˝ăćčźăăăŚăăžăăăăăŻă使ăăăé ťĺşŚăéŤăĺčŞăč¨é˛ăăŚăăăĺ
Ľĺăăăćĺăé ćĺăŤćă¤ĺčŞăĺ
ĽĺĺčŁă¨ăăŚć示ăăăăŽă§ăăäžăă°ăćŽćŽľâcomputerâă¨ăăĺčŞăĺ¤ăĺ
ĽĺăăŚăăăŞăăâcâă¨ĺ
Ľĺăăă ăă§ĺčŁă¨ăăŚâcomputerâăć示ăăăžăăăăŽăăăŞćŠč˝ăŽĺşćŹé¨ĺăä˝ćăăŚăżăžăăăă
</p>
<p>
ćçŤ ăćĺăĺ
Ľĺă¨ăăăăŽćĺăé ćĺăŤćă¤ĺčŞăĺşçžć°ăŽé ăŤĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăĺşçžć°ăĺăĺčŞăč¤ć°ăăĺ ´ĺăŻăčžć¸ĺźé ĺşă§ĺşĺăăžăăĺşĺăăĺčŞăŻć大5ă¤ăžă§ă¨ăăžăă芲ĺ˝ăăĺčŞăĺĺ¨ăăŞăĺ ´ĺăŻâNAâă¨ĺşĺăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ă§čĄ¨ăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>line<sub>1</sub></var>
<var>line<sub>2</sub></var>
:
<var>line<sub>n</sub></var>
<var>k</var>
</pre>
<p>
1čĄçŽăŤćçŤ ăŽčĄć° <var>n</var> (1 ≤ <var>n</var> ≤ 10) ăä¸ăăăăžăăçśă <var>n</var> čĄăŤćçŤ ăä¸ăăăăžăăćçŤ ăŻĺč§čąĺ°ćĺă¨ĺč§çŠşç˝ăăăŞăăďźčĄăŽćĺć°ăŻ1ćĺ䝼ä¸1024ćĺ䝼ä¸ă¨ăăžăă犺ç˝ăŤăăŁăŚĺşĺăăăĺčŞăŻ1ćĺ䝼ä¸20ćĺ䝼ä¸ă§ăă
</p>
<p>
çśăčĄăŤé ćĺ <var>k</var> ăĺč§čąĺă§ä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăćĺŽăăăćĺăé ćĺăŤăă¤ĺčŞăžăăŻâNAâ ăĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
1
ben likes bananas the best among many fruits because bananas are sweet and cheap
b
1
winners get to visit aizu and the university of aizu and make many friends as well
a
3
ask alex about
the answer for the
assignment on android apps
a
2
programming is both
a sport and an intellectual puzzle
c
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
bananas because ben best
aizu and as
about alex android answer apps
NA
</pre> | [
[
"1\nben likes bananas the best among many fruits because bananas are sweet and cheap\nb\n1\nwinners get to visit aizu and the university of aizu and make many friends as well\na\n3\nask alex about\nthe answer for the\nassignment on android apps\na\n2\nprogramming is both\na sport and an intellectual puzzle\nc\n0\n",
"1\nben likes bananas the best among many fruits because bananas are sweet and cheap\nb\n1\nwinners get to visit aizu and the university of aizu and make many friends as well\na\n3\nask alex about\nthe answer for the\nassignment on android apps\na\n2\nprogramming is both\na sport and an intellectual puzzle\nc\n0\n"
]
] |
p00243 | Filling Game |
<H1>ĺĄăă¤ăśăă˛ăźă </H1>
<p>
ćă§çťé˘ăŤăżăăăăŚćä˝ăăăă¨ăŽă§ăăăżăăŹăăă¤ăłăżăźăă§ăźăšăŽćčĄăŻăă˛ăźă ăŽĺéă§ăĺżç¨ăăăć°ăăćä˝ćăćă¤ć§ă
ăŞç¨ŽéĄăŽă˛ăźă ăä˝ăăăŚăăžăăçžĺ¨ă礞ăéçşăăŚăăă˛ăźă ăăăŽä¸ă¤ă§ăă
</p>
<p>
ăăŽă˝ăăăŚă§ă˘ďźă˛ăźă ďźăŽčŚäťśăŻäťĽä¸ăŽéăă§ăă
</p>
<ul>
<li> çťé˘ăŤăŻ <var>X</var> ĺ× <var>Y</var>čĄăŽ2揥ĺ
ă°ăŞăăăăăăžăă</li>
<li> ă°ăŞăăăŽăťăŤăŻčľ¤(R)ăçˇ(G)ăčś(B)ăŽ3č˛ăŽăăăăă§ĺĄăăăŚăăžăă</li>
<li> ăťăŤăŽč˛ăĺ¤ć´ăăăăżăłRăGăBăăăăăăŽăăżăłăćźä¸ăăăă¨ä¸çŞĺˇŚä¸(0,0)ăŽăťăŤăăăŽč˛ăŤĺ¤ć´ăăăžăă</li>
<li> ä¸çŞĺˇŚä¸ăŽăťăŤăŽč˛ăĺ¤ć´ăăăă¨ăăăŽăťăŤăŽĺ
ăŽč˛ă¨ĺăč˛ăŤĺĄăăăéŁćĽăăăăšăŚăŽăťăŤăćĺŽăăăč˛ăŤĺ¤ăăăžăăăăŞăăĄăĺ
ăŽč˛ăĺăč˛ăŽăťăŤă§ă¤ăŞăăŁăăťăŤăŻăăšăŚćĺŽăăăč˛ăŤĺ¤ć´ăăăžăă</li>
</ul>
<p>
ăăŽăăăŤă°ăŞăăăĺĄăă¤ăśăăŚăăăćçľçăŤă°ăŞăăĺ
¨ä˝ăä¸č˛ăŤăăă¨ăăă˛ăźă ă§ăăĺ°ăŞăćé ă§č§Łăă¨éŤĺžçšăä¸ăăăăžăă
</p>
<p>
礞ăŽăăă°ăŠăăźă§ăăăăŞăăŻăăăŽă˛ăźă ăŽăă¸ăăŻăŽä¸é¨ĺăéçşăăăă¨ăŤăŞăăžăăăăžăăŻăăăŽćéŤĺžçšăč¨çŽăăăăăăăŽă˛ăźă ăćçă§č§Łăăĺ ´ĺăćä˝ä˝ĺé¸ćăăżăłăćä˝ăăă°ă°ăŞăăăä¸č˛ăŤăŞăăăăă¨ăăăăă°ăŠă ăä˝ăăă¨ăŤăăžăăă
</p>
<!--
<p>
2揥ĺ
ăŽă°ăŞăăăŽăľă¤ăşX×Yă¨ĺăťăŤăŽĺćçść
ăŽč˛ďźRăGăBăŽăăăăďźăĺ
Ľĺă¨ăăăăšăŚăŽăťăŤăĺä¸č˛ăŤăăăăăŤĺż
čŚăŞé¸ćăăżăłăŽćä˝ĺć°ăŽćĺ°ĺ¤ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăxă¨yăŻ2䝼ä¸10䝼ä¸ă¨ăăžăă
</p>
-->
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0243_1"><br>
</center>
<br>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>X</var> <var>Y</var>
<var>c<sub>1,1</sub></var> <var>c<sub>2,1</sub></var> ... <var>c<sub>X,1</sub></var>
<var>c<sub>1,2</sub></var> <var>c<sub>2,2</sub></var> ... <var>c<sub>X,2</sub></var>
:
<var>c<sub>1,Y</sub></var> <var>c<sub>2,Y</sub></var> ... <var>c<sub>X,Y</sub></var>
</pre>
<p>
1čĄçŽăŤă°ăŞăăăŽĺă¨čĄăŽăľă¤ăş <var>X</var>, <var>Y</var> (2 ≤ <var>X</var>, <var>Y</var> ≤ 10) ăä¸ăăăăžăăçśă <var>Y</var> čĄăŤ <var>i</var> ĺçŽ <var>j</var> čĄçŽăŽăťăŤăŽč˛ă襨ăćĺ <var>c<sub>i,j</sub></var> ă犺ç˝ĺşĺăă§ä¸ăăăăžăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăăăżăłćä˝ăŽćĺ°ĺć°ă1čĄăŤĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
3 3
R G B
G G G
G B B
2 4
R G
G G
R B
B R
4 3
G G B R
G R R G
B G G R
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
2
4
4
</pre> | [
[
"3 3\nR G B\nG G G\nG B B\n2 4\nR G\nG G\nR B\nB R\n4 3\nG G B R\nG R R G\nB G G R\n0 0\n",
"3 3\nR G B\nG G G\nG B B\n2 4\nR G\nG G\nR B\nB R\n4 3\nG G B R\nG R R G\nB G G R\n0 0\n"
]
] |
p00244 | Hot Spring Trip |
<H1>渊ćłć
čĄ</H1>
<p>
渊ćłĺĽ˝ăăŽăăăăăăŻă揥ăŽéˇćäźćăĺŠç¨ăăŚă¨ăă渊ćłĺ°ă¸ăŽć
čĄăč¨çťăăŚăăžăă秝ĺăŻéˇčˇé˘ăăšăäšăçśăăăŞăăšăăéăăăăăŤçŽçĺ°ă¸ăăŠăçăăăă¨ćăŁăŚăăžăă貯éăăăă¨ăŻăăăčłéăŤĺżč¨ąăŞăăăăăăăŻăăăăăăăŤç¸čŤăăăă¨ăŤăăžăăăč¨çťăčăăŚćĺżăăăăăăăăŻăăăăăăăŤçšĺĽăŞĺ珌ă渥ăăžăăă
</p>
<p>
ăăŽĺ珌ăŻăéˇčˇé˘ăăšăŽéŁçśăă2ĺşéă1ĺă ăçĄćă§äšăăă¨ăăăăŽă§ăăă使ăăăăŤăăŁăŚăŻăăŞăăŽç§ťĺ貝ĺć¸ăčŚčžźăăžăăăăă大ăăŞĺšćăçşćŽăăăăăăŤăŻăăŁăăăăč¨çťă硴ăĺż
čŚăăăăžăă
</p>
<p>
ĺşçşĺ°ă¨çŽçĺ°ăĺăłä¸çśĺ°çšăĺăă㌠<var>n</var> ĺă2ă¤ăŽĺ°çšăçľăśčˇŻçˇă <var>m</var> ĺä¸ăăăăžăăĺĺ°çšăŤăŻăăăă 1 ăă <var>n</var> ăžă§ăŽć°ĺăĺ˛ăćŻăăăŚăăžăăĺşçşĺ°ăŻ 1ăçŽçĺ°ăŻ <var>n</var> ă§ăă衯çˇăŽć
ĺ ąăŻăăăŽčˇŻçˇăçľăś2ă¤ăŽĺ°çš <var>a</var> 㨠<var>b</var>ăĺăłăăŽćé <var>c</var> ă§čĄ¨ăăăžăăçšĺĽăŞĺ珌ăŽĺšĺăŤăăăäťťćăŽĺ°çšăăăä¸ĺşŚă ăéŁçśăă2ă¤ăŽčˇŻçˇăćé0ă§ééăăăă¨ăă§ăăžăăăă ăăéä¸ă§çŽçĺ°ăééăăŚăăçŽçĺ°ăŤăăŠăçăăăă¨ăŤăŻăŞăăžăăă
</p>
<p>
ĺşçşĺ°ăçŽçĺ°ăĺăłä¸çśĺ°çšăŽçˇć° <var>n</var> ă¨čˇŻçˇăŽć° <var>m</var>ăĺ衯çˇăŽć
ĺ ąăĺ
Ľĺă¨ăăćéăŽćĺ°ĺ¤ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăĺż
ăĺşçşĺ°ăăçŽçĺ°ă¸ă¨ĺ°éăăçľčˇŻăĺĺ¨ăăăăŽă¨ăăžăă</p>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var> <var>m</var>
<var>a<sub>1</sub></var> <var>b<sub>1</sub></var> <var>c<sub>1</sub></var>
<var>a<sub>2</sub></var> <var>b<sub>2</sub></var> <var>c<sub>2</sub></var>
:
<var>a<sub>m</sub></var> <var>b<sub>m</sub></var> <var>c<sub>m</sub></var>
</pre>
<p>
1čĄçŽăŤĺşçşĺ°ăçŽçĺ°ăĺăłä¸çśĺ°çšăŽçˇć° <var>n</var> (2 ≤ <var>n</var> ≤ 100)ă¨čˇŻçˇăŽć° <var>m</var> (1 ≤ <var>m</var> ≤ 300)ăä¸ăăăăžăăçśă <var>m</var> čĄăŤĺ衯çˇăŽć
ĺ ą <var>a<sub>i</sub></var>, <var>b<sub>i</sub></var>, <var>c<sub>i</sub></var> (1 ≤ <var>c<sub>i</sub></var> ≤ 1000) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 40 ăčś
ăăžăăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăćéăŽćĺ°ĺ¤ă1čĄăŤĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
2 1
1 2 5
3 2
1 2 5
2 3 5
6 9
1 2 7
1 3 9
1 5 14
2 3 10
2 4 15
3 4 11
3 5 2
4 5 9
4 6 8
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
5
0
7
</pre> | [
[
"2 1\n1 2 5\n3 2\n1 2 5\n2 3 5\n6 9\n1 2 7\n1 3 9\n1 5 14\n2 3 10\n2 4 15\n3 4 11\n3 5 2\n4 5 9\n4 6 8\n0 0\n",
"2 1\n1 2 5\n3 2\n1 2 5\n2 3 5\n6 9\n1 2 7\n1 3 9\n1 5 14\n2 3 10\n2 4 15\n3 4 11\n3 5 2\n4 5 9\n4 6 8\n0 0\n"
]
] |
p00245 | Time Sale |
<H1>ăżă¤ă ăťăźăŤ</H1>
<p>
ăăčŻăçŠăăăăĺŽăăäťćĽăăŠăăăŽăšăźăăźăăźăąăăă§čĄăăăăżă¤ă ăťăźăŤă§ăŻăćżăăéăăçš°ăĺşăăăăŚăăžăăăăäźć´ĽăŤăăăLLĺ ăăăăăŞăšăźăăźăăźăąăăăŽă˛ă¨ă¤ă§ăäťăŽăă§ăźăłĺşă¨ĺŻžćăăšăăĺ°ăĺ¤ăăŁăăżă¤ă ăťăźăŤăĺŽć˝ăăŚăăžăăä¸čŹçăŞăżă¤ă ăťăźăŤă§ăŻč¤ć°ăŽĺĺăĺăćéăŤĺŽăăŞăăăŽă§ăăăLLĺ ă§ăŻĺŻžčąĄă¨ăŞăĺĺăŤăăŁăŚăăżă¤ă ăťăźăŤăéĺ§ăăćéăĺĽă
ăŤč¨ĺŽăăăŚăăžăă
</p>
<p>
ĺäşĺŽśăŻLLĺ ăăăĺŠç¨ăă厜ĺşăŽä¸ă¤ă§ăăăăăŞĺäşĺŽśă§ăŻă弼ć§ä¸ťĺ°ăŽăă¨ă揥ăŽćĽćăŤčĄăăăăżă¤ă ăťăźăŤăŤĺăăŚä˝ćŚäźč°ăéăăăŠăŽăăăŞé çŞă§č˛ˇăçŠăăăă°ĺ¤ĺźăăć大ă¨ăŞăăăĺćăăăă¨ăŤăŞăăžăăăĺşĺ
ăççĽăăŚăăĺäşĺŽśăŻĺŁ˛ăĺ ´ăŽčŚĺăĺłăć¸ăăăžă揲ăăĺçŠăăŠăăŤăăăăĺ¤ĺźăăŻĺšžăă§ăăăă売ăĺăăăžă§ăŽćéăććĄăăăă¨ăŤćĺăăžăăă
ăăăžă§ăŻĺŽç§ă ăŁăĺäşĺŽśă§ăăăĺćăčĄăăäşşăăăžăăă§ăăăăăă§ĺäşĺŽśă¨čŚŞäş¤ăăăŁăăăŞăăŻăăă°ăŠă ăć¸ăăă¨ăŤăăžăăăä¸äşşăŽäşşăĺăăă¨ăćłĺŽăăŚăˇăăĽăŹăźăˇă§ăłăčĄăăžăă
</p>
<p>
ĺĺăŻ10税éĄăăăć°ĺ1ćĄăŽĺĺçŞĺˇ <var>g</var> ăŤăăŁăŚ ĺşĺĽăăăžăăăżă¤ă ăťăźăŤć
ĺ ąăŤăŻĺĺçŞĺˇ <var>g</var>ă ĺ¤ĺźăéĄ <var>d</var>ăăżă¤ă ăťăźăŤăŽéĺ§ćĺť <var>s</var> ă¨ĺŁ˛ăĺăćĺť <var>e</var> ăăăăžăă
</p>
<p>
ĺşĺ
ăŻć¨Ş <var>X</var>ă縌 <var>Y</var> ăŽăăšă§ć§ćăăă2揥ĺ
ă°ăŞăăă§čĄ¨ăăăăăšăă¨ăŤé衯ăĺĺćŁăŽ ăŠăĄăăăĺ˛ăĺ˝ăŚăăăŚăăžăăä¸ă¤ăŽĺĺćŁăŤăŻ 1税éĄăŽĺĺăăăăăăăŻĺĺçŞĺˇ <var>g</var> ă§ĺşĺĽăăăžăă
ăŠăŽĺĺă財ăŁăŚăăăă§ăăăĺăĺĺçŞĺˇăŽĺĺăč¤ć°č˛ˇăŁăŚăŻăăăžăăăĺĺćŁăăăŻăä¸ä¸ĺˇŚĺłăŤéŁćĽăăé衯ăŽăăšăŞăăŠăăŞĺăă§ăĺĺăĺăăžăă
</p>
<p>
ăżă¤ă ăťăźăŤăĺ§ăžăćĺťăăĺĺăĺăăă¨ăă§ăăžăăă売ăĺăăćĺťăăăŻĺĺăĺăăă¨ăă§ăăžăăăăžăăćéăŻĺ
Ľĺşăăćçšă§0ăăĺ§ăžăăžăă
</p>
<p>
秝ĺăŻçžĺ¨ăăăăšăăä¸ä¸ĺˇŚĺłăŽéŁćĽăăé衯ăăšăŤç§ťĺăăăă¨ăă§ăăžăăăĺĺćŁăŽăăšăŤç§ťĺăăăă¨ăŻă§ăăžăăăă°ăŞăăă§čĄ¨ăăăĺşăŽĺ¤ăŤĺşăăă¨ăă§ăăžăăăďźĺ秝ĺăăćŻăŤďźĺä˝ćéçľéăăžăăăžăăĺĺăĺăćéăŻčăăŞăăăŽă¨ăăžăă
</p>
<p>
ĺşĺ
ăŽčŚĺăĺłă¨č˛ˇăçŠăăăäşşăŽĺćä˝ç˝Žă¨ĺĺăŽăżă¤ă ăťăźăŤć
ĺ ąăĺ
Ľĺă¨ăăĺăăă¨ăŽă§ăăĺĺăŽĺ¤ĺźăéĄăŽĺč¨ăŽć大ĺ¤ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>X</var> <var>Y</var>
<var>m<sub>1,1</sub></var> <var>m<sub>2,1</sub></var> ... <var>m<sub>X,1</sub></var>
<var>m<sub>1,2</sub></var> <var>m<sub>2,2</sub></var> ... <var>m<sub>X,2</sub></var>
:
<var>m<sub>1,Y</sub></var> <var>m<sub>2,Y</sub></var> ... <var>m<sub>X,Y</sub></var>
<var>n</var>
<var>g<sub>1</sub></var> <var>d<sub>1</sub></var> <var>s<sub>1</sub></var> <var>e<sub>1</sub></var>
<var>g<sub>2</sub></var> <var>d<sub>2</sub></var> <var>s<sub>2</sub></var> <var>e<sub>2</sub></var>
:
<var>g<sub>n</sub></var> <var>d<sub>n</sub></var> <var>s<sub>n</sub></var> <var>e<sub>n</sub></var>
</pre>
<p>
1čĄçŽăŤĺşčăŽĺ¤§ăă<var>X</var>, <var>Y</var> (3 ≤ <var>X</var>, <var>Y</var> ≤ 20) ăä¸ăăăăžăăçśă <var>Y</var> čĄăŤ <var>i</var> ĺçŽ <var>j</var> čĄçŽăŽĺşĺ
ć
ĺ ą <var>m<sub>i,j</sub></var> ă䝼ä¸ăŽĺ
厚ă§ä¸ăăăăžăă<br>
. (ăăŞăŞă) ďźé衯ăŽăăš<br>
ć°ĺ ďźĺĺăŽçŞĺˇ<br>
P ďźč˛ˇăçŠăăăäşşăŽĺćä˝ç˝ŽăŽăăš<br>
</p>
<p>
çśăčĄăŤăżă¤ă ăťăźăŤć
ĺ ąăŽć° <var>n</var> (1 ≤ <var>n</var> ≤ 8) ăä¸ăăăăžăăçśă <var>n</var> čĄăŤ <var>i</var> çŞçŽăŽăżă¤ă ăťăźăŤć
ĺ ą <var>g<sub>i</sub></var> <var>d<sub>i</sub></var> <var>s<sub>i</sub></var> <var>e<sub>i</sub></var> ăä¸ăăăăžă(0 ≤ <var>g<sub>i</sub></var> ≤ 9, 1 ≤ <var>d<sub>i</sub></var> ≤ 10000, 0 ≤ <var>s<sub>i</sub></var>, <var>e<sub>i</sub></var> ≤ 100)ă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăžăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăĺăăă¨ăŽă§ăăĺĺăŽĺ¤ĺźăéĄĺč¨ăŽć大ĺ¤ăďźčĄăŤĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
6 5
1 1 . 0 0 4
1 . . . . .
. . 2 2 . .
. . 2 2 3 3
P . . . . .
5
0 50 5 10
1 20 0 10
2 10 5 15
3 150 3 5
4 100 8 9
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
180
</pre> | [
[
"6 5\n1 1 . 0 0 4\n1 . . . . .\n. . 2 2 . .\n. . 2 2 3 3\nP . . . . .\n5\n0 50 5 10\n1 20 0 10\n2 10 5 15\n3 150 3 5\n4 100 8 9\n0 0\n",
"6 5\n1 1 . 0 0 4\n1 . . . . .\n. . 2 2 . .\n. . 2 2 3 3\nP . . . . .\n5\n0 50 5 10\n1 20 0 10\n2 10 5 15\n3 150 3 5\n4 100 8 9\n0 0\n"
]
] |
p00246 | Bara-Bara Manju |
<H1>ă°ăă°ăéĽ
é </H1>
<p>
äźć´ĽčĽćžĺ¸ăŤăăĺčĺĺąăťĺć ĺ ăŽĺşéˇăăăŻăă¨ăŚăč
ăŽăăčˇäşşăăăŞăŽăŤăĄăăŁă¨ć°ĺĺąăŞăŽăçăŤăăşă§ăăĺşéˇăăăŽä˝ăéĽ
é ăŻă¨ăŚăçžĺłăăăŽă§ăăăăăŽćăŽć°ĺăŤăăŁăŚĺ¤§ăăăăžăĄăžăĄăŤăŞăŁăŚăăžăăžăă
</p>
<!--
ćăŤăŻćŽéăŽéĽ
é ăŽä˝ĺăăŽĺ¤§ăăă§ä˝ăŁăŚăăžăăă¨ăăăăťăŠă§ăă大ăăăéăăăăĄăăĄéăăä¸ă¤ä¸ă¤éăĺ¤ćŽľăă¤ăăăŽăŻă厢ăăăŤă¨ăŁăŚăĺşăŤă¨ăŁăŚăä¸äžżăŞăŽă§ĺ°ăăăŽă§ăăă
-->
<p>
čŚăăăĺşéˇăăăŽĺĽĽăăăŻă大ăăă¨éăăă°ăă°ăăŞéĽ
é ăč˘ăŤčŠ°ăăŚĺŁ˛ăĺşăăă¨ăćăă¤ăăžăăăä¸ĺŽăŽéăăŤăŞăăăăŤéĽ
é ăč˘ăŤčŠ°ăăŚĺŁ˛ăă°ăä¸ă¤ä¸ă¤ăŽĺ¤§ăăăŻă°ăă°ăă§ăä¸ĺŽăŽĺ¤ćŽľă§ĺŁ˛ăĺşăăă¨ăĺşćĽăžăăăăŠăăŞéĽ
é ăĺ
ĽăŁăŚăăăŽăéăăăžă§ăăăăŞăă¨ăăăľăăŠă¤ăşă売ăăŤăŞăăăăăăžăăă
ăă°ăă°ăéĽ
é ăă¨ăăĺĺă§ĺŁ˛ăă ăăă¨ăăăć°ăăă˘ă¤ăăŁă˘ă芹éĄă¨ăŞăĺć ĺ ăŻăăĄăžăĄčŠĺ¤ă¨ăŞăăžăăăăăăăĺéĄăăăăč˘ăŤĺ
ĽăăéĽ
é ăŽçľăżĺăăćšăŤăăŁăŚä˝ăăăă°ăă°ăéĽ
é ăăŽć°ăĺ¤ăăăçĄé§ăçşçăăŚăăžăăă¨ăăăăžăăăă˘ăŤăă¤ăă§ĺć ĺ ăŤćĽăŚăăăăŞăăŻçĄé§ăŞăč˘ăŤčŠ°ăăăăăŤăăă°ăŠă ăă¤ăăăă¨ăŤăăžăăă
</p>
<p>
éĽ
é ăŽéăăŻ1ăă9ăŽ9税éĄăăăžăăč˘ăŤčŠ°ăăćăŤăŻăéĽ
é ăŽéăăŽĺč¨ăă´ăŁăă10ăŤăŞăăăăŤčŠ°ăčžźăżăžăăéĽ
é ăŽçľăżĺăăćšăŻ1+1+2+4+2=10ă1+1+1+1+1+5=10ăŞăŠă§ăĺăéăăŽéĽ
é ăăăă¤ä˝żăŁăŚăć§ăăžăăă
</p>
<p>
ä˝ăăăéĽ
é ăŽĺć°ă¨éĽ
é ăŽéăăŽć
ĺ ąăĺ
Ľĺă¨ăăä˝ăăă¨ăŽă§ăăăă°ăă°ăéĽ
é ăăŽć大ăŽć°ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăă˛ă¨ă¤ă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>n</var>
<var>m<sub>1</sub></var> <var>m<sub>2</sub></var> ... <var>m<sub>n</sub></var>
</pre>
<p>
1čĄçŽăŤéĽ
é ăŽĺć° <var>n</var> (2 ≤ <var>n</var> ≤ 100) ăä¸ăăăăžăă
2čĄçŽăŤĺéĽ
é ăŽéă<var>m<sub>i</sub></var> (1 ≤ <var>m<sub>i</sub></var> ≤ 9) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăžăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤă芰ăčžźăăă¨ăŽă§ăăăă°ăă°ăéĽ
é ăăŽć大ăŽć°ă1čĄăŤĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
5
4 9 1 3 8
10
8 5 3 6 2 1 4 5 4 5
9
5 7 3 8 2 9 6 4 1
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
1
4
4
</pre> | [
[
"5\n4 9 1 3 8\n10\n8 5 3 6 2 1 4 5 4 5\n9\n5 7 3 8 2 9 6 4 1\n0\n",
"5\n4 9 1 3 8\n10\n8 5 3 6 2 1 4 5 4 5\n9\n5 7 3 8 2 9 6 4 1\n0\n"
]
] |
p00247 | Ice Maze |
<H1>ć°ˇăŽčżˇčˇŻ</H1>
<p>
ĺč§ăŽăăšă縌横ăŤăŞăăšăéˇćšĺ˝˘ăŽčżˇčˇŻăăăăžăăăăŽčżˇčˇŻă§ăŻćąčĽżĺĺăŽéŁćĽăăăăšă¸ç§ťĺăăŞăăăăšăżăźăăŽăăšSăĺşçşăăă´ăźăŤăŽăăšGăçŽćăăžăăăăšăŽç¨ŽéĄăŤăŻăĺšłĺăĺąąăć°ˇăŽďźç¨ŽéĄăăăăžăăSă¨GăŻăĺšłĺăŽăăšăŤç˝ŽăăăŚăăžăăĺšłĺăŽăăšăŤăŻç§ťĺă§ăăžăăăĺąąăŽăăšăŤăŻç§ťĺă§ăăžăăăć°ˇăŽăăšăŻç§ťĺă§ăăžăăăćĄäťśăŤăăŁăŚć°ˇăĺ˛ăĺăăŞăăŞăăžăă
</p>
<ul>
<li> ć°ˇăŽăăšăŻćąčĽżĺĺăŤéŁćĽăăăăŽĺ
¨ä˝ă§ă˛ă¨ă¤ăŽĺĄă¨ăăŚćąăăăžăă</li>
<li> ć°ˇăŽĺĄăŽăŞăă§ăăăšăŽĺć°ăŽĺĺăăĺ¤ăăŽăăšăŤç§ťĺăăă¨ăĺĄĺ
¨ä˝ăĺ˛ăăžăă</li>
</ul>
<p>
äžăă°ăĺłďźăŻä¸ăăăă迡衯ăŽćççľčˇŻăŽăšăăăć°ă 11 ă§ăăăă¨ă示ăăŚăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0247_1"><br>
<b>ĺł1</b>
</center>
<p>
ăăăăĺłďźăŽăăăŤć°ˇăŽăăšăéăŁăŚčżéăăăăă¨ăăă¨ă大ăăăďźăŽć°ˇăŽĺĄăŤĺŻžăăďźĺçŽăŽç§ťĺĺžăŤĺăăŞăăŞăŁăŚăăžăGăŤăŻĺ°éă§ăăžăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0247_2">
<b>ĺł2</b>
</center>
<p>
ăăŽăăăŞčżˇčˇŻăŽć
ĺ ąăĺ
Ľĺă¨ăăSăăGăžă§ăŽćççľčˇŻăŽăšăăăć°ăćąăăăăă°ăŠă ăä˝ćăăŚăă ăăăăăšăŽç¨ŽéĄăŻăăăă䝼ä¸ăŽćĺă§čĄ¨ăăăžăďź
</p>
<center>
<table style="border: 1px #000 solid" "border="1" cellpadding="3" cellspacing="0">
<tr>
<th width="160"style="border: 1px #000 solid" >ćĺďźĺč§ďź</th>
<th width="160"style="border: 1px #000 solid" >ăăšăŽç¨ŽéĄ</th>
</tr>
<tr>
<td style="border: 1px #000 solid" >. ďźăăŞăŞăďź</td>
<td style="border: 1px #000 solid" >ĺšłĺ</td>
</tr>
<tr>
<td style="border: 1px #000 solid" >#ďźăˇăŁăźăďź</td>
<td style="border: 1px #000 solid" >ĺąą</td>
</tr>
<tr>
<td style="border: 1px #000 solid" >X</td>
<td style="border: 1px #000 solid" >ć°ˇ</td>
</tr>
</table>
</center>
<br>
<p>
ä¸ăăăă迡衯ăŻĺż
ă解ăăăăŽă¨ăăžăă迡衯ăŻăăŽćąčĽżćšĺăŽăăšăŽć° <var>X</var>ăĺĺćšĺăŽăăšăŽć° <var>Y</var> 㨠<var>X</var> × <var>Y</var> ĺăŽćĺă¨ăăŚä¸ăăăăžăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăžăă
</p>
<pre>
<var>X</var> <var>Y</var>
<var>line<sub>1</sub></var>
<var>line<sub>2</sub></var>
:
<var>line<sub>Y</sub></var>
</pre>
<p>
1čĄçŽăŤčżˇčˇŻăŽĺ¤§ăăă襨ăć´ć° <var>X</var>, <var>Y</var> (2 ≤ <var>X, Y</var> ≤ 12) ăä¸ăăăăžăăçśă <var>Y</var> čĄăŤčżˇčˇŻăŽ <var>i</var> čĄçŽăŽć
ĺ ą <var>line<sub>i</sub></var> (éˇă <var>X</var> ăŽĺč§čąćĺĺ) ăä¸ăăăăžăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 40 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăćĺ°ăŽăšăăăć°ăďźčĄăŤĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
5 5
.X.S.
.X#..
.XX##
.#XG.
..X..
7 3
SXX.XXG
X.#.#X.
XXX.XX#
4 4
S...
X.X.
GX..
...X
10 10
..XXXXX.XX
.X.#.#X.XX
SX.#X.X..X
#X.##.X.XX
..XXXX#.XX
##.##.##XX
....X.XX#X
.##X..#X#X
....XX#..X
...#XXG..X
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
11
10
10
33
</pre> | [
[
"5 5\n.X.S.\n.X#..\n.XX##\n.#XG.\n..X..\n7 3\nSXX.XXG\nX.#.#X.\nXXX.XX#\n4 4\nS...\nX.X.\nGX..\n...X\n10 10\n..XXXXX.XX\n.X.#.#X.XX\nSX.#X.X..X\n#X.##.X.XX\n..XXXX#.XX\n##.##.##XX\n....X.XX#X\n.##X..#X#X\n....XX#..X\n...#XXG..X\n0 0\n",
"5 5\n.X.S.\n.X#..\n.XX##\n.#XG.\n..X..\n7 3\nSXX.XXG\nX.#.#X.\nXXX.XX#\n4 4\nS...\nX.X.\nGX..\n...X\n10 10\n..XXXXX.XX\n.X.#.#X.XX\nSX.#X.X..X\n#X.##.X.XX\n..XXXX#.XX\n##.##.##XX\n....X.XX#X\n.##X..#X#X\n....XX#..X\n...#XXG..X\n0 0\n"
]
] |
p00248 | Magic Square |
<H1>éćłéŁ</H1>
<p>
äşşéé˘ăă棎ăŽĺĽĽćˇąăăŤăăăŞăźă¨ăăĺăŽé弳ăä˝ăă§ăăžăăă彟弳ăŻé弳ăŞăŽă§ăéŁćăťć°´ăťçćăŞăŠăçć´ťăŤĺż
čŚăŞăăŽăéćłăŤăăŁăŚăžăăŞăŁăŚăăžăă
</p>
<p>
彟弳ăŽéćłăŻăéĺăčžźăăăăă¤ăăŽçłă¨ç´ă使ăŁăŚăéćłéŁăćăăă¨ăŤăăŁăŚçşĺăăžăăăăŽéćłéŁăŻăçłăč¨ç˝Žăăăăă¤ăăŽçłăŽăă˘ăç´ă§çšăăă¨ă§ćăăăžăăăă ăăç´ăŻĺźăă§ăăŚăŻăăăžăăăăăăŤăăŠăŽç´ăă(严獯ăé¤ăăŚ) äťăŽç´ăçłăŤč§ŚăăŚăŻăăăžăăăăăĄăăăĺăĺ ´ćăŤč¤ć°ăŽçłă罎ăăă¨ăă§ăăžăăăăăŽĺśç´ăĺŽăăăéăăçłă¨çłăŽä˝ç˝Žé˘äżăç´ăŽéˇăăŤĺśéăŻăăăžăăăăžăăçłăŻĺĺĺ°ăăăŽă§çšă¨ăăŚćąăăă¨ăă§ăăç´ăŻĺĺç´°ăăŽă§çˇĺă¨ăăŚćąăăă¨ăă§ăăžăăăăăŤă彟弳ăŻĺăçłăŽăă˘ă2ćŹäťĽä¸ăŽç´ă§çšăăă¨ăăăăç´ăŽä¸ĄçŤŻăĺăçłăŤçľăśăă¨ăăăăžăăă
</p>
<p>
ăăŞăźăŻĺăăçłă彟弳ăŽĺŽśăŽĺšłăăŞĺŁăŤč˛źăäťăăŚéćłéŁăćăăŚăăžăăăăăăă彟弳ăŻăăăŚăăŠăăăŚăä˝ăăă¨ăŽă§ăăŞăéćłéŁăăăăă¨ăŤć°äťăăăŽă§ăăăă°ăăăăŚă彟弳ăŻéćłéŁăĺšłăăŞĺŁăă¤ăžăäşćŹĄĺ
ĺšłé˘ăŽä¸ă§ä˝ăăă¨ăă§ăăăĺ¤ĺŽăăćšćłă硨ăżĺşăăžăăăăăéćłéŁăŻă揥ăŽăăăŞé¨ĺăĺŤăĺ ´ĺăăžăăăŽĺ ´ĺăŤéăŁăŚăäşćŹĄĺ
ĺšłé˘ä¸ă§ä˝ăăă¨ăă§ăăŞăăŽă§ăă
</p>
<center>
<table>
<tr>
<td align="center" style="text-align:center">
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0251_1" title="Magic Square" alt="MagicSquare" height="200"><br>
</td>
<td width="80">
</td>
<td align="center" style="text-align:center">
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0251_2" title="Magic Square" alt="MagicSquare" height="200"><br>
</td>
</tr>
<tr>
<td>
ĺłďź é çšć° 5 ăŽĺŽĺ
¨ă°ăŠă<br>
</td>
<td>
</td>
<td>
ĺłďź é çšć° 3, 3 ăŽĺŽĺ
¨äşé¨ă°ăŠă<br>
</td>
</tr>
</table>
</center>
<br>
<p>
ăăŽăăăŞéćłéŁăćăăăăŤă彟弳ăŻçłă犺ä¸ăŤĺşĺŽăăéćłă硨ăżĺşăăžăăăä¸ćŹĄĺ
犺éă§ăŻăăăăăŽéćłéŁăćăăă¨ăă§ăăăŽă§ăăăăăŠăăăăăŠăăŞéćłéŁăä¸ćŹĄĺ
犺éä¸ă§ăŻćăăă¨ăă§ăăăă¨ă彟弳ăŻçŞăć˘ăăăŽă§ăă
</p>
<p>
ăăŚăăăăăăĺéĄă§ăăăăćĽăăŞăźăŻă彟弳ăŽĺŽśăŽçé˘ăŤčśłĺ
çŻăŽéćłéŁăä˝ăăă¨ăŤăăžăăăăăăă彟弳ăŻć˘ăŤçăçé˘ăŤăăăăăŞéćłéŁăč¨ç˝ŽăăŚăăăŽă§ăčśłĺ
çŻăŽéćłéŁăăćŽăăăĺŻä¸ăŽăšăăźăšă§ăăä¸ćŹĄĺ
ăŽç´çˇăŽä¸ăŤćăăŞăăă°ăŞăăžăăă彟弳ăč¨č¨ăăăăă¤ăăŽčśłĺ
çŻăŽéćłéŁăŤă¤ăăŚăăăăç´çˇăŽä¸ăŤćăăăăŠăăăĺ¤ĺŽăăćăăĺ ´ĺ <span>yes</span> ă¨ăăăă§ăŞăĺ ´ĺ <span>no</span> ă¨ĺşĺăăăăă°ăŠă ăä˝ćăăŚä¸ăăă
</p>
<p>
éćłéŁăŻăçłăŽĺć° <var>n</var>ăç´ăŽćŹć° <var>m</var>ă<var>m</var> ĺăŽç´ăŽć
ĺ ąă§ä¸ăăăăžăăç´ăŻăăăŽä¸ĄçŤŻăŽçłăŽçŞĺˇ <var>u</var>ă<var>v</var> ă§čĄ¨ăăăžăăçłăŤăŻ 1 ăă <var>n</var> ăžă§ăŽçŞĺˇăä¸ăăăă<var>n</var> 㯠1 äťĽä¸ 100,000 䝼ä¸ă<var>m</var> 㯠0 äťĽä¸ 1,000,000 䝼ä¸ă¨ăăžăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽă¨ăăă§ăă
</p>
<p>
1 čĄçŽ çłăŽĺć° <var>n</var> ç´ăŽćŹć° <var>m</var>ďźć´ć° ć´ć°ďźĺč§çŠşç˝ĺşĺăďź<br>
2 čĄçŽ 珏1ăŽç´ăŽć
ĺ ą <var>u</var> <var>v</var>ďźć´ć° ć´ć°ďźĺč§çŠşç˝ĺşĺăďź<br>
3 čĄçŽ 珏2ăŽç´ăŽć
ĺ ą<br>
:<br>
<var>m+1 </var>čĄçŽ 珏 <var>m</var> ăŽç´ăŽć
ĺ ą<br>
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 20 ăčś
ăăžăăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăyes ăžă㯠no ă¨ďźčĄăŤĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
5 4
1 2
2 3
3 4
4 5
4 6
1 2
1 3
1 4
2 3
2 4
3 4
5 0
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
yes
no
yes
</pre> | [
[
"5 4\n1 2\n2 3\n3 4\n4 5\n4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4\n5 0\n0 0\n",
"5 4\n1 2\n2 3\n3 4\n4 5\n4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4\n5 0\n0 0\n"
]
] |
p00249 | Ant Nest |
<H1>ă˘ăŞăŽĺˇŁçŽąăŽĺ˝˘çś</H1>
<p>
ćąćĺăŻĺ¤äźăżăŽčŞçąç 犜ă¨ăăŚă˘ăŞăŽĺˇŁăŽčŚłĺŻăčĄăăă¨ăŤăăžăăă彟ăŽăăăăĄăăăĺŤăŽăăăŤç¨ćăăŚăăă茳ĺŻç¨ăŽéćăąăźăšăŻă¨ăŚăăŚăăźăŻă§ăĺł1ăŽăăăŞĺ˝˘ăăăŚăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0253_1" title="ă˘ăŞăŽĺˇŁ" alt="ă˘ăŞăŽĺˇŁ"><br>
ĺłďź<br>
</center>
<br>
<p>
ăăŽăąăźăšăŻă2ćăŽĺĺăŞĺ¸ĺ¤č§ĺ˝˘ s1ăs2 ă¨ä˝ćăăŽéˇćšĺ˝˘ă§ć§ćăăăŚăăžăăs1ăs2 䝼ĺ¤ăŽăăăăăŽéˇćšĺ˝˘ăŽé˘ăĺşăŤćĽăăăăăŤç˝Žăăžăă茳ĺŻăĺ§ăăćąćĺăŻăĺ
ĽăŁăŚăăĺăŽéăĺăăŤăăăăăăăĺşé˘ăŽé¸ăłćšăŤăăŁăŚĺăŽéŤăăĺ¤ăăăă¨ăŤć°äťăăžăăďźĺł2ďźă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_0253_2" title="ă˘ăŞăŽĺˇŁ" alt="ă˘ăŞăŽĺˇŁ"><br>
ĺłďź<br>
</center>
<br>
<p>
ćąćĺăŻăăąăźăšăŽç˝ŽăćšăŤăăŁăŚăăŠăŽăăăéŤăăŞăăçĽăăăăŞăăžăăăĺ¸ĺ¤č§ĺ˝˘ s1 ăŽĺ˝˘ăs1 㨠s2 éăŽčˇé˘ <var>d</var>ăĺăŽä˝çŠ <var>V</var> ăĺ
Ľĺă¨ăăĺăŽéŤăăŽć大ĺ¤ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăĺăŻăăąăźăšăŽĺşé˘ăĺşăŤç˝Žăă¨ăăăŤć°´ĺšłăŤăŞăăăŽă¨ăăžăăéćăąăźăšăŽ s1 ăŽĺ˝˘ăŻăäşćŹĄĺ
ăŽĺş§ć¨ĺšłé˘ä¸ăŽ <var>n</var> ĺăŽé çšă§ä¸ăăăăžăăăăăăŽé çšăŻăĺćč¨ĺăăŽé çŞă§ĺ
Ľĺăăăžăă<var>n</var> 㯠3 äťĽä¸ 100 䝼ä¸ă§ă<var>d</var> 㨠<var>V</var> ăŻăăăă 1 äťĽä¸ 10,000 䝼ä¸ăŽć´ć°ă¨ăăžăăăžăăĺ¤č§ĺ˝˘ăŽé çšăŽĺş§ć¨ <var>(x, y)</var> ㎠<var>x</var>ă<var>y</var> ăŻăăăă -1,000 äťĽä¸ 1,000 䝼ä¸ăŽć´ć°ă¨ăăžăă<var>V</var>ăŻăąăźăšăŽä˝çŠăčś
ăăžăăă
</p>
<!--ĺăŽéŤăăŽć大ĺ¤ăŻĺ°ć°çšäťĽä¸çŹŹ7ä˝ăĺć¨äşĺ
ĽăăŚăĺ°ć°çšçŹŹ6ä˝ăžă§ĺşĺăăŚăă ăăă-->
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăżăŁă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽă¨ăăă§ăă
</p>
<p>
1 čĄçŽ <var>n</var> <var>d</var> <var>V</var>ďźć´ć° ć´ć° ć´ć°ďźĺč§çŠşç˝ĺşĺăďź<br>
2 čĄçŽ 珏 1 ăŽé çšăŽĺş§ć¨ <var>x</var> <var>y</var>ďźć´ć° ć´ć°ďźĺč§çŠşç˝ĺşĺăďź<br>
3 čĄçŽ 珏 2 ăŽé çšăŽĺş§ć¨<br>
:<br>
<var>n+1</var> čĄçŽ 珏 <var>n</var> ăŽé çšăŽĺş§ć¨<br>
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 20 ăčś
ăăžăăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺ
Ľĺăăźăżăťăăăă¨ăŤăĺăŽéŤăăŽć大ĺ¤ăĺşĺăăžăăçăăŤăŻ 0.00001 ăčśăă誤塎ăăăŁăŚăŻăăăžăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
4 1 1
0 0
1 0
1 2
0 2
0 0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
1.000000
</pre>
| [
[
"4 1 1\n0 0\n1 0\n1 2\n0 2\n0 0 0\n",
"4 1 1\n0 0\n1 0\n1 2\n0 2\n0 0 0\n"
]
] |
p00250 | Scone |
<H1>ăšăłăźăłé
éč¨çť</H1>
<p>
ććăăăŽĺŽśăŻăĺ°ăăŞĺŤčśĺşăçľĺśăăŚăăžăăććăăăŽăćŻăăăçźăăšăłăźăłăŻă¨ăŚăçžĺłăăăŚăĺşăŻă¨ăŚăçšçăăŚăăžăăă
</p>
<p>
ăŚă§ă¤ăăŹăšă§ăăććăăăŽäťäşăŽä¸ă¤ăŻă揥ă
ă¨çźăä¸ăăăšăłăźăłăăă厢ć§ăŽĺ¸ăžă§ĺąăăăă¨ă§ăăçźăăăăŁăăšăłăźăłăŻăçăŽä¸ăŤäšăăăăăŤăŚăłăżăźăŽä¸ăŤä¸ĺăŤä¸Śăšăăăžăă<var>i</var> çŞçŽăŽăçăŽä¸ăŤäšăŁăŚăăăšăłăźăłăŽć°ă <var>K<sub>i</sub></var> ă¨ăăžăăăăććăăăŻăăăăăăŽă厢ć§ăŤăĄăă㊠<var>m</var> ĺăŽăšăłăźăłăéă°ăŞăăă°ăŞăăžăăăććăăăŻä¸ĺşŚăŤăăă¤ă§ăăçăćă¤ăă¨ăă§ăăăžăč¤ć°ăŽăçăă 1 äşşăŽă厢ć§ăŤăšăłăźăłăé
ăŁăăăďźă¤ăŽăçăăč¤ć°ăŽă厢ć§ăŤé
ăŁăŚăć§ăăžăăă
</p>
<p>
ĺŤčśĺşăŤăŻă¨ăŚăăăăăăŽă厢ć§ăăăŁăŚăăăŽă§ăăŤăŚăłăżăźăŤç˝ŽăăŚăăĺ
¨ăŚăŽăšăłăźăłăéăă§ăăĺ
¨ăŚăŽă厢ć§ăŤĺąăăăă¨ăŻă§ăăžăăăăăăăă§ăăă ăĺ¤ăăŽă厢ć§ăŤĺąăăĺžă§ă<var>m</var> ĺăŤćşăăŞăć°ăŽăšăłăźăłăä˝ăăă¨ăăăăăăăăžăăăăăŽăăăŞăšăłăźăłăŻăăćäźăăŽăč¤çžă¨ăăŚăććăăă貰ăăăă¨ăŤăŞăăžăăă
<!--ăšăłăźăłăŻă¨ăŚăçžĺłăăăŽă§ăććăăă大弽ăăŞăŽă§ăă-->
</p>
<p>
ăăă§ăľă¨ăććăăăŻčăăžăăăä¸ĺşŚăŤĺ
¨ăŚăŽăçăćă¤ăŽă§ăŻăŞăăä¸é¨ăŽăçă ăăćăŁăŚă厢ć§ăŤăšăłăźăłăĺąăăă¨ăä˝ăăšăłăźăłăŽć°ăéăŁăŚăăăŻăă§ăăéŠĺăŤăçăé¸ăśăă¨ă§ăăăĺ¤ăăŽăšăłăźăłăä˝ăăăăŤă§ăăăăăăăžăăăććăăăŻăä˝çşçăŤăçăé¸ăă§ăăăă¨ăăćŻăăăŤčŚćăăăŞăăăăŤăăŤăŚăłăżăźăŽä¸ăŽ1ă¤ăŽéŁçśăăçŻĺ˛ăŽăçăé¸ăśăă¨ăŤăăžăăăăžăăćŽăŁăăçăŻăçśăăăăćŻăăăéăă§ăăžăăŽă§ăććăăăăšăłăźăłăăăăăăŁăłăšăŻä¸ĺşŚăăăăăžăăă
</p>
<p>
ăăŚăććăăăŻć大ăăă¤ăŽăšăłăźăłă貰ăăă§ăăăăďźč¨çŽăăăăă°ăŠă ăć¸ăăŚăă ăăăăçăŽć° <var>n</var> 㯠1 äťĽä¸ 30,000䝼ä¸ă <var>m</var> 㯠1 äťĽä¸ 100,000 䝼ä¸ă§ăăăžăć°ĺăŽĺčŚç´ <var>K<sub>i</sub></var> 㯠0 äťĽä¸ 2<sup>32</sup>-1 ă§ăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
č¤ć°ăŽăăźăżăťăăăŽä¸Śăłăĺ
Ľĺă¨ăăŚä¸ăăăăžăăĺ
ĽĺăŽçľăăăŻăźăăľăă¤ăŽčĄă§ç¤şăăăžăăĺăăźăżăťăăăŻäťĽä¸ăŽă¨ăăă§ăă
</p>
<p>
1čĄçŽ <var>n</var> <var>m</var>ďźć´ć° ć´ć°ďźĺč§çŠşç˝ĺşĺăďź<br>
2čĄçŽ ăçä¸ăŽăšăłăźăłăŽć
ĺ ą <var>K<sub>1</sub></var> <var>K<sub>2</sub></var> ... <var>K<sub>n</sub></var>ďźăăšăŚć´ć° ; ĺč§çŠşç˝ĺşĺăďź<br>
<var>K<sub>i</sub></var>: <var>i</var>çŞçŽăŽăçä¸ăŽăšăłăźăłăŽć°<br>
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăžăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăăăăăăšăłăźăłăŽć大ć°ăďźčĄăŤĺşĺăăžăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
5 11
11 27 34 45 56
8 5
0 2 1 5 4 6 8 3
5 2
2 4 2 4 6
10 18
10 15 12 31 12 50 11 23 43 181
1 100
5
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
8
4
0
17
5
</pre> | [
[
"5 11\n11 27 34 45 56\n8 5\n0 2 1 5 4 6 8 3\n5 2\n2 4 2 4 6\n10 18\n10 15 12 31 12 50 11 23 43 181\n1 100\n5\n0 0\n",
"5 11\n11 27 34 45 56\n8 5\n0 2 1 5 4 6 8 3\n5 2\n2 4 2 4 6\n10 18\n10 15 12 31 12 50 11 23 43 181\n1 100\n5\n0 0\n"
]
] |
p00251 | Points for a Perfect Scorer |
<H1>10ĺ解ăăăä˝çšĺăăďź</H1>
<p>
é¸ćăŽçăăăăă˝ăłăłç˛ĺĺăŤăăăăăăă˝ăłăłç˛ĺĺăŻäťĺš´ă§10ĺ¨ĺš´ăŤăŞăăžăăăĺşéĄăăăĺéĄć°ăĺč¨ĺžçšăŻĺš´ăŤăăŁăŚç°ăŞăăžăăĺĺéĄăŤăŻéŁć庌ăŤĺżăăŚĺžçšăćąşăăăăŚăăžăăĺéĄć°ă10ĺă§ăăăăăăŽĺéĄăŽĺžçšăä¸ăăăăă¨ăăăăăăŽĺč¨ăĺşĺăăăăă°ăŠă ăä˝ćăăŚä¸ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
s<sub>1</sub>
s<sub>2</sub>
.
.
s<sub>10</sub>
</pre>
<p>
ĺ
ĽĺăŻ10čĄăăăŞăăi čĄçŽăŤĺéĄ i ăŽĺžçšă襨ăć´ć° s<sub>i</sub> (0≤ s<sub>i</sub> ≤ 100)ăä¸ăăăăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺč¨ĺžçšăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺäž1</h2>
<pre>
1
2
3
4
5
6
7
8
9
10
</pre>
<h2>ĺşĺäž1</h2>
<pre>
55
</pre>
<br/>
<h2>ĺ
Ľĺäž2</h2>
<pre>
4
4
8
8
8
10
10
12
16
20
</pre>
<h2>ĺşĺäž2</h2>
<pre>
100
</pre> | [
[
"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n",
"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n"
]
] |
p00252 | Railway Ticket |
<H1>äščťĺ¸</H1>
<p>
ć°ĺššçˇăŤäšăăăăŤăŻăăäščťĺ¸ăăçšćĽĺ¸ăăŽ2ćăŽĺ珌ăĺż
čŚă§ăăçľčˇŻăŽä¸é¨ă§ć°ĺššçˇăĺŠç¨ăăŞăĺ ´ĺăăăăăăăăăăŻĺĽă
ăŽĺ珌ă¨ăŞăŁăŚăăžăăăć°ĺššçˇăŽăżăĺŠç¨ăăçľčˇŻă§ăŻă1ćă§äščťĺ¸ă¨çšćĽĺ¸ăĺ
źăăăäščťăťçšćĽĺ¸ăăçşčĄăăăăă¨ăăăăžăă
</p>
<p>
čŞĺćšććŠă§ăŻăăăăăŽĺ珌ăčŞăżčžźăă§ăćŁăăĺ珌ăćĺ
Ľăăăă¨ăă ăă˛ăźăăéăăŞăăă°ăŞăăžăăăăäščťĺ¸ăă¨ăçšćĽĺ¸ăăăăăďźćăăžăăŻăăăŽä¸ĄćšăăžăăŻăăäščťăťçšćĽĺ¸ăăďźććĺ
ĽăăăăăŠăăăĺ¤ĺŽăăčŞĺćšććŠăŽćăŽééăĺ¤ćăăăăă°ăŠă ăä˝ćăăŚä¸ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
b<sub>1</sub> b<sub>2</sub> b<sub>3</sub>
</pre>
<p>
ĺ
ĽĺăŻďźčĄăăăŞăăďźă¤ăŽçŠşç˝ă§ĺşĺăăăďźă¤ăŽć´ć°ăĺŤăăb<sub>1</sub> ăŻăäščťĺ¸ăăŽćĺ
Ľçść
ăb<sub>2</sub> ăŻăçšćĽĺ¸ăăŽćĺ
Ľçść
ăb<sub>3</sub> ăŻăäščťăťçšćĽĺ¸ăăŽćĺ
Ľçść
ă示ăăćĺ
Ľçść
ăŻ0ăžăăŻ1ă§čĄ¨ăăă0ăŽĺ ´ĺăŻćĺ
ĽăăăŚăăŞăçść
ă1ăŽĺ ´ĺăŻćĺ
ĽăăăŚăăçść
ă襨ăăăă ăăćłĺŽăăăćĺ
Ľçść
ăŽçľăżĺăăăŻäťĽä¸ăŽĺ ´ĺăŽăżă¨ăăă
</p>
<center>
<table class="withborder">
<tr>
<th>ĺ
Ľĺ</th>
<th>ćĺ
Ľçść
</th>
<th>ćĺ
ĽăŤĺŻžăăćăŽĺä˝</th>
</tr>
<tr>
<td>1 0 0</td>
<td>ăäščťĺ¸ăăŽăżćĺ
Ľ</td>
<td>Close</td>
</tr>
<tr>
<td>0 1 0</td>
<td>ăçšćĽĺ¸ăăŽăżćĺ
Ľ</td>
<td>Close</td>
</tr>
<tr>
<td>1 1 0</td>
<td>ăäščťĺ¸ăă¨ăçšćĽĺ¸ăćĺ
Ľ</td>
<td>Open</td>
</tr>
<tr>
<td>0 0 1</td>
<td>ăäščťăťçšćĽĺ¸ăćĺ
Ľ</td>
<td>Open</td>
</tr>
<tr>
<td>0 0 0</td>
<td>ćĺ
ĽăŞă</td>
<td>Close</td>
</tr>
</table>
</center>
<br/>
<h2>ĺşĺ</h2>
<p>
čŞĺćšććŠăŽééă襨ăOpenăžăăŻCloseăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺäž1</h2>
<pre>
0 0 1
</pre>
<h2>ĺşĺäž1</h2>
<pre>
Open
</pre>
<br/>
<h2>ĺ
Ľĺäž2</h2>
<pre>
0 1 0
</pre>
<h2>ĺşĺäž2</h2>
<pre>
Close
</pre> | [
[
"0 0 1\n",
"0 0 1\n"
]
] |
p00253 | Kitchen Garden |
<H1></H1>
<p>
厜ĺşčĺăŤéčăć¤ăăăă¨ăŤăăžăăăn ç˛ăŽç¨ŽăăăŁăăŽă§1ćĽăŤ1ç˛ăă¤ăn ćĽăă㌠n ç˛ăŽç¨ŽăăžăăžăăăăŠăŽç¨Žăăăč˝ăĺşăŚăăăăăă¨č˛ăŁăŚăăžăăĺ犍ăŽććăĺž
ăĄé ăăăăŽă§ăă
</p>
<p>
ăăćĽăăă¤ăăŽăăăŤčăŤć°´ăăăăăŚăăă¨ăăăăăŞăă¨ăŤć°ăĽăăžăăăn ćŹăŽéčăŽčăăăăŻăăŞăŽăŤă1ćŹĺ¤ăăŽă§ăăéčăçăăŚăăŚăăžăăžăăăç´ăĄăŤĺźăŁăćăăăăŽă§ăăăĺ°ăŁăăă¨ăŤăŠăŽčăăăäźźăŚăăŚăéčă¨éčăŽčŚĺăăă¤ăăžăăă
</p>
<p>
ćăăăăŤăŞăăŽăŻăéčăŽćéˇé庌ă§ăăăăŽéčăŻă税ăăžăăŚăăăăŁă¨ă1ćĽăŤćąşăžăŁăéˇăă ă䟸ăłçśăăăŽă§ăăăăăăăăŽăćąşăžăŁăéˇăăă¨ăăăŽăä˝ăťăłăăĄăźăăŤăŞăŽăăŻăăăăžăăăăžăăćĺăŽç¨Žăä˝ćĽĺăŤăžăăăŽăăĺżăăŚăăžăăžăăăčăŻä¸ĺăŤä¸Śăă§ăăžăăăĺŻä¸čŚăăŚăăăŽăŻă税ăăžăă¨ăćŻćĽä¸ç˛ăă¤ĺłăăé ăŤăžăăŚăăŁăăă¨ă ăă§ăă
</p>
<p>
nďźďźćŹăŽčăŽéˇăăĺ
ĽĺăăéčăŽéˇăăĺşĺăăăăă°ăŠă ăä˝ćăăŚä¸ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤čĄă§ç¤şăăăăĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
n
h<sub>1</sub> h<sub>2</sub> h<sub>3</sub> ... h<sub>n+1</sub>
</pre>
<p>
ďźčĄçŽăŽ n (4 ≤ n ≤ 100) ăŻéčăŽčăŽć°ă襨ăć´ć°ă§ăăăďźčĄçŽăŻďźă¤ăŽçŠşç˝ă§ĺşĺăăă n+1 ĺăŽć´ć°ăĺŤăżă h<sub>i</sub> (1 ≤ h<sub>i</sub> ≤ 10<sup>9</sup>)ăŻĺˇŚăăiçŞçŽăŽčăŽéˇăă示ăă
</p>
<p>
h<sub>1</sub> h<sub>2</sub> ... h<sub>n+1</sub> ăç塎ć°ĺăŤăŞăŁăŚăăăăăŞĺ
ĽĺăŻä¸ăăăăŞăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 500 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺăăźăżăťăăăă¨ăŤéčăŽéˇăăĺşĺăă ă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
5
1 2 3 6 4 5
6
1 3 6 9 12 15 18
4
5 7 9 11 12
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
6
1
12
</pre> | [
[
"5\n1 2 3 6 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9 11 12\n0\n",
"5\n1 2 3 6 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9 11 12\n0\n"
]
] |
p00254 | All Numbers Lead to 6174 |
<H1>ăăšăŚăŽć°ăŻďźďźďźďźăŤéă</H1>
<p>
0 ăă 9 ăŽć°ĺăăăŞăĺćĄăŽć° N ăŤĺŻžăăŚäťĽä¸ăŽćä˝ăčĄăă
</p>
<ol>
<li> N ăŽćĄăăăăăŽć°ĺ¤ă大ăăé ăŤä¸Śăšăçľćĺžăć°ă L ă¨ăă</li>
<li> N ăŽćĄăăăăăŽć°ĺ¤ăĺ°ăăé ăŤä¸Śăšăçľćĺžăć°ă S ă¨ăă</li>
<li> 塎 L-S ăć°ăă N ă¨ăă(1ĺĺăŽćä˝çľäş)</li>
<li> ć°ăă N ăŤĺŻžă㌠1. ăăçš°ăčżă</li>
</ol>
<p>
ăăŽă¨ăăĺ
¨ćĄăĺăć°ĺ(0000, 1111ăŞăŠ)ă§ăăĺ ´ĺăé¤ăăăăăăĺćĄăŽć°ăŻăă¤ă㯠6174ăŤăŞăăă¨ăçĽăăăŚăăăäžăă° N = 2012ăŽĺ ´ĺ<br/>
1ĺçŽ (N = 2012): L = 2210, S = 0122, L-S = 2088<br/>
2ĺçŽ (N = 2088): L = 8820, S = 0288, L-S = 8532<br/>
3ĺçŽ (N = 8532): L = 8532, S = 2358, L-S = 6174<br/>
ă¨ăŞăă3 ĺăŽćä˝ă§ 6174 ăŤĺ°éăăă
</p>
<p>
0 ăă 9 ăŽć°ĺăăăŞăĺćĄăŽć°ăä¸ăăăăă¨ăăä˝ĺăŽćä˝ă§ 6174 ăŤĺ°éăăăč¨çŽăăăăă°ăŠă ăä˝ćăăŚä¸ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăă㯠0000 ăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
N
</pre>
<p>
ăăźăżăťăăăŻďźčĄă§ăăăN (1 ≤ N ≤ 9999) ăŻĺćĄăŽć°ă示ăăN < 1000 ăŽĺ ´ĺăŻä¸ăŽćĄăŻ 0 ă§ĺăăăăŚăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 10000 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺăăźăżăťăăăă¨ăŤä˝ĺăŽćä˝ă§ 6174 ăŤĺ°éăăăăďźčĄăŤĺşĺăăăăă ăĺ
¨ćĄăĺăć°ĺă§ăăć°ăĺ
Ľĺă¨ăăŚä¸ăăăăĺ ´ĺ㯠NA ă¨ĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
6174
2012
3333
0000
</pre>
<h2>ĺşĺäž</h2>
<pre>
0
3
NA
</pre> | [
[
"6174\n2012\n3333\n0000\n",
"6174\n2012\n3333\n0000\n"
]
] |
p00255 | Salary for a Plumber |
<H1>ăă¤ăă¤ăŞăčˇäşşăŽçľŚć</H1>
<p>
ăźăăŻăă¤ăă¤ăŞăčˇäşşă§ăăăă¤ăăă¤ăŞăă¸ă§ă¤ăłăă¨ăă¤ăăăăăăăă°ăăŠăăŞăă¤ăă ăŁăŚă¤ăŞăă§ăżăăžăăăźăăŻćŻćĽă茪ćšăăăă¤ăă¨ă¸ă§ă¤ăłăă渥ăăăŚăăăăă¤ăŞăă§čŚŞćšăŤć¸Ąăăžăăă§ăăăă¤ăăŽć°ăĺ¤ăăăă¨ăăŻăďźćĽă§ăăăĺ
¨é¨ă¤ăŞăăăă¨ăŻă§ăăžăăăăăăŞă¨ăă§ă茪ćšăŻăŤăŁăăçŹăŁăŚăăźăăŤçľŚćă渥ăăŚăăăžăă
</p>
<p>
ă¨ăăă§ăăăă¨ăĺ¤ăŞăă¨ăŤć°ăă¤ăăžăăăĺ
¨é¨ăŽăă¤ăăă¤ăŞăăăăă¨ăăăăă¤ăŞăăăăŞăăŁăă¨ăăŽćšă羌ćăĺ¤ăăă¨ăăăăŁăĄă
ăăăăă§ăăăăăžăĺ¤ăŞăŽă§ăăăćĽă茪ćšăćĽăă¨ăăŤă羌ćăŽč¨çŽćšćłăć¸ăăŚăăăĄă˘ăăăŁăăčŚăĄăăăžăăăăăăăăăŞăă¨
</p>
<p>
"羌ćăŻăăă¤ăăŽćŹć°Ăăă¤ăăŽéˇăăŽçˇĺăă§ćŻćăăăă ăăă¸ă§ă¤ăłăă§ă¤ăŞăăŚăă˛ă¨ă¤ăŞăăăŤăŞăŁăăăŽăŻăăăăďźćŹăŽăă¤ăă¨ăżăŞăă"
</p>
<p>
ăŁăŚć¸ăăŚăăăžăăăăăă§ĺ
¨é¨ă¤ăŞăăćšă羌ćăĺŽăăŞăăă¨ăăăççąăăăăăžăăăăă¨ăă°ä¸ĺłăŽăăăŤăéˇă 1 ăŽăă¤ă 3 ćŹă¨éˇă 2 ăŽă¸ă§ă¤ăłă 2 ćŹăĺ
¨é¨ă¤ăŞăăă¨éˇă 1+2+1+2+1 = 7 ăŽăă¤ăă 1 ćŹă§ăăăŽă§ă1 × (7) = 7 ă§ăăă§ăăă¸ă§ă¤ăłăăä¸ă¤ă ă使ăŁăŚéˇă 1+2+1 = 4ăŽăă¤ăă¨éˇă 1 ăŽăă¤ă㎠2 ćŹăŤăăă¨2 × (4+1) = 10ăŞăŽă§ăĺ
¨é¨ă¤ăŞăăăăăăŁăąă羌ćăăăăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_plumber">
</center>
<br/>
<p>
茪ćšăăŞăă§ăăăŞćšćłă§çľŚćăćąşăăŚăăăăăăŞăăăŠăăăă§ăźăăăŠăăăă°ăăăă羌ćăĺ¤ăă§ăăăăăăăžăăďź
</p>
<p>
ăăă§ăŻăăă¤ăăŽćŹć°ăä¸ăăăăă¨ăăăăăă羌ćăŽć大ăŽééĄăč¨çŽăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
n
p<sub>1</sub> ... p<sub>n</sub>
j<sub>1</sub> ... j<sub>n-1</sub>
</pre>
<p>
ďźčĄçŽăŤăă¤ăăŽćŹć° n (2 ≤ n ≤ 65000) ăä¸ăăăăăďźčĄçŽăŻďźă¤ăŽçŠşç˝ă§ĺşĺăăă n ĺăŽć´ć°ăăăŞăăp<sub>i</sub> (1 ≤ p<sub>i</sub> ≤ 1000) ăŻiçŞçŽăŽăă¤ăăŽéˇăă示ăăďźčĄçŽăŻďźă¤ăŽçŠşç˝ă§ĺşĺăăă n-1 ĺăŽć´ć°ăăăŞăăj<sub>i</sub> (1 ≤ j<sub>i</sub> ≤ 1000) 㯠i çŞçŽăŽă¸ă§ă¤ăłăăŽéˇăă示ăă
</p>
<p>
içŞçŽăŽă¸ă§ă¤ăłăăŻăi çŞçŽă¨ i+1 çŞçŽăŽăă¤ăă ăăă¤ăŞăăăă¨ăă§ăăăă¤ăŞăăăă¤ăăŽéˇăăŻăp<sub>i</sub> + j<sub>i</sub> + p<sub>i+1</sub> ăŤăŞăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺăăźăżăťăăăă¨ăŤăĺžăăă羌ćăŽć大ăŽééĄă1čĄăŤĺşĺăăăĺ
Ľĺă¨ăăŚä¸ăăăăăăźăżăťăăă§ăŻăĺşĺăăăĺ¤ăŻĺż
ăďźďźăăă珌ĺˇçĄăć´ć°ăŽçŻĺ˛ăŤĺăžăăăŽă¨ăăă
</p>
<h2>ĺ
Ľĺäž1</h2>
<pre>
3
1 1 1
3 3
4
3 3 3 3
1 1 1
5
1 2 3 4 5
4 3 2 1
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
12
48
76
</pre>
| [
[
"3\n1 1 1\n3 3\n4\n3 3 3 3\n1 1 1\n5\n1 2 3 4 5\n4 3 2 1\n0\n",
"3\n1 1 1\n3 3\n4\n3 3 3 3\n1 1 1\n5\n1 2 3 4 5\n4 3 2 1\n0\n"
]
] |
p00256 | Mayan Crucial Prediction |
<H1>ăă¤ăŽĺ¤§äşč¨</H1>
<p>
çäšĺăŻăăŹăă§ăăă¤ăŽĺ¤§äşč¨ďź2012ĺš´ă§ä¸çăçľăďźăă¨ăăçŞçľăčŚăžăăăçľĺąăä¸çăçľăăăŠăăăŻăăăăăăžăăă§ăăăăçŞçľă§ç´šäťăăăŚăăăă¤ăŽăéˇććŚăă¨ăăćŚăŤčĺłăćăĄăžăăăăăŽçŞçľă§ăŻäťĽä¸ăŽăăăŞčŞŹćăăăŚăăžăăă
</p>
<table cellpadding="18" cellspacing="18">
<tr>
<td>
<p>
ăă¤éˇććŚăŻăĺłăŽčĄ¨ăŽăăăŞĺä˝ăăăŞăăĺ
¨é¨ă§13ăăŻăăĽăł(187ä¸2000ćĽ)ă§ć§ćăăăé常ăŤéˇăćŚă§ăăăăăč¨çŽćłă§ăŻăăăŽćŚăŻç´ĺ
ĺ3114ĺš´8ć11ćĽăŤĺ§ăžă2012ĺš´12ć21ćĽăŤçľăăă¨čăăăăŚăăŚăăăŽăăäťĺš´ăŽ12ć21ćĽă§ä¸çăçľăă¨ăă誏ăĺąăăăăŚăăăăăăă13ăăŻăăĽăłă§ďźăľă¤ăŻăŤă¨ăŞăăäťăŽćŚăçľăăŁăăć°ăăăľă¤ăŻăŤăŤĺ
Ľăă ăă¨ăăčăăăăă
</p>
</td>
<td width="200" style="border:solid 1px #000000">
ďźăăłďźďźćĽ<br/>
ďźăŚăŁăăŤďźďźďźăăł<br/>
ďźăăĽăłďźďźďźăŚăŁăăŤ<br/>
ďźăŤăăĽăłďźďźďźăăĽăł<br/>
ďźăăŻăăĽăłďźďźďźăŤăăĽăł
</td>
<td> </td>
</tr>
</table>
<br/>
<p>
ăăźăăŽäşĺćłăŽčŞçćĽăŻăă¤ćŚă ă¨ä˝ćĽăŤăŞăăŽăăŞďźăçäšĺăŻăăăăăŞćĽăăă¤éˇććŚă§čĄ¨ăăŚăżăăăŞăăžăăă
</p>
<p>
ă§ăŻăçäšĺăŽäťŁăăăŤă輿ćŚă¨ăă¤éˇććŚă¨ăç¸äşĺ¤ćăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻ#ďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
b.ka.t.w.ki
</pre>
<p>
ăžăăŻ
</p>
<pre>
y.m.d
</pre>
<p>
ăăźăżăťăăăŻďźă¤ăŽćĺĺăĺŤăďźčĄăăăŞăăb.ka.t.w.ki ăŻăă¤éˇććŚăŽćĽäťăy.m.d ăŻčĽżćŚăŽćĽäťă§ăăăä¸ăăăăĺä˝ăŻäťĽä¸ăŽéăă§ăăă
</p>
<b>ăă¤éˇććŚ</b><br/>
<table>
<tr>
<td width="40">b</td>
<td width="100">ăăŻăăĽăł</td>
<td width="200">(0 ≤ b< 13)</td>
</tr>
<tr>
<td>ka</td>
<td>ăŤăăĽăł</td>
<td>(0 ≤ ka < 20)</td>
</tr>
<tr>
<td>t</td>
<td>ăăĽăł</td>
<td>(0 ≤ t< 20)</td>
</tr>
<tr>
<td>w</td>
<td>ăŚăŁăăŤ</td>
<td>(0 ≤ w < 18)</td>
</tr>
<tr>
<td>ki</td>
<td>ăăł</td>
<td>(0 ≤ ki < 20)</td>
</tr>
</table>
<br/>
<b>輿ćŚ</b><br/>
<table>
<tr>
<td width="40">y</td>
<td width="100">ĺš´</td>
<td width="200">(2012 ≤ y ≤ 10,000,000)</td>
</tr>
<tr>
<td>m</td>
<td>ć</td>
<td>(1 ≤ m ≤ 12)</td>
</tr>
<tr>
<td>d</td>
<td>ćĽ</td>
<td>(1 ≤ d ≤ 31)</td>
</tr>
</table>
<br/>
<p>
輿ćŚăŽćĽăŽć大ĺ¤ăŻă大ăŽćăĺ°ăŽćăăăăĺš´ăăŠăăă§ĺ¤ăă(ăăă嚴㯠4 ăŽĺć°ăŽĺš´ăŽăăĄă100 ă§ĺ˛ăĺăăŞăĺš´ăă400 ă§ĺ˛ăĺăăĺš´ă§ăă)ăăă¤éˇććŚăŽćĽäťăŽçŻĺ˛ăŻ 0.0.0.0.0 ăă 12.19.19.17.19 ăžă§ă¨ăăăăă ăăăă¤éˇććŚăŽ 0.0.0.0.0 ăŻčĽżćŚăŽ 2012.12.21 ăŤĺŻžĺżăăăăžăă輿ćŚăŽćĽäťăŽçŻĺ˛ăŻ 2012.12.21ăă 10000000.12.31 ăžă§ă¨ăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 500 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺ
Ľĺă輿ćŚăŽă¨ăăŻăă¤éˇććŚăăăă¤éˇććŚăŽă¨ăăŻčĽżćŚăăăăăăĺ
Ľĺă¨ĺă形ĺźă§ĺşĺăăă
ĺ
Ľĺăăă輿ćŚăćçŽăăçľćăăă¤éˇććŚăŽćŹĄăŽăľă¤ăŻăŤăŤĺ
ĽăŁăĺ ´ĺă§ă b.ka.t.w.ki ăŽĺ˝˘ĺźă§ĺşĺăăŚăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
2012.12.31
2.12.16.14.14
7138.5.13
10.5.2.1.5
10000000.12.31
#
</pre>
<h2>ĺşĺäž</h2>
<pre>
0.0.0.0.10
3054.8.15
0.0.0.0.10
6056.2.29
8.19.3.13.2
</pre> | [
[
"2012.12.31\n2.12.16.14.14\n7138.5.13\n10.5.2.1.5\n10000000.12.31\n#\n",
"2012.12.31\n2.12.16.14.14\n7138.5.13\n10.5.2.1.5\n10000000.12.31\n#\n"
]
] |
p00257 | Making Sugoroku |
<H1>ăăăăăä˝ă</H1>
<p>
太éĺăŻăĺäžäźăŽĺŹăă§ăżăăŞă§éăšăăăăŤăăăăăä˝ăăžăăăă˛ăźă ăăăăăăăăăăăŤăăăľăă ăăă¨ăăăăă䝼ĺ¤ăŽăăăăăŽăăšăŽăăă¤ăăŤăďźă¤é˛ăăăăďźă¤ćťăăăŽăăăŤć示ăć¸ăčžźăă§ăăăžăăăăŤăźăŹăăăĺăăŚĺşăć°ă ăé˛ăżăć˘ăžăŁăăăšăŤć示ăć¸ăčžźăă§ăăă°ăăăŽć示ăŤĺžăŁăŚç§ťĺăăžăăăă ăăć示ăŤĺžăŁăŚé˛ăă ĺ
ăŽăăšăŽć示ăŤăŻĺžăăžăăă
</p>
<p>
ăŤăźăŹăăăŻďźăăăăć°ăžă§ăŽéăŽć°ăç確çă§ĺşăăă¨ăă§ăăăăŽă¨ăăžăăăžăăăăăăăăŤéăăăă大ăăŞć°ăĺşăă¨ăăăć示ăŤĺžăă¨ăăăăăăăĺ
ăŤé˛ăă§ăăžăă¨ăăŻăăăăăăŤç§ťĺăăžăăć示ăŤĺžăŁăŚćťăă¨ăăŤăăľăă ăăăăĺăŤćťăŁăŚăăžăă¨ăăŻăăľăă ăăăŤćťăăă¨ăŤăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_makingSugoroku">
</center>
<br/>
<p>
ă¨ăăăăăŤăźăŹăăă¨ăăšăŽć示ăŤăăŁăŚăŻăăăăăăŤăăŠăă¤ăăŞăĺ ´ĺăĺşăŚăăŚăăžăăžăăăă¨ăă°ăĺłăŽăăăŞăăăăăä˝ăŁăă¨ăăžăăăăďźă¨ďźăăĺşăŞăăŤăźăŹăăă使ăă¨ăďźďźďźăŽé ăŤĺşăă°ăăăăăăŤčĄăăžăăăăŻăăăŤďźăĺşăăăăŽĺžăŻä˝ăĺşăŚăć°¸äš
ăŤăăăăăăŤăŻăăŠăçăăžăăă太éĺăŻăăăă¨ăŻçĽăăăŤčŞżĺăŤäšăŁăŚăăĄăăĄăŽăăšăŤć示ăć¸ăčžźăă§ăăžăăžăăă
</p>
<p>
ăăă§ă太éĺăŤäťŁăăŁăŚăăŤăźăŹăăă¨ăăšăŽć示ăŤăăŁăŚăŻăăăăăăăŤăăŠăçăăŞăĺ ´ĺăçăăăăŠăăĺ¤ĺŽăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
max
n
d<sub>1</sub>
d<sub>2</sub>
.
.
.
d<sub>n</sub>
</pre>
<p>
ďźčĄçŽăŤăŤăźăŹăăăĺşăć°ăŽćĺ¤§ĺ¤ max (2 ≤ max ≤ 250) ăä¸ăăăăďźčĄçŽăŤăăľăă ăăă¨ăăăăă䝼ĺ¤ăŽăăšăŽć° n (2 ≤ n ≤ 250) ăä¸ăăăăăçśă n čĄăŤĺăăšăŽć示ă襨ăć° d<sub>i</sub>(-n ≤ d<sub>i</sub> ≤ n) ăä¸ăăăăăd<sub>i</sub> ăăźăăŽă¨ăăŻć示ăć¸ăăŚăăŞăăă¨ăăćŁăŽć°ăŽă¨ă㯠|d<sub>i</sub>| é˛ăć示ăăč˛ ăŽć°ăŽă¨ă㯠|d<sub>i</sub>| ćťăć示ă襨ăďźăăă§ă|x| 㯠x ăŽçľśĺŻžĺ¤ă襨ăďźăĺ
Ľĺăăăĺ¤ăŻăăšăŚć´ć°ă§ăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺăăźăżăťăăăă¨ăŤĺ¤ĺŽçľćăďźčĄăŤĺşĺăăăăŤăźăŹăăă¨ăăšăŽć示ăŤăăŁăŚăŻăăăăăăăŤăăŠăçăăŞăĺ ´ĺăçăăă¨ăăŻăNGăăăăă§ăŞăăă°ăOKăăĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
3
3
-2
1
0
2
4
2
0
-1
-2
2
2
-2
-2
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
OK
NG
NG
</pre>
| [
[
"3\n3\n-2\n1\n0\n2\n4\n2\n0\n-1\n-2\n2\n2\n-2\n-2\n0\n",
"3\n3\n-2\n1\n0\n2\n4\n2\n0\n-1\n-2\n2\n2\n-2\n-2\n0\n"
]
] |
p00258 | Beat Panel |
<H1>ăăźăăăăŤ</H1>
<p>
é太ĺăŻăčżćăŽă˛ăźă ăťăłăżăźă§äşşć°ăŽă˛ăźă ăăăźăăăăŤăăŤăŻăžăŁăŚăăžăăăăŽă˛ăźă ăŻĺłăŽăăăŞă°ăŞăăçśăŤä¸Śăšăăă 4Ă4 ăŽč¨16ĺăŽăăăŤĺăŽăăżăłăăăŞăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_beatPanel">
</center>
<br/>
<p>
ĺłăŽăăăŤă塌ä¸ăăĺłä¸ăŤăăżăł1, ăăżăł2, âŚ, ăăżăł16ăŽé ăŤăăżăłă丌ăă§ăăžăăă˛ăźă ă§ăŻä¸ĺŽééă§ăăźăéłăéł´ăćĺžăŤçľäşéłăéł´ăăžăăăăźăéłăéł´ăă¨ĺćăŤč¤ć°ăŽăăżăłăĺ
ăăžăăďźĺăĺ
ăăŞăĺ ´ĺăăăăžăăăăŹă¤ă¤ăźăŻăăăźăéłăéł´ăŁăç´ĺžăă揥ăŽéłăéł´ăăžă§ăŽéăŤä¸ĄćăŽćă使ăŁăŚč¤ć°ăŽăăżăłăďźĺşŚă ăĺćăŤćźăăă¨ăă§ăăžăăä˝ăćźăăŞăă¨ăăăă¨ăĺŻč˝ă§ăăçľäşéłăéł´ăŁăă¨ĺćăŤă˛ăźă ăŻçľäşăăžăă
</p>
<p>
é太ĺ㯠c éăăŽćźăćšăçżĺžăăŚăăăăăźăéłăéł´ă庌ăŤăăăăăŽćźăćšăŽä¸ăăďźă¤ćąşăăŚăăżăłăćźăăžăăćźăăăăżăłăĺ
ăŁăŚăăă°ăăăăăŽăăżăłăŽĺ
ăŻćśăăćśăăăăżăłăŽć°ăăăŹă¤ă¤ăźăŽăšăłă˘ăŤĺ çŽăăăžăăăžăăä¸ĺşŚĺ
ăŁăăăżăłăŻăăŽăăżăłăćźăăăăžă§ĺ
ăŻćśăăăă¨ăŻăăăžăăă
</p>
<p>
ăăźăéłă n ĺéł´ăă¨ăăŽăăżăłăŽĺ
ăćšă¨é太ĺăçżĺžăăŚăă c éăăŽăăżăłăŽćźăćšăĺ
Ľĺă¨ăăé太ĺăç˛ĺžăăăă¨ăŽă§ăăĺžçšăŽć大ĺ¤ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
n c
a<sub>1,1</sub> a<sub>1,2</sub> ... a<sub>1,16</sub>
a<sub>2,1</sub> a<sub>2,2</sub> ... a<sub>2,16</sub>
...
a<sub>n,1</sub> a<sub>n,2</sub> ... a<sub>n,16</sub>
b<sub>1,1</sub> b<sub>1,2</sub> ... b<sub>1,16</sub>
b<sub>2,1</sub> b<sub>2,2</sub> ... b<sub>2,16</sub>
...
b<sub>c,1</sub> b<sub>c,2</sub> ... b<sub>c,16</sub>
</pre>
<p>
ďźčĄçŽăŻďźă¤ăŽçŠşç˝ă§ĺşĺăăăďźă¤ăŽć´ć°ăăăŞăăn (1 ≤ n ≤ 30) ăŻăăźăéłăŽć°ăc (1 ≤ c ≤ 30) ăŻçżĺžăăŚăăăăżăłăŽćźăćšăŽć°ă示ăăçśă nďźc čĄăŤăăżăłăŽĺ
ăćšă¨ăăżăłăŽćźăćšăä¸ăăăăăčĄä¸ăŽĺ
Ľĺé
çŽăŽĺşĺăăŻďźă¤ăŽçŠşç˝ă§ăăăa<sub>k,i</sub> 㯠k ĺçŽăŽăăźăéłăéł´ăŁăă¨ăăŽăăżăł i ăŽĺ
ăćšăăb<sub>j,i</sub> 㯠c éăä¸ j çŞçŽăŽćźăćšă§ăăżăł i ăćźăăăăăŠăăă襨ăăa<sub>k,i</sub>ăŽĺ¤ăŻ 0 ăăĺ
ăăŞăăă1 ăăĺ
ăăă襨ăăb<sub>j,i</sub> ăŽĺ¤ăŻ 0 ăăćźăăŞăăă1 ăăćźăăă襨ăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 20 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺăăźăżăťăăăă¨ăŤăĺžçšăŽć大ĺ¤ăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
2 2
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
2 2
0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 0
0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0
0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0
0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0
5 3
0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0
1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1
0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0
0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0
0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
8
7
16
</pre>
| [
[
"2 2\n0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1\n1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0\n0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1\n1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0\n2 2\n0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 0\n0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0\n0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0\n0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0\n5 3\n0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0\n1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1\n0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0\n0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0\n0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0\n0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0\n1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0\n0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1\n0 0\n",
"2 2\n0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1\n1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0\n0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1\n1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0\n2 2\n0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 0\n0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0\n0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0\n0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0\n5 3\n0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0\n1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1\n0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0\n0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0\n0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0\n0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0\n1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0\n0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1\n0 0\n"
]
] |
p00259 | Finite Field Calculator |
<H1>ćéä˝éťĺ</H1>
<p>
0䝼ĺ¤ăŽăăšăŚăŽĺŽć°ăŽéć°ăŻĺŽć°ăŤăŞăăžăăăć´ć°ăŽéć°ăć´ć°ăŤăŞăă¨ăŻéăăžăăăč¨čŞăŞăŠă§ 3.0/2.0*2.0 = 3.0 ăŞăŽăŤ 3/2*2 = 2 ăŤăŞăŁăŚăăžăăŽăŻăăŽăăă§ăăă§ăăăç´ ć°ă§ĺ˛ăŁăä˝ăăçăăć´ć°ăĺăăăŽă¨ăżăŞăă¨ă0䝼ĺ¤ăŽăăšăŚăŽć´ć°ăéć°ăăă¤ăăăŤă§ăăžăă
</p>
<p>
ć´ć° x 㨠y ă p ă§ĺ˛ăŁăä˝ăăçăăă¨ăăx ≡ y (mod p) ă¨ć¸ăăžăăp ăç´ ć°ăŽă¨ăăăăŽăă㪠x 㨠y ăĺăăăŽă¨ăżăŞăăŞăăăăšăŚăŽć´ć° n ăŻ0ăă p−1 ăžă§ăŽăŠăăăŽć´ć° x ăŤĺŻžă㌠x ≡ n (mod p) ă¨ăŞăăŽă§ăăăŁăăă { 0, 1, 2, ..., p−1 } ă¨ăăéĺă ăăăăŞăä¸çăčăăă°ăăăă¨ăăăăăžăă
</p>
<p>
ăăŽä¸çă§ăŽĺ ć¸äšé¤ăŻäťĽä¸ăŽăăăŤăŞăăžăă
</p>
<ul>
<li> ĺ çŽ x+y ăŽĺ¤ăŻăx+y ≡ z (mod p) ă¨ăŞă 0 ăă p−1 ăžă§ăŽć° z ăŤăŞăăžăă</li>
<li> ć¸çŽ x−yăŽĺ¤ăŻăy+m ≡ 0 (mod p) ă¨ăŞă 0 ăă p−1 ăžă§ăŽć° mďźăăă y ăŤç¸ĺ˝ăăžăďźăŤă¤ăăŚăx−y ≡ x + m (mod p) ă¨ăŞăăă¨ăăĺžăăăžăăăă¨ăă°ăp = 5ăŽă¨ăă4+1 ≡ 0 (mod 5) ă¨ăŞăăžăăăăŽă¨ăă2−4 ≡ 2+1 ≡ 3 (mod 5) ăăă2−4ăŽĺ¤ăŻ3ăŤăŞăăžăă</li>
<li> äšçŽ x*y ăŽĺ¤ăŻăx*y ≡ z (mod p) ă¨ăŞă 0 ăă p−1 ăžă§ăŽć° z ăŤăŞăăžăă</li>
<li> é¤çŽ x/y ăŽĺ¤ăŻăy*d ≡ 1 (mod p)ă¨ăŞă 0 ăă p−1 ăžă§ăŽć° d ďźăăăyăŽéć°ăŤăŞăăžăďźăŤă¤ăăŚăx/y ≡ x*d (mod p) ă¨ăŞăăă¨ăăĺžăăăžăăăă¨ăă°ăp = 5 ăŽă¨ăă2*3 ⥠1 (mod 5) ăă 3 㯠2 ăŽéć°ăŤăŞăăžăăăăŽă¨ăă1/2 ⥠1*3 ⥠3 (mod 5) ăăă1/2 ăŽĺ¤ăŻ 3 ăŤăŞăăžăă
</ul>
<p>
ăăŽăăăŤăăŚĺ ć¸äšé¤ăŽĺĺćźçŽăăăšăŚ0ăăp−1ăŽçŻĺ˛ăŤĺăžăăžăăăăŽă¨ăăéĺ { 0,1,...,p−1 } ă p ăŽćéä˝ă¨ăăăžăăăăŽćéä˝ăŽä¸ă§ăĺ ć¸äšé¤ă0 ăă p−1 ăžă§ăŽć°ăăŤăăłă使ăŁăŚ çŽčĄĺźăć§ćăăăă¨ăă§ăăžăă
</p>
<p>
p ăŽćéä˝ăŽ 0 䝼ĺ¤ăŽăăšăŚăŽčŚç´ ăéć°ăăă¤ăă¨ăŻăăă§ăŤăăźăŽĺ°ĺŽçă¨ĺźă°ăăćĺăŞĺŽç a<sup>p−1</sup> ≡ 1 (mod p) ăăăăăăžăďźăă ăăp ăŻç´ ć°ăa 㨠p ăŻäşăăŤç´ ďźăp ăŽćéä˝ăŽăăšăŚăŽčŚç´ x 㯠p ă¨äşăăŤç´ ăŞăŽă§ăăăŽĺŽçăă x*x<sup>p-2</sup> ≡ 1 (mod p) ă¨ăŞă x<sup>p-2</sup> ă x ăŽéć°ăŤăŞăăăă§ăă
</p>
<p>
ă§ăŻăç´ ć°ă¨ĺźăä¸ăăăăă¨ăăŤăăăŽç´ ć°ăŽćéä˝ă§ĺźăč¨çŽăăéťĺăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻ0ăŽĺžăŤăłăăłăďźă¤çśăă ăăŽčĄ 0: ă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
p:exp
</pre>
<p>
ăăźăżăťăăăŻďźčĄă§ăăăp (2 ≤ p ≤ 46000) ăŻç´ ć°ăexp ăŻçŽčĄĺźă示ăăexp ăŻĺ ć¸äšé¤ďźăăăă +, -, *, /ďźă¨ăŤăăłă0 ăă p−1 ăžă§ăŽć°ăăć§ćăăăăćźçŽĺăć°ăăŤăăłăŞăŠăŽĺĺžăŤăŻ1ă¤äťĽä¸ăŽçŠşç˝ăçžăăĺŻč˝ć§ăăăăexp ăŽéˇă㯠100,000 ăčś
ăăŞăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 1000 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăč¨çŽçľćăĺşĺăăăĺşĺ形ĺźăŻäťĽä¸ăŽéăă§ăăă
</p>
<pre>
exp = val (mod p)
</pre>
<p>
val ăŻăp ăŽćéä˝ă§ăŽçŽčĄĺź exp ăŽč¨çŽçľćă§ăăăăă ăă0 ă§ăŽé¤çŽăĺŤăžăăă¨ă㯠NG ă¨ĺşĺăăăăžăăexp ăŤçžăăĺ ć¸äšé¤ăăŤăăłăć°ăŽĺĺžăŤăŻçŠşç˝ă犺ăăŞăăă¨ăăă ăă= ăŽĺĺžăŤăŻçŠşç˝ăä¸ă¤ăă¤çŠşăăăăžăăvală¨éăăŤăăłăŽéămodă¨p ăŽéăŤă犺ç˝ăä¸ă¤ăă¤çŠşăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
5: 2 - 3
17: 1 + 3 * (2 + 3 / 5 * 2) + 7
11: 1 / 8 - 5 - 8 * 2
19: 8 / (2 - 3 * 7)
1153: 10 * 3 / 7 + ( 50 + 81 / 22 ) + 11
0:
</pre>
<h2>ĺşĺäž</h2>
<pre>
2-3 = 4 (mod 5)
1+3*(2+3/5*2)+7 = 4 (mod 17)
1/8-5-8*2 = 8 (mod 11)
NG
10*3/7+(50+81/22)+11 = 915 (mod 1153)
</pre>
| [
[
"5: 2 - 3\n17: 1 + 3 * (2 + 3 / 5 * 2) + 7\n11: 1 / 8 - 5 - 8 * 2\n19: 8 / (2 - 3 * 7)\n1153: 10 * 3 / 7 + ( 50 + 81 / 22 ) + 11\n0:\n",
"5: 2 - 3\n17: 1 + 3 * (2 + 3 / 5 * 2) + 7\n11: 1 / 8 - 5 - 8 * 2\n19: 8 / (2 - 3 * 7)\n1153: 10 * 3 / 7 + ( 50 + 81 / 22 ) + 11\n0:\n"
]
] |
p00260 | Cats Going Straight |
<H1>ăăăžăŁăăă</H1>
<p>
ăăă¨ăăăŤăéŤăĺĄăŤĺ˛ăžăă大ăăŞăĺąćˇăăăăžăăăăăŽăĺąćˇăŽä¸ťäşşăŻçŤăă¨ăŚă大弽ăă§ăććăăŁăŚăăçŤăăĄăŽăăăŤăăă¤ăăăăăăăŻăăç¨ćăăŚăăžăăăăč
šă犺ăăăçŤăăĄăŻăéŤăĺĄăă˛ăăă¨éŁăłčśăăăĺąćˇăŽčłăćăŤç˝ŽăăŚăăăăŻăăŤăžăŁăăăăŤé§ăĺŻăăŽă§ăăă
</p>
<p>
ăăćĽä¸ťäşşăŻăĺąćˇăŽä¸ă§ä˝ĺšăăŽçŤăĺăăŚăăăŽăčŚă¤ăăžăăăçŤăăĄăŻăăŻăăć˘ăăŚĺąćˇăŽä¸ă縌横çĄĺ°˝ăŤčľ°ăĺăŁăăŽă§ăăśă¤ăăŁăă蝢ăă ăăăŚăăžăŁăăŽă§ăă丝人ăŻçŤăăĄăŽĺŽĺ
¨ăčăăŚăăăŻăăŽç˝Žăĺ ´ćă塼复ăăăă¨ăŤăăžăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_catGoingStraight">
</center>
<p>
ä¸çŠşăăčŚăă¨ăăăŽăĺąćˇăŽĺĄăŻĺ¤č§ĺ˝˘ăăŞăăŚăăžăă丝人ăŻçŤăăĄăăăŻăăčŚă¤ăăăăăăăŤăćˇĺ°ĺ
ăŽä¸ă§ăăĺ¤č§ĺ˝˘ăŽé çšăŤăăăĺ ´ćă ăăŤăăŻăă罎ăăă¨ăŤăăžăăăăžăçŤăăĄăŻć°ăžăăăŞăŽă§ăĺ¤č§ĺ˝˘ăŽĺ¨ä¸ăŽăŠăŽçšăăăĺąćˇăŤĺ
ĽăŁăŚăăăăŻäşćłă§ăăžăăăăăă§ä¸ťäşşăŻăçŤăăŠăŽçšăăĺ
ĽăŁăă¨ăăŚăăăăŽçšăăç´é˛ăăŚăăăăăŽăăŻăăŤăăŠăçăăăăăŤăăăŻăăé
罎ăăăă¨ăćąşăăžăăă
</p>
<p>
ăăšăŚăŽé çšăŤăăŻăăé
罎ăăă°ăăăŽćĄäťśăćşăăăă¨ăă§ăăžăăăăăăăăŻăăčŁĺ
ăăŚĺăăŽăŻĺ¤§ĺ¤ăŞăŽă§ă丝人ăŻă§ăăă ăĺ°ăŞăć°ăŽé çšăŤăăŻăăé
罎ăăăă¨ćăăžăăăăăŚă丝人ăŻćä˝ä˝çŽćăŤăăŻăăé
罎ăăĺż
čŚăăăă§ăăăăă
</p>
<p>
ăĺąćˇăŽĺĄă襨ăĺ¤č§ĺ˝˘ăĺ
Ľĺă¨ăăăăŻăăé
罎ăăé çšăŽć°ăŽćĺ°ĺ¤ăćąăăăăă°ăŠă ăä˝ćăăŚä¸ăăăăă ăăçŤăŻĺ¤č§ĺ˝˘ăŽĺ
é¨ăŽăżăç´é˛ă§ăăăăŽă¨ăăžăďźčžşăŻĺ¤č§ĺ˝˘ăŽĺ
é¨ăŤĺŤăăăăŽă¨ăăžăďźă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
n
x<sub>1</sub> y<sub>1</sub>
x<sub>2</sub> y<sub>2</sub>
...
x<sub>n</sub> y<sub>n</sub>
</pre>
<p>
ďźčĄçŽăŤĺ¤č§ĺ˝˘ăŽé çšăŽć° n (3 ≤ n ≤ 16) ăä¸ăăăăăçśă n čĄăŤĺ¤č§ĺ˝˘ăŽé çšăŽĺş§ć¨ăä¸ăăăăăn čĄăŽăăăăăŻăďźă¤ăŽçŠşç˝ă§ĺşĺăăăďźă¤ăŽć´ć°ăăăŞăăx<sub>i</sub> (-1000 ≤ x<sub>i</sub> ≤ 1000) 㯠i çŞçŽăŽé çšăŽ x 座ć¨ăy<sub>i</sub> (-1000 ≤ y<sub>i</sub> ≤ 1000) 㯠i çŞçŽăŽé çšăŽ y 座ć¨ă示ăăĺ¤č§ĺ˝˘ăŽé çšăŻăéŁăĺăŁăé çšăĺćč¨ĺăăŤč¨ŞĺăăăăăŞé çŞă§ä¸ăăăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 20 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺăăźăżăťăăăă¨ăŤăă飯ăé
罎ăăé çšăŽć°ăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
8
0 0
3 2
6 2
8 6
6 5
7 7
0 4
3 4
8
0 0
5 3
5 2
4 1
6 1
8 6
6 4
2 4
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
1
2
</pre> | [
[
"8\n0 0\n3 2\n6 2\n8 6\n6 5\n7 7\n0 4\n3 4\n8\n0 0\n5 3\n5 2\n4 1\n6 1\n8 6\n6 4\n2 4\n0\n",
"8\n0 0\n3 2\n6 2\n8 6\n6 5\n7 7\n0 4\n3 4\n8\n0 0\n5 3\n5 2\n4 1\n6 1\n8 6\n6 4\n2 4\n0\n"
]
] |
p00261 | Aka-beko and 40 Thieves |
<H1>ă˘ăŤăťăăłă¨ďźďźäşşăŽçčł</H1>
<p>
40 äşşăŽçčłăăéăăăă¨ăăŚăăă˘ăŤăťăăłăŻăA ĺ¸ăŽčĄä¸ă§éăŤčżˇăŁăŚăăžăŁăăă˘ăŤăťăăłăŻć°ăăă˘ă¸ăăăăB ĺ¸ăŤčĄăăăăŽă ăĺ°ĺłăçčłăŤçăžăăŚăăžăŁăă
</p>
<p>
çčłăŽä¸äşşă§ăăăłăăźć°ăŻă˘ăŤăťăăłăŤĺć
ăăć°ăŽćŻăŤćăŁăŚăăăăăă§ăĺŻăăŤă˘ăŤăťăăłăŤăăăăŞăăB ĺ¸ăŤčĄăăćäźăăăăăăă䝲éăŤă°ăăŞăć§ăŤăăŞăăă°ăŞăăŞăăŽă§ăç´ćĽéé ăćăăăăćăăăă¨ăă§ăăŞăăăăăăăăŞăăŽčłŞĺăŤăŻçăăăăăăă¨äźč¨ăéăŁăă
</p>
<p>
ăłăăźć°ăŻăăââă¨ăăéé ăŻăŠăăăăă¨ăă質ĺăă˘ăŤăťăăłăăĺăĺăă¨ăăăăA ĺ¸ăăBĺ¸ăžă§ăĄăăăŠăăŠăäťăăéé ăŞăYesăăăă§ăŞăăă°No ă¨ăăçăăäźăăăéé ăŽăă§ăăŻăŻäťĽä¸ăŽĺ°ĺłăŤĺžăŁăŚčĄăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_akabeko" width="380">
</center>
<br/>
<p>
ĺé˝ĺ¸ăŻä¸ćšéčĄăŽéă§ă¤ăŞăăŁăŚăăăăăăăăŽéăŤăŻă0 ă1 ăŽć°ĺăäťăăŚăăăă˘ăŤăťăăłăŻć°ĺăŽä¸Śăłă§éé ăćĺŽăăăäžăă°ă0100 㯠A ĺ¸ăă XăZăW ĺ¸ăçľçąă㌠B ĺ¸ăŤăĄăăăŠăăŠăçăéé ă§ăăăĺ°ĺłăŤăŞăéé ăé¸ăśă¨ç ćź ăŤčżˇăčžźăă§ăăžăăćąşă㌠B ĺ¸ăŤăăŠăçăăă¨ăŻăŞăăă˘ăŤăťăăłăŻčŞĺăăăé˝ĺ¸ăŽĺĺăçĽăăă¨ăŻă§ăăŞăăăăéé ăăăŠăçľăăă¨ăăŤăĄăă㊠B ĺ¸ăŤĺ°éăăĺż
čŚăăăă
</p>
<p>
ăłăăźć°ăŻă˘ăŤăťăăłăăăŽčłŞĺăŤçăăăăăŤăăăŞăăĺŻăăŤéăăăă°ăŠă ăŽä˝ćăäžé źăăăă˘ăŤăťăăłăăăŽčłŞĺăĺ
Ľĺăăă¨ăăăăA ĺ¸ăăB ĺ¸ăŤăĄăăăŠăăŠăäťăăéé ăŞă Yesăăăă§ăŞăăă° No ă¨ĺşĺăăăăă°ăŠă ăä˝ćăăŚăťăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăă㯠#ďźăˇăŁăźăďźďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
p
</pre>
<p>
ďźčĄăŤéé ă示ăć°ĺ 0, 1 ăŽä¸Śăł p ăä¸ăăăăăp ăŻ100ćĺăčś
ăăŞăćĺĺă§ăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăYes ăžă㯠No ăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
0100
0101
10100
01000
0101011
0011
011111
#
</pre>
<h2>ĺşĺäž</h2>
<pre>
Yes
No
Yes
No
Yes
No
Yes
</pre>
<p>
ďźă¤çŽăŽăăźăżăťăăă§ăŻăB ĺ¸ăéăăăăŚY ĺ¸ăŤĺ°éăăéé ăŞăŽă§ No ă¨ĺşĺăăă
</p>
<p>
ďźă¤çŽăŽăăźăżăťăăă§ăŻăĺăé˝ĺ¸ăä˝ĺşŚăéăŁăŚăăăăB ĺ¸ăŤăĄăăăŠăăŠăçăéé ăŞăŽă§ Yes ă¨ĺşĺăăă
</p>
<p>
ďźă¤çŽăŽăăźăżăťăăă§ăŻăX ĺ¸ăăç ćź ăŤčżˇăčžźăă§ăăžăB ĺ¸ăŤăŻăăŠăçăăŞăăŽă§ No ă¨ĺşĺăăă
</p>
<p>
ćĺžăŽăăźăżăťăăă§ăŻăB ĺ¸ăăăŁăăéăéăăŚăăăX ĺ¸ă¨Z ĺ¸ăçľçąăăŚB ĺ¸ăŤăĄăăăŠăăŠăçăéé ăŞăŽă§ Yes ă¨ĺşĺăăă
</p> | [
[
"0100\n0101\n10100\n01000\n0101011\n0011\n011111\n#\n",
"0100\n0101\n10100\n01000\n0101011\n0011\n011111\n#\n"
]
] |
p00262 | Triangle of Blocks |
<H1>ăăăăŻăŽä¸č§ĺ˝˘</H1>
<p>
ĺła ăŽăăăŤçŠăžăăăăăăŻăŤĺŻžăă䝼ä¸ăŽä¸Śăšćżăćä˝ăçš°ăčżăă
</p>
<ol>
<li> ä¸çŞä¸ăŽăăăăŻĺ
¨ăŚďźĺła ä¸ăŽç˝ăŽăăăăŻďźăĺłçŤŻăŤć°ăăçŠăżä¸ăăďźćŽăăŽăăăăŻăŻčŞĺçăŤďźćŽľä¸ăŤč˝ăĄăĺłb ăŽăăăŤăŞăďźă</li>
<li> ăăăăŻăŽéăŤééăă§ăăăă塌ăŤčŠ°ăăŚééăăŞăăďźĺł b ăăĺłc ăŽăăăŤăŞăďźă</li>
</ol>
<p>
1 䝼ä¸ăŽć´ć° k ăŤĺŻžăăŚăk×(kďź1)/2 ă§čĄ¨ăăăć° (äž:1, 3, 6, 10, ...)ăä¸č§ć°ă¨ăăăăăăăŻăŽçˇć°ăä¸č§ć°ăŽĺ ´ĺăä¸č¨ăŽä¸Śăšćżăăçš°ăčżăă¨ă塌獯ăŽéŤăă1 ă§ĺłăŤĺăăŁăŚďźă¤ăă¤éŤăăŞăŁăŚăăăăăŞä¸č§ĺ˝˘ăŤăŞăă¨äşćłăăăŚăăďźĺłd ăŻçˇć°ă15 ĺăŽĺ ´ĺďźă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_triangleOfBlocks">
</center>
<br/>
<p>
ăăăăŻăŽćĺăŽä¸Śăłăä¸ăăăăă¨ăăăăăăăćąşăăăăĺć°äťĽä¸ăŽćä˝ă§ăä¸ă§čŞŹćăăăăăŞăăăăŻăŽä¸č§ĺ˝˘ăă§ăăă¨ăăä¸č§ĺ˝˘ăĺžăăăăžă§ăŽćĺ°ăŽćä˝ĺć°ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
N
b<sub>1</sub> b<sub>2</sub> ... b<sub>N</sub>
</pre>
<p>
ĺăăźăżăťăăăŻďźčĄă§ăăăăăăăŻăŽćĺăŽä¸Śăłă襨ăăN (1 ≤ N ≤ 100)ăŻăä¸çŞä¸ăŽćŽľăŤăăăăăăŻăŽć°ă示ăăb<sub>i</sub>(1 ≤ bi ≤ 10000) ăŻĺˇŚăă i çŞçŽăŽä˝ç˝ŽăŤçŠăžăăŚăăăăăăŻăŽć°ă示ăăb<sub>i</sub> 㨠b<sub>i+1</sub> ăŻďźă¤ăŽçŠşç˝ă§ĺşĺăăăŚăăăăăăăŻăŽçˇć°ăŻ 3 䝼ä¸ă§ăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 20 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăä¸č§ĺ˝˘ăă§ăăăžă§ăŤčĄăŁă丌ăšćżăćä˝ăŽĺć°ăďźčĄăŤĺşĺăăăăă ăăä¸č§ĺ˝˘ăä˝ăăŞăĺ ´ĺăăćä˝ĺć°ă 10000 ĺăčś
ăăĺ ´ĺ㯠-1 ăĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
6
1 4 1 3 2 4
5
1 2 3 4 5
10
1 1 1 1 1 1 1 1 1 1
9
1 1 1 1 1 1 1 1 1
12
1 4 1 3 2 4 3 3 2 1 2 2
1
5050
3
10000 10000 100
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
24
0
10
-1
48
5049
-1
</pre>
<p>
ćĺăŽăăźăżăťăăăăĺłăŤç¤şăăĺ ´ĺăŤĺŻžĺżăăă<br/>
ďźă¤çŽăŽăăźăżăťăăăăăăăăŻăŽçˇć°ăä¸č§ć°ă§ăŞăăăăä¸č§ĺ˝˘ăä˝ăăŞăĺ ´ĺăŤĺŻžĺżăăă<br/>
ćĺžăŽăăźăżăťăăăăăăăăŻăŽçˇć°ăŻä¸č§ć°ă ăăćä˝ĺć°ă 10000 ĺăčś
ăăĺ ´ĺăŤĺŻžĺżăăă
</p> | [
[
"6\n1 4 1 3 2 4\n5\n1 2 3 4 5\n10\n1 1 1 1 1 1 1 1 1 1\n9\n1 1 1 1 1 1 1 1 1\n12\n1 4 1 3 2 4 3 3 2 1 2 2\n1\n5050\n3\n10000 10000 100\n0\n",
"6\n1 4 1 3 2 4\n5\n1 2 3 4 5\n10\n1 1 1 1 1 1 1 1 1 1\n9\n1 1 1 1 1 1 1 1 1\n12\n1 4 1 3 2 4 3 3 2 1 2 2\n1\n5050\n3\n10000 10000 100\n0\n"
]
] |
p00263 | Kongo Type |
<H1>éĺăŽĺ</H1>
<p>
䝼ä¸ăŽăăăŤăĺłăă 7 ăăăĺăĺ°ć°é¨ăçśă24 ăăăĺăć´ć°é¨ă§ăä¸çŞĺˇŚăŽ 1 ăăăĺă珌ĺˇé¨ă¨ăă 32 ăăăĺŽć°ĺăčăă(b<sub>1</sub>, ... , b<sub>32</sub> 㯠0 ă1 ă襨ăďźă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_kongoType1" width="780">
</center><br/>
<p>
ăăŽĺ˝˘ĺźăăäşşăç解ăăăă 10 é˛ć°čĄ¨çžăŤç´ăă¨ăăŻă䝼ä¸ăŽăăăŤč§Łéăăă<br/>
(-1)<sup>珌ĺˇé¨</sup> × (ć´ć°é¨ + ĺ°ć°é¨)
</p>
<p>
ä¸ăŽčĄ¨çžă§ăć´ć°é¨ăŽĺ¤ăŻ b<sub>8</sub> ďź 2<sup>1</sup>×b<sub>9</sub> ďź 2<sup>2</sup>×b<sub>10</sub>ďź ... ďź 2<sup>23</sup>×b<sub>31</sub> ăŤăŞăăäžăă°ć´ć°é¨ă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_kongoType2">
</center><br/>
<p>
ăŽăăăŤăŞăŁăŚăăĺ ´ĺăć´ć°é¨ăŽĺ¤ăŻäťĽä¸ăŽăăăŤč¨çŽăăăă<br/>
1 + 2<sup>1</sup> + 2<sup>3</sup> = 1 + 2 + 8 = 11
</p>
<p>
ä¸ćšăĺ°ć°é¨ăŽĺ¤ăŻ(0.5)<sup>1</sup>×b<sub>7</sub>ďź(0.5)<sup>2</sup>×b<sub>6</sub> ďź ... ďź (0.5)<sup>7</sup> × b<sub>1</sub> ăŤăŞăăäžăă°ĺ°ć°é¨ă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_kongoType3">
</center><br/>
<p>
ăŽăăăŤăŞăŁăŚăăĺ ´ĺăĺ°ć°é¨ăŻäťĽä¸ăŽăăăŤč¨çŽăăăă<br/>
0.5<sup>1</sup> + 0.5<sup>3</sup> = 0.5 + 0.125 = 0.625
</p>
<p>
ăăăŤă珌ĺˇé¨ăć´ć°é¨ăĺ°ć°é¨ăĺăăă䝼ä¸ăŽăăăŞăăăĺăŽĺ ´ĺă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_kongoType4" width="780">
</center><br/>
<p>
ăăăĺĺ
¨ä˝ă襨ă10 é˛ć°ăŻă䝼ä¸ăŽăăăŤăŞă(ăă ăă-1 ăŽ0 äšăŻ1)ă<br/>
(-1)<sup>0</sup> × (1 + 2 + 8 + 0.5 + 0.125) = 1 × (11.625) = 11.625<br/>
</p>
<p>
32 ăăăăŽăăăĺă Q ĺĺ
Ľĺăăă¨ăăăăăŽăăăĺă襨ăĺŽć°ăŽ10 é˛čĄ¨č¨ăä¸ĺăŽčŞ¤ĺˇŽçĄăĺş
ĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻďźă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
Q
s<sub>1</sub>
s<sub>2</sub>
.
.
.
s<sub>Q</sub>
</pre>
<p>
1 čĄçŽăŤăăăĺăŽć° Q (1 ≤ Q ≤ 10000)ăä¸ăăăăăçśăQ čĄăŤĺ
Ľĺăăăĺ s<sub>i</sub> ăä¸ăăăăă ĺ
Ľĺăăăĺ㯠16 é˛ć°čĄ¨č¨ă§ä¸ăăăăă¨ăă (äž: 0111 1111 1000 1000 0000 0000 0000 0000 㯠7f880000 ă¨ä¸ăăăă) ăă¤ăžăăQ čĄăŽăăăăăŤăŻă2 é˛ć°ă 4 ăăăĺăă¤ăžă¨ăă 16 é˛ć°ă 8 ĺă犺ç˝ăăŻăăžăăŤä¸Śăă§ăăă10 é˛ć°ă2 é˛ć°ă16 é˛ć°ăŽĺŻžĺżăŻäťĽä¸ăŽčĄ¨ăŽă¨ăăă§ăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_kongoType5" width="780">
</center><br/>
<p>
16 é˛ć°ăŽčąĺ a ăă f ăžă§ăŻĺ°ćĺă§ä¸ăăăăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺăăăĺă襨ăĺŽć°ăŽ 10 é˛čĄ¨č¨ă 1 čĄăă¤ĺşĺăăăăă ăăĺ°ć°é¨ăŤăăăŚăăăćĄäťĽä¸ăăăšăŚ 0 ăŽĺ ´ĺăăăŽćĄäťĽä¸ăŻççĽăăăăŽă¨ăăăăäžĺ¤ă¨ăăŚĺ°ć°é¨ă 0 ăŽĺ ´ĺăŻĺ°ć°é¨ăŤăŻ 0 ă˛ă¨ă¤ăĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
8
00000000
80000000
00000080
00000040
000000c0
00000100
80000780
80000f70
</pre>
<h2>ĺşĺäž</h2>
<pre>
0.0
-0.0
1.0
0.5
1.5
2.0
-15.0
-30.875
</pre> | [
[
"8\n00000000\n80000000\n00000080\n00000040\n000000c0\n00000100\n80000780\n80000f70\n",
"8\n00000000\n80000000\n00000080\n00000040\n000000c0\n00000100\n80000780\n80000f70\n"
]
] |
p00264 | East Wind |
<H1>風ăăç§ăŽć˘
ăŽéŚăăĺąăăŚăăăďź</H1>
<p>
ĺźăŁčśăăćąşăžăăăăŽĺ°ăĺťăăă¨ăŤăŞăŁăăăăŽĺĺ°čŞä˝ăŤćŞçˇ´ăŻçĄăăăďźă¤ă ăć°ăŤăŞăăă¨ăăăăăăăŻăĺşăŤć¤ăăć˘
ăŽć¨ăŽăă¨ă ăç§ăŻćŻĺš´ăăăŽć˘
ăčąăĺ˛ăăăă¨ă漽ăăżăŤăăŚăăăăăăé˘ăăĺžăŻćĽăŽćĽ˝ăăżăďźă¤ć¸ăŁăŚăăžăăç§ăŽć˘
ăŽéŚăă ăă§ă風ăŤäšăŁăŚĺźăŁčśăĺ
ăŽĺŽśăžă§ĺąăăćĽă漽ăăžăăŚăŻăăăŞăăăŽăă
</p>
<p>
ćĽćŹăŤăŻćĽă蹥垴ăăďźă¤ăŽčąăăăăć˘
ăťćĄăťćĄăŽďźă¤ă ăĺźăŁčśăĺ
ăŤăŻăç§ăŽć˘
䝼ĺ¤ăŤăăăăăăŽčąăŽéŚăăĺąăă ăăăăăăăç§ăŽć˘
ăŽéŚăă ăăĺąăćĽć°ăćăĺ¤ă厜ăŤä˝ăżăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_kochi" width="380">
</center>
<br/>
<p>
ĺłăŽăăăŤăčąăŽéŚăăŻćçśăŤĺşăăăăăŽé ĺăŻé˘¨ăŽĺăăćšĺă¨ĺźˇăăŤăăŁăŚćąşăžăăć形ăŻé˘¨ăŽĺăăćšĺ w ăä¸ĺżăŤăăŚĺŻžç§°ăŤĺşăăă風ăŽĺźˇă a ăĺĺžă¨ăăé ĺăăă¤ăéŚăăĺşăăč§ĺşŚ d ăŻčąăŽç¨ŽéĄăŤăăŁăŚćąşăžăŁăŚăăăă風ăŽĺăăćšĺă¨ĺźˇăăŻćĽăŤăăŁăŚç°ăŞăăăă ăăĺăćĽă§ăŻăăăšăŚăŽĺ ´ćă§é˘¨ăŽĺăăćšĺă¨ĺźˇăăŻĺăă§ăăă
</p>
<p>
ćĺ
ăŤăŻăç§ăŽć˘
䝼ĺ¤ăŽć˘
ăťćĄăťćĄăŽä˝ç˝Žă¨čąăŽç¨ŽéĄăă¨ăŽéŚăăĺşăăč§ĺşŚăĺźăŁčśăĺ
ăŽĺŽśăŽĺčŁăŽăăźăżăăăăăăăŤăć°ćĽĺăŽé˘¨ăŽĺăăćšĺă¨ĺźˇăăŽăăźăżăăăăç§ăŽć˘
䝼ĺ¤ăŽć˘
ăťćĄăťćĄăŽć¨ă¨ĺŽśăŽä˝ç˝ŽăŻăç§ăŽć˘
ăŽä˝ç˝Žăĺçšă¨ăă座ć¨ă§ç¤şăăăŚăăă
</p>
<p>
ăăăăŽăăźăżă使ăŁăŚăç§ăŽć˘
ăŽéŚăă ăăĺąăćĽć°ăŽćăĺ¤ă厜ăć˘ăăăăŽăăă°ăŠă ăć¸ăăŚăżăăă¨ă¨ăăăăç§ăŻćč˝ăŞăăă°ăŠăăźăŞăŽă ăăďź
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
H R
hx<sub>1</sub> hy<sub>1</sub>
hx<sub>2</sub> hy<sub>2</sub>
:
hx<sub>H</sub> hy<sub>H</sub>
U M S du dm ds
ux<sub>1</sub> uy<sub>1</sub>
ux<sub>2</sub> uy<sub>2</sub>
:
ux<sub>U</sub> uy<sub>U</sub>
mx<sub>1</sub> my<sub>1</sub>
mx<sub>2</sub> my<sub>2</sub>
:
mx<sub>M</sub> my<sub>M</sub>
sx<sub>1</sub> sy<sub>1</sub>
sx<sub>2</sub> sy<sub>2</sub>
:
sx<sub>S</sub> sy<sub>S</sub>
w<sub>1</sub> a<sub>1</sub>
w<sub>2</sub> a<sub>2</sub>
:
w<sub>R</sub> a<sub>R</sub>
</pre>
<p>
ĺčĄă§ä¸ăăăăć°ĺ¤ăŻďźă¤ăŽçŠşç˝ă§ĺşĺăăăŚăăă
</p>
<p>
ďźčĄçŽăŤĺźăŁčśăĺ
ăŽĺŽśăŽĺčŁăŽć° H (1 ≤ H ≤ 100) ă¨é˘¨ăŽč¨é˛ăŽć° R (1 ≤ R ≤ 100) ăä¸ăăăăăçśăH čĄăŤĺźăŁčśăĺ
ăŽĺŽśăŽä˝ç˝Žăä¸ăăăăăhx<sub>i</sub> ă¨hy<sub>i</sub>㯠i çŞçŽăŽĺŽśăŽ x 座ć¨ă¨ y 座ć¨ă示ă-1000 䝼ä¸1000 䝼ä¸ăŽć´ć°ă§ăăă
</p>
<p>
çśăďźčĄăŤăç§ăŽć˘
䝼ĺ¤ăŽć˘
ăŽć¨ăŽć° U ă¨ăćĄăťćĄăŽć¨ăŽć° MăSăć˘
ăťćĄăťćĄăŽéŚăăĺşăăč§ĺşŚduădmăds ăä¸ăăăăăUăMăS ăŽçŻĺ˛ăŻ 0 䝼ä¸10 䝼ä¸ă§ăăăč§ĺşŚăŽĺä˝ăŻĺşŚă§ăăă1 䝼ä¸180 ćŞćşăŽć´ć°ă§ăăă
<?p>
çśă U čĄăŤç§ăŽć˘
䝼ĺ¤ăŽć˘
ăŽć¨ăŽä˝ç˝Žăçśă M čĄăŤćĄăŽć¨ăŽä˝ç˝Žăçśă S čĄăŤćĄăŽć¨ăŽä˝ç˝Žăä¸ăăăăăuxi 㨠uyiămxi 㨠myiăsxi 㨠syi ăŻăăăăăi çŞçŽăŽć˘
ăťćĄăťćĄăŽć¨ăŽ x 座ć¨ă¨ y 座ć¨ă示ăă-1000 äťĽä¸ 1000 䝼ä¸ăŽć´ć°ă§ăăă
</p>
<p>
çśă R čĄăŤé˘¨ăŽč¨é˛ăä¸ăăăăăw<sub>i</sub> (0 ≤ w<sub>i</sub> < 360) 㨠a<sub>i</sub>(0 < a<sub>i</sub> ≤ 100) 㯠i ćĽçŽăŽé˘¨ăŽĺăăćšĺă¨ĺźˇăă襨ăć´ć°ă§ăăă風ăŽĺăăćšĺăŻăx 蝸ăŽćŁăŽĺăăăĺćč¨ĺăăŤć¸ŹăŁăč§ĺşŚă§čĄ¨ăăĺä˝ăŻĺşŚă¨ăăă
</p>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽćĄäťśăćşăăă¨čăăŚăăă
</p>
<ul>
<li> ĺ
Ľĺăăă座ć¨ăŻăăšăŚç°ăŞăăăŽă¨ăăă</li>
<li> ĺçšăŤăŻç§ăŽć˘
䝼ĺ¤çĄăă</li>
<li> ăŠăŽčąăŤă¤ăăŚăăčąăŽéŚăăĺąăé ĺăŽĺ˘çăăčˇé˘ă 0.001 䝼ĺ
ăŤăŻĺŽśăŻçĄăă</li>
</ul>
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăç§ăŽć˘
ăŽéŚăă ăăĺąăćĽć°ăŽćăĺ¤ăĺ
¨ăŚăŽĺŽśăŽçŞĺˇăăĺ°ăăé ăŤďźčĄăŤĺşĺăăă厜ăŽçŞĺˇăŽéăŻçŠşç˝ďźă¤ă§ĺşĺăăčĄăŽçľăăăŤăŻçŠşç˝ćĺăĺşĺăăŞăă
</p>
<p>
ăă ăăăŠăŽĺŽśăŤă¤ăăŚăăç§ăŽć˘
ăŽčąăŽéŚăă ăăĺąăćĽăďźćĽăăŞăăă°ăNA ă¨ĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
6 3
2 1
1 2
5 2
1 3
1 5
-2 3
1 1 1 90 30 45
3 -4
-3 0
2 -2
45 6
90 6
135 6
2 1
1 3
5 2
0 1 1 90 30 45
-3 0
2 -2
45 6
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
5 6
NA
</pre> | [
[
"6 3\n2 1\n1 2\n5 2\n1 3\n1 5\n-2 3\n1 1 1 90 30 45\n3 -4\n-3 0\n2 -2\n45 6\n90 6\n135 6\n2 1\n1 3\n5 2\n0 1 1 90 30 45\n-3 0\n2 -2\n45 6\n0 0\n",
"6 3\n2 1\n1 2\n5 2\n1 3\n1 5\n-2 3\n1 1 1 90 30 45\n3 -4\n-3 0\n2 -2\n45 6\n90 6\n135 6\n2 1\n1 3\n5 2\n0 1 1 90 30 45\n-3 0\n2 -2\n45 6\n0 0\n"
]
] |
p00265 | Modular Query |
<H1>ă˘ă¸ăĽăăťăŻă¨ăŞ</H1>
<p>
ăăŞă㍠N ćăŽăŤăźăă渥ăăžăăăŠăŽăŤăźăăŤăä¸ă¤ă ăčŞçść°ăć¸ăăŚăăăžăăăă ăăĺăć°ăć¸ăăŚăăăă¨ăŻăăăžăăă
</p>
<p>
ăăăă質ĺă¨ăăŚăéŠĺ˝ăŞčŞçść°ăč¨ăăžăăăăŞăăćăŁăŚăăăŤăźăăŤć¸ăăŚăăć°ăç§ăč¨ăŁăć°ă§ĺ˛ăŁăă¨ăăŤĺžăăăä˝ăăŽăăĄćă大ăăŞăăŽăçăăŚăă ăăă
</p>
<p>
ăă¨ăă°ăăăŞă㯠3 ćăŽăŤăźăăćăŁăŚăăŚăăăăă 9ă3ă8 ă¨ć¸ăăŚăăă¨ăăžăăç§ăă4ăă¨č¨ăŁăăă9 㨠3 㨠8 ăăăăă4 ă§ĺ˛ăŁăä˝ăăćąăăŚăă ăăăä˝ăăŻăăăă 1ă3ă0 ă§ăăăăăŽä¸ă§ăăŁă¨ă大ăăŞä˝ăăŻ3 ăŞăŽă§ă3 ăćŁăăçăăŤăŞăăžăă
</p>
<p>
ă§ăŻĺ§ăăžăăăăăăďź ăŤăźăăăăŁăąăăăă¨ăăă¸ăă ďź ăăăăăŞăă§ăăăăăă§ăŻăł
ăłăăĽăźăżă使ăŁăŚć大ăŽä˝ăăčŚă¤ăăăă¨ăŤăăžăăăăăŤăźăăŤć¸ăăŚăăć°ăă質ĺăăăć°ă§ĺ˛ăŁăä˝ăăŽăăĄăć大ăŽăăŽăčŚă¤ăăăăă°ăŠă ăä˝ćăăŚăă ăăăăŞăă質ĺăŻďźĺă ăă§ăŞăä˝ĺşŚăăăžăăăĺăć°ă 2 ĺ䝼ä¸čłŞĺăăăă¨ăŻăăăžăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻďźă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
N Q
c<sub>1</sub> c<sub>2</sub> ... c<sub>N</sub>
q<sub>1</sub>
q<sub>2</sub>
:
q<sub>Q</sub>
</pre>
<p>
ďźčĄçŽăŤăŤăźăăŽćć° N (2 ≤ N ≤ 300000) ă¨čłŞĺăŽĺć° Q (2 ≤ Q ≤ 100000) ăďźă¤ăŽçŠşç˝ĺşĺăă§ä¸ăăăăďźčĄçŽăŤăŤăźăăŤć¸ăăăć° c<sub>i</sub> (1 ≤ c<sub>i</sub> ≤ 300000) ăďźă¤ăŽçŠşç˝ĺşĺăă§ä¸ăăăăăçśăQ čĄăŤčłŞĺă¨ăăŚä¸ăăăăć° q<sub>i</sub> (1 ≤ q<sub>i</sub> ≤ 300000) ăä¸ăăăăă
</p>
<h2>ĺşĺ</h2>
<p>
質ĺăă¨ăŤć大ăŽä˝ăăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
3 3
9 3 8
4
6
5
</pre>
<h2>ĺşĺäž</h2>
<pre>
3
3
4
</pre> | [
[
"3 3\n9 3 8\n4\n6\n5\n",
"3 3\n9 3 8\n4\n6\n5\n"
]
] |
p00266 | Izua Dictionary |
<H1>ă¤ă
ă˘ĺ˝čŞčžĺ
¸</H1>
<p>
ăăŞăăŻă¤ă
ă˘ĺ˝ăŽĺ
Źç¨čŞă§ăăă¤ă
ă˘čŞăŽĺ˝čŞčžĺ
¸ă¨ăă¤ă
ă˘čŞăŽă˘ăŤăăĄăăăďźćĺăŽä¸čŚ§čĄ¨ďź
ăćăŤĺ
Ľăăžăăăă¤ă
ă˘čŞăŽă˘ăŤăăĄăăăăŤăŻN 税éĄăŽćĺăăăăžăăă¤ă
ă˘čŞăŽĺ˝čŞčžĺ
¸ăŤçžăăĺčŞăŽé çŞăŻăă¤ă
ă˘čŞăŽă˘ăŤăăĄăăăé ăŤä¸Śăă§ăăžăă
</p>
<p>
čžĺ
¸ăčŚăă¨ăčźăŁăŚăăăŠăŽĺčŞăN ćĺă§ăăăăăN 税éĄăŽćĺăă˛ă¨ă¤ăă¤ĺŤăă§ăăăă¨ăăăăăžăăăăăăŤčŞżăšăŚăżăă¨ăčžĺ
¸ăŤăŻN 税éĄăŽćĺăŽĺŻč˝ăŞä¸ŚăłćšăăăšăŚć¸ăăăŚăăăă¨ăçşčŚăăžăăă
</p>
<p>
ăăŽçşčŚăăăăăŞăăŻăăĺčŞăčžĺ
¸ăŽä˝çŞçŽăŤĺşăŚăăăăăăăăăŤăŞăăžăăăăăŽçĽčăĺŠç¨ăăŚă¤ă
ă˘ĺ˝ăŽäşşăéŠăăăŚăżăžăăăăăžăăN 税éĄăŽćĺăă˛ă¨ă¤ăă¤ă˘ăŤăăĄăăăé ăŤä¸Śăšăžăă揥ăŤăäťťćăŽďźćĺăŽé çŞăĺ
Ľăćżăăćä˝ă R ĺçš°ăčżăăŚăăăăžăăăăŞăăŻăĺşćĽä¸ăăŁăĺčŞăă¤ă
ă˘ĺ˝čŞčžĺ
¸ăŽä˝çŞçŽăŤĺşăŚăăăĺ˝ăŚăŚčŚăăžăăăăŽăăăŽćşĺă¨ăăŚăĺ˝čŞčžĺ
¸ä¸ăŽĺčŞăŽĺ ´ćăćąăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăă˘ăŤăăĄăăăé ă§ćĺăŽĺčŞă 0 çŞçŽăŽĺčŞă¨ăăžăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
N
R
s<sub>1</sub> t<sub>1</sub>
s<sub>2</sub> t<sub>2</sub>
:
s<sub>R</sub> t<sub>R</sub>
</pre>
<p>
ďźčĄçŽăŤă˘ăŤăăĄăăăăć§ćăăćĺăŽć° N (1 ≤ N ≤ 100000) ăä¸ăăăăďźčĄçŽăŤćĺăĺ
ĽăćżăăŚăăăĺć° R (0 ≤ R ≤ 50) ăä¸ăăăăăçśă R čĄăŤăĺ
ĽăćżăăăăćĺăŽä˝ç˝ŽăŽçľăä¸ăăăăăs<sub>i</sub> 㨠t<sub>i</sub> (1 ≤ s<sub>i</sub> < t<sub>i</sub> ≤ N) ăŻăĺ
é ăăć°ă㌠s<sub>i</sub> çŞçŽă¨ t<sub>i</sub> çŞçŽăŽćĺă i ĺçŽăŤĺ
Ľăćżăăăă¨ă襨ăăs<sub>i</sub> 㨠t<sub>i</sub> ăŻďźă¤ăŽçŠşç˝ă§ĺşĺăăăŚăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ100 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăĺ
ĽăćżăăçľăăŁăćçšă§ĺžăăăĺčŞăĺ˝čŞčžĺ
¸ăŽä˝çŞçŽăŤçžăăăă示ăć°ăďźčĄăŤĺşĺăăăăă ăăĺşĺăăšăĺ¤ăŻé常ăŤĺ¤§ăăăŞăăăăŽă§ă䝣ăă㍠1,000,000,007 ă§ĺ˛ăŁăä˝ăăĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
3
2
1 2
2 3
4
2
2 3
2 4
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
3
4
</pre>
<p>
ĺ
ĽĺşĺäžăŽćĺăŽăăźăżăťăăăŤă¤ăăŚčŞŹćăăă誏ćăŽăăăă˘ăŤăăĄăăăăŻĺ°ăăćšăăé çŞăŤă'A', 'B', 'C' ăŽďźćĺăăăŞăă¨ăăăăăăăŽćĺăă˘ăŤăăĄăăăé ăŤä¸Śăšă㨠"ABC" ă¨ăăćĺĺăĺžăăăăăăŽćĺĺăŽďźçŞçŽăŽćĺ 'A' ă¨ďźçŞçŽăŽćĺ 'B' ăĺ
Ľăćżăăă¨ă"BAC" ă¨ăăćĺĺăĺžăăăă揥ăŤăĺžăăăćĺĺăŽďźçŞçŽăŽćĺ 'A' ă¨ďźçŞçŽăŽćĺ 'C' ăĺ
Ľăćżăăă¨ăĺčŞ "BCA" ăĺžăăăăčžĺ
¸ăŤăŻăĺ
é ăăé ㍠"ABC", "ACB", "BAC", "BCA", "CAB", "CBA" ăŽďźç¨ŽéĄăŽĺčŞăčźăŁăŚăăă"BCA" ăŻăăŽä¸ă§ďźçŞçŽďźćĺăŽ"ABC"ăďźçŞçŽă§ăăăă¨ăŤćł¨ćďźăŤçžăăăŽă§ă3 ă 1,000,000,007 ă§ĺ˛ăŁăä˝ăă§ăă 3 ăçăăŤăŞăă
</P> | [
[
"3\n2\n1 2\n2 3\n4\n2\n2 3\n2 4\n0\n",
"3\n2\n1 2\n2 3\n4\n2\n2 3\n2 4\n0\n"
]
] |
p00267 | The Lonely Girl's Lie |
<H1>ĺŻăăăĺąăŽă¤ăăĺ</H1>
<p>
ăăąăăă˘ăłăšăżăźă¨ăăă˛ăźă ăăăăžăăă˘ăłăšăżăźăćăžăăč˛ăŚăćŚăăăă交ćăăăăăă˛ăźă ă§ăćĽćŹä¸ă§ĺ¤§ćľčĄăăŚăăžăăăăĄăăăăăăăŽăŻăŠăšă§ăăă ăăăăăăăăŽă˛ăźă ă§ăżăăŞă¨éăšăăăăŤă˘ăłăšăżăźăč˛ăŚăŚăăăăŠăć˛ăăăă¨ăŤĺŻžćŚăăç¸ćăăăžăăăăăăăŻçŠćĽľçăŤäşşăŤčŠąăăăăăŽăĺžćăŞăżă¤ăă§ăŻăŞăăăă§ăăă ăăäťćĽăăăŻăŠăšăĄă¤ăăčŞăŁăŚăăăăŽăĺž
ăĄăŞăăăçŹăĺŻăăă˘ăłăšăżăźăŽăŹăăŤăä¸ăăŚăăžăă
</p>
<p>
ăăăŚă¤ăăŤăĺž
ăĄćăă§ăăçŹéă訪ăăžăăăăŻăŠăšăĄă¤ăăŽä¸äşşă寞ćŚăăŞăăă¨ăăăăŤčŠąăćăĄăăăŚăăăŽă§ăăă彟弳ăŻčŞć
˘ć°ăŤă彟弳ăŽă˘ăłăšăżăźăăĄăčŚăăŚăăăžăăă
</p>
<p>
ä¸čŹçăŞăăąăăă˘ăłăšăżăźăŽĺŻžćŚăŤăźăŤă§ăŻăĺăăŹă¤ă¤ăźăăăăăN ĺšăŽă˘ăłăšăżăźăç¨ćăăäşăăŤ1 ĺšăă¤ćŚăăăžăăĺă˘ăłăšăżăźăŤăŻćéˇăŽĺşŚĺăă示ăăăŹăăŤăă¨ăăć°ĺ¤ăăăăăŹăăŤă大ăăă˘ăłăšăżăźăĺż
ăĺăĄăžăăĺăŹăăŤăŽă¨ăăŻĺźăĺăă§ăăä¸ĺşŚćŚăŁăă˘ăłăšăżăźăŻăăă䝼ä¸ćŚăăăăă¨ăă§ăăžăăăăăăăŚä¸ĺŻžä¸ăŽćŚăăN ĺčĄăŁăăă¨ăéĺć°ăŽĺĺŠăĺăăăăŹă¤ă¤ăźăĺč
ă¨ăŞăăžăă
</p>
<p>
ăăăăŻă彟弳ăŽă˘ăłăšăżăźăčŚăçŹéăĺŤăŞäşćăăăžăăă彟弳ăŽă˘ăłăšăżăźăŻăŠăăăă¨ăŚă埡ăăăŞăŽă§ăăăăăă¨ćŚăŁăŚăăăăŽăŞăč˛ ăăŚăăăžăăžăăăă§ăăăăžăăŤăă˛ăŠăč˛ ăćšăăăăă"ăăă¤ă¨ćŚăŁăŚăé˘ç˝ăăŞăăŞ"ă¨ăćăăăŚăăăéăă§ăăăŞăăŞăăăăăŞăăăŞăăăăŻăă¨ăŚăĺŤă§ăăă ăăă<br/>
ăăăăăăăăăžă ă˘ăłăšăżăźăN ĺšćăŁăŚăŞăăŚă
</p>
<p>
ĺăă¤ăăžăăă
</p>
<p>
N ĺĺč˛ ă§ăŻĺăĄçŽăăŞăăŚăăăăăăĺ°ăŞăć°ăŽă˘ăłăšăżăźă§ĺč˛ ăăçšĺĽăŤăźăŤăŞăăăăăăăăĺăŚăăăăăăžăăăăăŁăăŻč˛ ăăăŁăŚăăžăăŞăă¨č¨ăŁăăăŠăăăŁăąăĺăŚăăĺŹăăă§ăă
</p>
<p>
彟弳ăŻăăŽçšĺĽăŤăźăŤăĺăĺ
ĽăăŚăăăžăăăă¤ăžăăäşäşşăćăŁăŚăăă˘ăłăšăżăźăăăäşă㍠k ĺšé¸ăă§ä¸ĺšăă¤é çŞăŤćŚăăăéĺć°ăŽ(ă¤ăžăăk/2 ăă大ăăŞć°ăŽ) ĺĺŠăĺăăćšăĺăĄă¨ăŞăăžăă
</p>
<p>
ăăŁăăăăăŻă彟弳ăŽă˘ăłăšăżăźăŽăŹăăŤăçĽăŁăŚăăžăăžăăă彟弳ăăŠăŽă˘ăłăšăżăźăé¸ăłăăŠăăŞé çŞă§ĺşăăŚăăăŽăăŻăăăăžăăăă§ăă寞ćŚăăăă˘ăłăšăżăźăŽć°kăăăăăăăžăćąşăăă°ă彟弳ăăŠăăŞé¸ćăăăăă¨ăăăăĺă¤ăă¨ăă§ăăăăăăăžăăă
</p>
<p>
çăăăŤăéĄăă§ăăă˘ăłăšăżăźăŽć° N ă¨ăäşäşşăćăŁăŚăăă˘ăłăšăżăźăŽăŹăăŤăĺ
Ľĺăăă¨ă彟弳ăăŠăăŞé¸ćăăăăă¨ăăăăĺăŚăăăăŞćĺ°ăŽă˘ăłăšăżăźăŽć° k ăĺşĺăăăăă°ăŠă ăä˝ćăăŚä¸ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
N
a<sub>1</sub> a<sub>2</sub> ... a<sub>N</sub>
b<sub>1</sub> b<sub>2</sub> ... b<sub>N</sub>
</pre>
<p>
ďźčĄçŽăŤă˘ăłăšăżăźăŽć° N (1 ≤ N ≤ 40000) ăä¸ăăăăăďźčĄçŽăŤčŞĺăŽă˘ăłăšăżăźăŽăŹă㍠a<sub>i</sub> (1 ≤ a<sub>i</sub> ≤ 100000) ăďźă¤ăŽçŠşç˝ĺşĺăă§ä¸ăăăăăďźčĄçŽăŤăŻăŠăšăĄă¤ăăŽă˘ăłăšăżăźăŽăŹă㍠b<sub>i</sub> (1 ≤ b<sub>i</sub> ≤ 100000) ăďźă¤ăŽçŠşç˝ĺşĺăă§ä¸ăăăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăk (1 ≤ k < N) ăĺĺ¨ăăă°ćĺ°ĺ¤ăďźčĄăŤĺşĺăăăăăăk ăĺĺ¨ăăŞăăăk ă N ăŤçăăăă° NA ă¨ĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
10
4 9 1 9 5 9 2 3 2 1
8 7 6 5 10 5 5 4 7 6
5
4 3 2 5 1
4 4 4 4 4
4
4 1 3 2
4 3 2 1
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
3
1
NA
</pre>
<p>
ďźă¤çŽăŽăăźăżăťăăă§ăŻăăăăăŻďźĺšă§ăŽĺŻžćŚăććĄăăăŹăăŤă [9, 9, 9] ăŽă˘ăłăšăżăźăé¸ăšă°čŻăăç¸ćăŽăŹă㍠10 䝼ĺ¤ăŽăŠăŽă˘ăłăšăżăźăŤăĺăŚăăŽă§ăĺ°ăŞăă¨ăďźĺă§ăăăďźĺšă§ăŽĺŻžćŚă§ăŻ ďźĺďźćăŤăŞăĺŻč˝ć§ăăăăăăăŻéĺć°ăŽĺĺŠă¨ăŻč¨ăăŞăăŽă§ă2 ăŻçăăŤăŞăăŞăă
</p>
<p>
ďźă¤çŽăŽăăźăżăťăăă§ăŻăăăăăŻć埡ăŽă˘ăłăšăżăźăďźĺšé¸ăšă°čŻăă
</p>
<p>
ďźă¤çŽăŽăăźăżăťăăă§ăŻăăăăăăŠăŽ k ĺšăé¸ăłăăŠăŽé çŞă§ĺşăăă¨ăăŚăă彟弳ăĺ
¨ăĺăă˘ăłăšăżăźăĺăé çŞă§ĺşăăŚăăŚĺźăĺăăŤăŞăĺŻč˝ć§ăăăăăăăăŁăŚăă彟弳ăăŠăăŞé¸ćăăăăă¨ăăăăĺă¤ăă¨ăă§ăăăă¨ăŻč¨ăĺăăŞăă
</p>
| [
[
"10\n4 9 1 9 5 9 2 3 2 1\n8 7 6 5 10 5 5 4 7 6\n5\n4 3 2 5 1\n4 4 4 4 4\n4\n4 1 3 2\n4 3 2 1\n0\n",
"10\n4 9 1 9 5 9 2 3 2 1\n8 7 6 5 10 5 5 4 7 6\n5\n4 3 2 5 1\n4 4 4 4 4\n4\n4 1 3 2\n4 3 2 1\n0\n"
]
] |
p00268 | Cats Going Straight II |
<H1>ăăăžăŁăăăďź </H1>
<p>
ăăă¨ăăăŤĺ¤§ăăŞĺ¤ăăĺąćˇăăăăďźĺšăŽăăăä˝ăżçăăŚăăžăăăĺłăŽăăăŤăăĺąćˇăŻä¸çŠşăăčŚăă¨ĺ¸ĺ¤č§ĺ˝˘ăŤăŞăŁăŚăăăăžăŁăăăŞĺŁă§ĺ˛ăžăăăăă¤ăăŽé¨ĺąă§é ăăăŚăăžăăďźćăŽĺŁăŻăăŽä¸ĄçŤŻăŤăăćąăŤăăŁăŚćŻăăăăŚăăžăăăĺąćˇăŻă¨ăŚăĺ¤ăăăăăŠăŽĺŁăŤăăăăéăăă¨ăă§ăăăăăăŽçŠ´ăďźă¤çŠşăăŚăăžăăăăăŻĺŁăŽçŠ´ăéăŁăŚăĺąćˇăŽé¨ĺąă¨é¨ĺąăžăăŻé¨ĺąă¨ĺ¤ăčĄăćĽăăăă¨ăă§ăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_catsGoingStraightII" width="300">
</center><br/>
<p>
ăĺąćˇăŽă丝人ăŻăăăăŤé¤ăăăăăăăŤăĺŁçŹăĺšăăŚăăăăĺąćˇăŽĺ¤ă¸ĺźăłĺşăăžăăăăăŻă¨ăŚă賢ăăă丝人ăĺŁçŹăĺšăă¨ăăćčŻăŽé¸ćăă§ăĺąćˇăŽĺ¤ă¸ćăĺşăăžăăă¤ăžăăćăĺ°ăŞăĺć°ă ă犴ăéăŁăŚĺ¤ă¸ĺşăžăă
</p>
<p>
ăăăŻă¨ăŚăć°ăžăăă§ăăŠăŽé¨ĺąăŤăăăĺăăăžăăăăăŽăăăăăăăĺąćˇăŽĺ¤ă¸ĺşăăŽăŤăăăćéăŻćĽăŤăăŁăŚç°ăŞăăă丝人ăŻăŠăă ăĺž
ăŚă°ăăăăăăăĺ°ăŁăŚăăžăăăăăćă丝人ăŻăăăă犴ăéăćăăă¨ăăŤăă¨ăŚăćéăăăăŁăŚăăăă¨ăŤć°ăäťăăžăăăă¨ăăăă¨ăŻăăăăĺ¤ăŤĺşăăŽăŤăăăćéăŻçŠ´ăéăĺć°ăŤăăŁăŚćąşăžăăă¨ăŤăŞăăžăăă丝人ăŻăăăăăćčŻăŽé¸ćăăăăĺ ´ĺăŽçŠ´ăéăĺć°ăŽć大ĺ¤ăĺăăă°ăăăăăŠăŽé¨ĺąăŤăăă¨ăăŚăăć大ăŠăă ăĺž
ăŚă°ăăăĺăăăŽă§ăŻăŞăăă¨čăăžăăăă丝人ăŻăĺąćˇăŽéĺăăçĽăŁăŚăăžăăăăĺąćˇăŻă¨ăŚă大ăăăčŞĺă§ăŻč¨çŽăăăă¨ăă§ăăžăă...ă
</p>
<p>
ăĺąćˇăŽéĺăăčŞăżčžźăżăăăăăćčŻăŽé¸ćăăăăĺ ´ĺăĺ¤ăŤĺşăăžă§ăŤéă犴ăŽć°ăŽć大ĺ¤ă
ĺşĺăăăăă°ăŠă ăä˝ćăăŚä¸ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
C W
x<sub>1</sub> y<sub>1</sub>
x<sub>2</sub> y<sub>2</sub>
:
x<sub>C</sub> y<sub>C</sub>
s<sub>1</sub> t<sub>1</sub>
s<sub>2</sub> t<sub>2</sub>
:
s<sub>W</sub> t<sub>W</sub>
</pre>
<p>
ĺčĄă§ä¸ăăăăć°ĺ¤ăŻďźă¤ăŽçŠşç˝ă§ĺşĺăăăŚăăă
</p>
<p>
ďźčĄçŽăŤćąăŽć° C (3 ≤ C ≤ 100) ă¨ĺŁăŽć° W (3 ≤ W ≤ 300) ăä¸ăăăăăçśă C čĄăŤćąăŽĺş§ć¨ăä¸ăăăăăx<sub>i</sub> (-1000 ≤ x<sub>i</sub> ≤ 1000) 㯠i çŞçŽăŽćąăŽ x 座ć¨ăy<sub>i</sub> (-1000 ≤ y<sub>i</sub> ≤ 1000) 㯠i çŞçŽăŽćąăŽ y 座ć¨ăăăăă示ăć´ć°ă§ăăăćąăŤăŻăăăă 1 ăă C ăžă§ăŽçŞĺˇăĺ˛ăĺ˝ăŚăăăŚăăă çśă W čĄăŤĺŁăŽć
ĺ ąăä¸ăăăăă
</p>
<p>
s<sub>i</sub> (1 ≤ s<sub>i</sub> ≤ C)ăt<sub>i</sub> (1 ≤ t<sub>i</sub> ≤ C) ăŻĺŁăŽä¸ĄçŤŻăćŻăăćąăŽçŞĺˇă示ăă
</p>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽćĄäťśăćşăăă¨čăăŚăăă
</p>
<ul>
<li> ç°ăŞăćąăĺăä˝ç˝Žăĺ ăăăă¨ăŻăŞăă</li>
<li> ç°ăŞăĺŁăéăŞăŁăăăćąäťĽĺ¤ă§äş¤ĺˇŽăăăă¨ăŻăŞăă</li>
<li> ďźă¤ăŽćąăŻďźă¤äťĽä¸ăŽĺŁăćŻăăŚăăă</li>
<li> ĺŁăŽéˇă㯠0 ăă大ăăă</li>
<li> ćąăŻĺŁăŽä¸ĄçŤŻă ăăŤăăăă¤ăžăăćąăĺŁăŽéä¸ăŤăăăă¨ăŻăŞăă</li>
<li> ĺŁăŻç°ăŞăďźă¤ăŽé¨ĺąăăăăăŻé¨ĺąă¨ĺ¤ă¨ăäťĺăă</li>
<li> äťťćăŽç°ăŞăďźă¤ăŽćąăé¸ăă ă¨ăăäşăăŽćąăŤăŻĺŁăăăŠăŁăŚĺ°éă§ăăă</li>
</ul>
<p>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăăăăăćčŻăŽé¸ćăăăăĺ ´ĺăĺ¤ăŤĺşăăžă§ăŤéă犴ăŽć°ăŽć大ĺ¤ăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
4 4
0 0
1 0
1 1
0 1
1 2
1 4
2 3
3 4
12 22
2 0
4 0
8 0
4 2
6 2
8 2
2 4
4 4
6 4
0 6
8 6
0 8
1 2
2 3
1 4
1 7
1 10
2 4
2 5
3 5
3 6
4 5
4 8
5 6
5 9
6 9
6 11
7 10
7 8
8 9
9 11
10 11
10 12
11 12
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
1
3
</pre>
<p>
ďźă¤çŽăŽăăźăżăťăăăăĺé ăŽĺłăŤç¤şăăăĺąćˇăŽéĺăăŤĺŻžĺżăăăĺłăŽăăăŤăčăč˛ăĺĄăăăé¨ĺąăŤăăăăăă¨ăăŻăăćčŻăŽé¸ćăă§ĺ¤ăŤĺşăăžă§ăŤéăćăă犴ăŽć°ăŻďźă¤ă§ăăăăă䝼ĺ¤ăŽé¨ĺąăŤăăăăăă¨ăăŻăďźă¤äťĽä¸ă§ĺ¤ăŤĺşăăăăăăăăŁăŚăăăăăćčŻăŽé¸ćăăăăă¨ăăĺ¤ăŤĺşăăžă§ăŤéăćăă犴ăŽć°ăŽć大ĺ¤ăŻ 3 ăŤăŞăă
</p> | [
[
"4 4\n0 0\n1 0\n1 1\n0 1\n1 2\n1 4\n2 3\n3 4\n12 22\n2 0\n4 0\n8 0\n4 2\n6 2\n8 2\n2 4\n4 4\n6 4\n0 6\n8 6\n0 8\n1 2\n2 3\n1 4\n1 7\n1 10\n2 4\n2 5\n3 5\n3 6\n4 5\n4 8\n5 6\n5 9\n6 9\n6 11\n7 10\n7 8\n8 9\n9 11\n10 11\n10 12\n11 12\n0 0\n",
"4 4\n0 0\n1 0\n1 1\n0 1\n1 2\n1 4\n2 3\n3 4\n12 22\n2 0\n4 0\n8 0\n4 2\n6 2\n8 2\n2 4\n4 4\n6 4\n0 6\n8 6\n0 8\n1 2\n2 3\n1 4\n1 7\n1 10\n2 4\n2 5\n3 5\n3 6\n4 5\n4 8\n5 6\n5 9\n6 9\n6 11\n7 10\n7 8\n8 9\n9 11\n10 11\n10 12\n11 12\n0 0\n"
]
] |
p00269 | Arts and Crafts |
<H1>ĺłçťĺˇĽä˝</H1>
<p>
ă¤ă
ă˘ĺ¤§ĺŚéĺąĺ°ĺŚć ĄăŻćĽćŹćć°ăŽçŤśćăăă°ăŠăăźé¤ćć Ąă¨ăăŚćĺă§ăăăăŽĺŚć ĄăŽćĺĄăŻĺš
ĺşă
ă˘ăŤă´ăŞăşă ăŽçĽčăćăĄăćĽă
ăăăć´ťç¨ăăŚăăžăăćĺĄă§ăăăăŞăăŻăäťĺš´ăŻĺłçťĺˇĽä˝ăŽććĽ
ăć
ĺ˝ăăăă¨ăŤăŞăăžăăăăăŽććĽă§ăŻăĺ
獼ĺ
¨ĺĄăăăăăďźĺš´éă§ä¸ă¤ăŽčŞ˛éĄăĺŽćăăăăă¨ăŤăŞăŁăŚăăžăăććĽăŽćŚčŚăŻäťĽä¸ăŽă¨ăăă§ăă
</p>
<ul>
<li> ďźĺš´éă§ććĽăŻ D ĺďźĺăćĽăŤ2 ĺ䝼ä¸ććĽăŻăŞăďźăăăăăŽĺ
¨ăŚă課éĄĺśä˝ăŤĺ
ăŚăăăă</li>
<li> ĺśä˝ăă課éĄăŻ M 税éĄç¨ćăăăŚăăă</li>
<li> ăăăăăŽĺ
獼ăŤăM 税éĄăŽä¸ăă課éĄăďźă¤ăă¤ĺ˛ăĺ˝ăŚăă</li>
<li> ĺ
獼㯠N äşşă§ăăăN äşşăăăăăŤç°ăŞă課éĄăĺ˛ăĺ˝ăŚăăăă</li>
</ul>
<p>
ĺ
獼ăŻăK 税éĄăăé¨ĺăŽăăĄăăă¤ăăŽç¨ŽéĄăŽé¨ĺă使ç¨ăăŚčŞ˛éĄăĺŽćăăăžăă課éĄăŽĺśä˝ăŽćŚčŚăŻäťĽä¸ăŽă¨ăăă§ăă
</p>
<ul>
<li> 課éĄăă¨ăŤă使ç¨ăăšăé¨ĺăŽç¨ŽéĄă¨ć°ăŻăăăăăćąşăăăăŚăăă</li>
<li> 課éĄăĺŽćăăăžă§ăŤä˝żç¨ăăé¨ĺăŽç¨ŽéĄă¨ć°ăŻăăăŽčŞ˛éĄă§ä˝żç¨ăăšăé¨ĺăŽç¨ŽéĄă¨ć°ăŤăéä¸čśłăŞăä¸č´ăăŚăăŞăăă°ăŞăăŞăă</li>
<li> ç°ăŞă課éĄă§ăă使ăăăé¨ĺăŽç¨ŽéĄă¨ć°ăăăšăŚĺăĺ ´ĺăăăă</li>
<li> ăŠăŽčŞ˛éĄăăĺă税éĄăŽé¨ĺăŻďźĺăžă§ăă使ç¨ă§ăăŞăă</li>
<li> é¨ĺă使ç¨ăăé ĺşăŻčŞ˛éĄăŽĺŽćăŤĺ˝ąéżăä¸ăăŞăă</li>
<li> ăăă¤ăăŽé¨ĺăĺ
ĽăŁăŚăăč˘ăäşĺ㍠P ĺç¨ćăăăŚăăăăă ăăç°ăŞăč˘ă§ăăĺ
ĽăŁăŚăăé¨ĺăŽç¨ŽéĄă¨ć°ăăăšăŚĺăĺ ´ĺăăăă</li>
<li> ćĺĄăŻăĺ
獼ďźäşşăŤă¤ăč˘ăďźă¤ă ă渥ăăă¨ăă§ăăďźč˘ă渥ăăŞăĺ
獼ăăăŚăăăďźă</li>
<li> ďźäşşäťĽä¸ăŽĺ
獼ăŤĺăč˘ă渥ăăă¨ăŻă§ăăŞăďźĺ寞ăŤă誰ăŤă渥ăăăŞăč˘ăăăŁăŚăăăďźă</li>
<li> č˘ă渥ăăăĺ
獼ăŻăč˘ăŽä¸ăŤĺ
ĽăŁăŚăăé¨ĺăăăšăŚăčŞĺăĺśä˝ăă課éĄăŤä˝żăăŞăăă°ăŞăăŞăă</li>
</ul>
<p>
č˘ăŤĺ
ĽăŁăŚăăé¨ĺ䝼ĺ¤ă§čŞ˛éĄăŤä˝żç¨ăăé¨ĺăŻăĺĽéčłźĺ
Ľăăĺż
čŚăăăăžăăé¨ĺăŽčłźĺ
ĽăŤé˘ăăćĄäťśăŻäťĽä¸ăŽă¨ăăă§ăă
</p>
<ul>
<li> é¨ĺăŻććĽăŽćĽă ăčłźĺ
Ľă§ăăăăŽćĽăŤăă使ăăŞăă</li>
<li> ăăăăăŽčŞ˛éĄăŤă¤ăăŚăďźĺăŽććĽă§ďźŹĺăžă§ăŽé¨ĺăčłźĺ
Ľăăăă¨ăă§ăăă</li>
<li> é¨ĺăŽç¨ŽéĄăŤăăŁăŚäžĄć źăč¨ĺŽăăăŚăăăčłźĺ
ĽăăćĽăŤăăŁăŚäžĄć źăĺ¤ĺăăăăă ăăăŠăŽç¨ŽéĄăĺĺăăŤăŞăăă¨ăŻăŞăă</li>
</ul>
<p>
ăăŞăăŻăăăŽăăăŞćĄäťśä¸ă§ăććĽăŤăăăçľč˛ťăăŞăăšăćăăăă¨čăăŚăăžăăăăă§ăĺ
獼ĺ
¨ĺĄăŽé¨ĺčłźĺ
Ľč˛ťăŽĺč¨ăŽćĺ°ĺ¤ăč¨çŽăăăăă°ăŠă ăä˝ćăăăă¨ăŤăăžăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
D K L
c<sub>1,1</sub> c<sub>1,2</sub> ... c<sub>1,K</sub>
c<sub>2,1</sub> c<sub>2,2</sub> ... c<sub>2,K</sub>
:
c<sub>D,1</sub> c<sub>D,2</sub> ... c<sub>D,K</sub>
M N P
r<sub>1,1</sub> r<sub>1,2</sub> ... r<sub>1,K</sub>
r<sub>2,1</sub> r<sub>2,2</sub> ... r<sub>2,K</sub>
:
r<sub>M,1</sub> r<sub>M,2</sub> ... r<sub>M,K</sub>
t<sub>1,1</sub> t<sub>1,2</sub> ... t<sub>1,K</sub>
t<sub>2,1</sub> t<sub>2,2</sub> ... t<sub>2,K</sub>
:
t<sub>P,1</sub> t<sub>P,2</sub> ... t<sub>P,K</sub>
</pre>
<p>
ĺčĄă§ä¸ăăăăć°ĺ¤ăŻďźă¤ăŽçŠşç˝ă§ĺşĺăăăŚăăă
</p>
<p>
Dďź1 ≤ D ≤ 8ďźăŻććĽăŽĺć°ăKďź1 ≤ K ≤ 8ďźăŻé¨ĺăŽç¨ŽéĄăŽć°ăLďź1 ≤ L ≤ 8ďźăŻďźćĽăŤčłźĺ
Ľăăăă¨ăă§ăăé¨ĺăŽć°ă示ăăc<sub>d,k</sub> ďź1 ≤ c<sub>d,k</sub> ≤ 100ďźăŻ d ćĽçŽăŽé¨ĺk ăŽäžĄć źă示ăă
</p>
<p>
Mďź1 ≤ M ≤ 200ďźăŻčŞ˛éĄăŽç¨ŽéĄăŽć°ăNďź1 ≤ N ≤ MďźăŻçĺžăŽäşşć°ăPďź1 ≤ P ≤ 200ďźăŻč˘ăŽć°ă示ăă
</p>
<p>
r<sub>m,k</sub> ďź0 ≤ r<sub>m,k</sub> ≤ 2ďźăŻčŞ˛éĄ m ăŤĺż
čŚăŞé¨ĺ k ăŽĺć°ăt<sub>p,k</sub> ďź0 ≤ t<sub>p,k</sub> ≤ 2ďźăŻč˘ p ăŤĺ
ĽăŁăŚăăé¨ĺ k ăŽĺć°ă示ăă
</p>
<p>
é¨ĺăďźă¤ăĺż
čŚă¨ăăŞă課éĄăă犺ăŽč˘ăŻä¸ăăăăŞăăăŽă¨ăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ20 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăçĺžĺ
¨ĺĄăŽé¨ĺčłźĺ
Ľč˛ťăŽĺč¨ăŽćĺ°ĺ¤ăďźčĄăŤĺşĺăăă税éĄăŽä˝ĺăĺŽćăăăăă¨ăă§ăăŞăĺ ´ĺ㯠-1 ăĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
2 2 1
5 3
2 2
3 3 1
2 0
1 2
2 2
1 1
2 2 1
5 3
2 2
3 2 1
2 0
1 2
2 2
1 1
2 2 2
5 3
2 2
3 2 1
2 0
1 2
2 2
1 1
4 3 1
2 2 1
3 2 2
2 3 3
1 2 2
5 4 3
1 1 0
1 0 1
1 0 2
1 1 2
2 2 2
1 0 1
2 0 2
1 1 1
0 0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
-1
9
6
7
</pre> | [
[
"2 2 1\n5 3\n2 2\n3 3 1\n2 0\n1 2\n2 2\n1 1\n2 2 1\n5 3\n2 2\n3 2 1\n2 0\n1 2\n2 2\n1 1\n2 2 2\n5 3\n2 2\n3 2 1\n2 0\n1 2\n2 2\n1 1\n4 3 1\n2 2 1\n3 2 2\n2 3 3\n1 2 2\n5 4 3\n1 1 0\n1 0 1\n1 0 2\n1 1 2\n2 2 2\n1 0 1\n2 0 2\n1 1 1\n0 0 0\n",
"2 2 1\n5 3\n2 2\n3 3 1\n2 0\n1 2\n2 2\n1 1\n2 2 1\n5 3\n2 2\n3 2 1\n2 0\n1 2\n2 2\n1 1\n2 2 2\n5 3\n2 2\n3 2 1\n2 0\n1 2\n2 2\n1 1\n4 3 1\n2 2 1\n3 2 2\n2 3 3\n1 2 2\n5 4 3\n1 1 0\n1 0 1\n1 0 2\n1 1 2\n2 2 2\n1 0 1\n2 0 2\n1 1 1\n0 0 0\n"
]
] |
p00270 | Railroad |
<H1>éé衯çˇ</H1>
<p>
ăăĺ˝ăŽéé眲ăŤăčŞĺćšćăĺ°ĺ
Ľăăăă¨ăŤăŞăăžăăăĺ°ĺ
ĽăŤăăăŁăŚéŁăăĺéĄăŽä¸ă¤ăŻăä¸ăăăăĺ珌ă§ăćĺŽăăăé§
ăŽéă秝ĺă§ăăăăŠăăăĺ¤ĺŽăăăă¨ă§ăăăăăăăŽĺ珌ăŤăŻäščťé§
ă¨éčťé§
ăč¨čźăăăŚăăžăăăăŽĺ珌ă§ă§ăăăŽăŻăăäščťé§
ă§äšăŁăŚăéčťé§
ă§éăăăăă¨ă ăă§ăŻăŞăăéä¸äščťăéä¸ä¸čťă訹ăăăŚăăžăă
</p>
<p>
ăăŽéé眲ăŤăŻS ĺăŽé§
ăăăăăăŽăăĄR çľăŽé§
ăŻéŁăĺăŁăŚăăŚăäťăŽé§
ăçľçąăăăŤĺćšĺăŤééă§ç§ťĺăăăă¨ăă§ăăžăăéŁăĺăŁăé§
ăçľăśçˇčˇŻăŻă˛ă¨ă¤ăăăăăžăăăéŁăĺăŁăé§
ăŽéăŽčˇé˘ăŻăăăŽçˇčˇŻăŤć˛żăŁăŚć¸ŹăŁăčˇé˘ă§ăăăăé§
ăăăăé§
ăžă§ăŽçľčˇŻăŻéé眲ăŽĺ˝˘çśăŤăăŁăŚăŻč¤ć°éăčăăăăžăăăăăŽăăĄćăčˇé˘ăçăăŞăăăăŞçľčˇŻăćççľčˇŻă¨ĺźăśăă¨ăŤăăžăăăăŽăăăŞçľčˇŻăč¤ć°ăăĺ ´ĺăăŠăĄăăćççľčˇŻă¨ăăŚčŞăăăăžăă
</p>
<p>
äščťé§
aăéčťé§
b ăŽĺ珌ă§é§
c ăăé§
d ăžă§ç§ťĺă§ăăăŽăŻă䝼ä¸ăŽćĄäťśăăăšăŚćşăăçľčˇŻ p ăĺĺ¨ăăă¨ăă§ăă
</p>
<ul>
<li> çľčˇŻ p ăŻăé§
a ăăé§
b ă¸ăŽćççľčˇŻă§ăăă</li>
<li> çľčˇŻ p ăŻăé§
a ăăĺşçşăăé§
căé§
d ăŽé ăŤçľçąăăé§
b ă§çľăăçľčˇŻă§ăăăăžăăé§
c ăăé§
d ăŽĺşéăŻăăŽ2 é§
ăŽćççľčˇŻăŤăŞăŁăŚăăă</li>
</ul>
<p>
衯çˇĺłă¨ĺ珌ăŽć
ĺ ąăä¸ăăăăžăă揥ăŤăĺ§çšă¨çľçšăŽçľăăăă¤ăä¸ăăăăăŽă§ăăăŽĺ珌ă§ĺ§çšăăçľçšă¸ç§ťĺă§ăăăăŠăăăĺ¤ĺŽăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻďźă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
S R
u<sub>1</sub> v<sub>1</sub> w<sub>1</sub>
u<sub>2</sub> v<sub>2</sub> w<sub>2</sub>
:
u<sub>R</sub> v<sub>R</sub> w<sub>R</sub>
a b Q
c<sub>1</sub> d<sub>1</sub>
:
c<sub>Q</sub> d<sub>Q</sub>
</pre>
<p>
ĺčĄă§ä¸ăăăăć°ĺ¤ăŻďźă¤ăŽçŠşç˝ă§ĺşĺăăăŚăăă
</p>
<p>
ďźčĄçŽăŻďźă¤ăŽć´ć°ăăăŞăăS (2 ≤ S ≤ 100000) ăŻéé衯çˇĺłăŤçžăăé§
ăŽć°ăR (1 ≤ R ≤ 200000) ăŻéŁăĺăŁăé§
ăŽçľăŽć°ă§ăăăçśă R čĄăŤăéŁăĺăŁăé§
ăŽéăç´ćĽă¤ăŞăçˇčˇŻăŽć
ĺ ąăä¸ăăăăău<sub>i</sub> 㨠v<sub>i</sub> (1 ≤ u<sub>i</sub>, v<sub>i</sub> ≤ S) 㯠i çŞçŽăŽçˇčˇŻăŽä¸ĄçŤŻăŽé§
ăŽçŞĺˇă示ăăw<sub>i</sub> (1 ≤ w<sub>i</sub> ≤ 1000) ăŻăăăăŽé§
ăŽéăŽčˇé˘ă襨ăć´ć°ă§ăăăăă ăăĺé§
ăŤăŻ 1 ăă S ăžă§ăŽçŞĺˇăéč¤ăŞăĺ˛ăćŻăăăŚăăău<sub>i</sub> ≠ v<sub>i</sub> ă¨ăăă
</p>
<p>
çśăďźčĄăŻďźă¤ăŽć´ć°ăăăŞăăćĺăŽďźă¤ăŽć´ć°ăŻĺ珌ăŽĺşéă襨ăăa ăŻäščťé§
ăb ăŻéčťé§
(1 ≤ a, b ≤ S) ă§ăăăďźă¤çŽăŽć´ć° Q (1 ≤ Q ≤ 40000) ăŻčłŞĺăŽć°ă示ăăçśă Q čĄăŤčłŞĺăä¸ăăăăă c<sub>i</sub> ă¨d<sub>i</sub> (1 ≤ c<sub>i</sub>, d<sub>i</sub> ≤ S)㯠i çŞçŽăŽčłŞĺăŽäščťé§
ă¨éčťé§
ă示ăăăă ăăa ≠ băc<sub>i</sub> ≠ d<sub>i</sub> ă¨ăăă
</p>
<h2>ĺşĺ</h2>
<p>
質ĺăă¨ăŤăä¸ăăăăĺ珌ă§ç§ťĺă§ăăăŞă Yes ăăă§ăăŞăăŞă No ăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
6 7
1 2 3
1 4 1
2 3 5
4 3 1
3 6 2
4 5 2
5 6 1
1 6 6
1 6
4 3
4 6
5 6
2 6
2 5
</pre>
<h2>ĺşĺäž</h2>
<pre>
Yes
Yes
Yes
Yes
No
No
</pre> | [
[
"6 7\n1 2 3\n1 4 1\n2 3 5\n4 3 1\n3 6 2\n4 5 2\n5 6 1\n1 6 6\n1 6\n4 3\n4 6\n5 6\n2 6\n2 5\n",
"6 7\n1 2 3\n1 4 1\n2 3 5\n4 3 1\n3 6 2\n4 5 2\n5 6 1\n1 6 6\n1 6\n4 3\n4 6\n5 6\n2 6\n2 5\n"
]
] |
p00271 | Temperature Difference |
<H1>ć°ć¸ŠăŽĺˇŽ</H1>
<p>
é¸ćăŽçăăăăă˝ăłăłç˛ĺĺăŤăăăăăă¤ăăłăăŤĺĺ ăăăŤăŻä˝čŞżçŽĄçă大ĺă§ăăć°ć¸Šă大ăăĺ¤ĺăăĺŁçŻăŽĺ¤ăăçŽăŤăŻä˝ăŤč˛ ć
ăăăăă風éŞăă˛ăăăăă¨č¨ăăăŚăăžăăä¸çŞć°ăäťăăŞăăă°ăăăŞăćĽăŻăćéŤć°ć¸Šă¨ćä˝ć°ć¸ŠăŽĺˇŽăćă大ăăćĽă§ăăďźćĽăŽćéŤć°ć¸Šă¨ćä˝ć°ć¸ŠăďźćĽĺä¸ăăăăă¨ăăăăăăăŽćĽăŤă¤ăăŚćéŤć°ć¸Šăăćä˝ć°ć¸Šăĺźăăĺ¤ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>a<sub>1</sub></var> <var>b<sub>1</sub></var>
<var>a<sub>2</sub></var> <var>b<sub>2</sub></var>
:
<var>a<sub>7</sub></var> <var>b<sub>7</sub></var>
</pre>
<p>
ĺ
ĽĺăŻ7čĄăăăŞăăičĄçŽăŤăŻ<var>i</var>ćĽçŽăŽćéŤć°ć¸Š <var>a<sub>i</sub></var>(-40 ≤ <var>a<sub>i</sub></var> ≤ 40)ă¨ćä˝ć°ć¸Š <var>b<sub>i</sub></var>(-40 ≤ <var>b<sub>i</sub></var> ≤ 40)ă襨ăć´ć°ăä¸ăăăăăăăšăŚăŽćĽăŤăăăŚăćéŤć°ć¸Š <var>a<sub>i</sub></var> ăŻĺż
ăćä˝ć°ć¸Š <var>b<sub>i</sub></var> 䝼ä¸ă¨ăŞăŁăŚăăă
</p>
<h2>ĺşĺ</h2>
<p>
7ćĽĺăŽć°ć¸ŠăŽĺˇŽă7čĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
30 19
39 20
19 18
25 20
22 21
23 10
10 -10
</pre>
<h2>ĺşĺäž</h2>
<pre>
11
19
1
5
1
13
20
</pre> | [
[
"30 19\n39 20\n19 18\n25 20\n22 21\n23 10\n10 -10\n",
"30 19\n39 20\n19 18\n25 20\n22 21\n23 10\n10 -10\n"
]
] |
p00272 | Ticket Sales |
<H1>ăăąăăăŽĺŁ˛ăä¸ă</H1>
<p>
äťćĽăŻăă˘ă¤ă
ăťă¨ăłăżăźăă¤ăłăĄăłă礞ă¤ăăŞăˇăŽă˘ă¤ăăŤă°ăŤăźăăă˘ăŤăăłďźăłăăŚăˇăăŽăăąăăçşĺŁ˛ćĽă§ăăăăąăăăŤăŻäťĽä¸ăŽďźç¨ŽéĄăăăăžăă<br/>
<br/>
ďźłĺ¸ 6000ĺ<br>
ďźĄĺ¸ 4000ĺ<br>
ďź˘ĺ¸ 3000ĺ<br>
ďźŁĺ¸ 2000ĺ<br>
<br/>
貊売貏䝝č
ăŽăăŞăăŻăăăăăăăŞăăçşĺŁ˛éĺ§ăĺž
ăŁăŚăăžăăăăăăçşĺŁ˛éĺ§ă売ăčĄă羜弽調ă§ăďź
</p>
<p>
çşĺŁ˛éĺ§ăăăă°ăăçľăŁăă¨ăăă§ăăăăžă§ăŽćł¨ćăăžă¨ăă襨ăĺăĺăăžăăă襨ăŽĺčĄăŤăŻăăăăžă§ăŤĺŁ˛ăăăăąăăăŽç¨ŽéĄă¨ćć°ăć¸ăăŚăăăžăăăă ăăăăąăăăŽç¨ŽéĄăďźłďźďźĄďźďź˘ďźďźŁăŽé ăŤçžăăă¨ăŻéăăžăăăăăŽčĄ¨ăŽčĄăă¨ăŽĺŁ˛ä¸ééĄăćąăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>t<sub>1</sub></var> <var>n<sub>1</sub></var>
<var>t<sub>2</sub></var> <var>n<sub>2</sub></var>
<var>t<sub>3</sub></var> <var>n<sub>3</sub></var>
<var>t<sub>4</sub></var> <var>n<sub>4</sub></var>
</pre>
<p>
ĺ
ĽĺăŻ4čĄăăăŞăăičĄçŽăŤăŻăăăąăăăŽç¨ŽéĄă襨ăć´ć° <var>t<sub>i</sub></var> (1 ≤ <var>t<sub>i</sub></var> ≤ 4)ă¨ćć°ă襨ăć´ć° <var>n<sub>i</sub></var> (0 ≤ <var>n<sub>i</sub></var> ≤ 10000)ăä¸ăăăăăăăąăăăŽç¨ŽéĄă襨ăć´ć°1, 2, 3, 4ăŻăăăăăďźłĺ¸ăĺ¸ăĺ¸ăĺ¸ă襨ăă<var>t<sub>1</sub></var>, <var>t<sub>2</sub></var>, <var>t<sub>3</sub></var>, <var>t<sub>4</sub></var> ăŽĺ¤ă¨ăăŚ1ăă4ăžă§ăŽć°ăŻĺż
ăďźĺşŚă ăçžăăăă1, 2, 3, 4ăŽé ă§ä¸ăăăăă¨ăŻéăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
čĄăă¨ăŤĺŁ˛ä¸ééĄăĺşĺăăă
</p>
<h2>ĺ
Ľĺäž 1</h2>
<pre>
3 10
1 4
4 1
2 5
</pre>
<h2>ĺşĺäž 1</h2>
<pre>
30000
24000
2000
20000
</pre>
<br/>
<h2>ĺ
Ľĺäž 2</h2>
<pre>
1 1
2 0
3 1
4 1
</pre>
<h2>ĺşĺäž 2</h2>
<pre>
6000
0
3000
2000
</pre> | [
[
"3 10\n1 4\n4 1\n2 5\n",
"3 10\n1 4\n4 1\n2 5\n"
]
] |
p00273 | Admission Fee |
<H1>ĺ
Ľĺ ´ćé</H1>
<p>
ă˘ă¤ă
渊ćłăŤăŻăćľ´ĺ ´ă¨ăăźăŤăăăăćľ´ĺ ´ăĺŠç¨ăăăŤăŻĺ
Ľćľ´ĺ¸ăăăăźăŤăĺŠç¨ăăăŤăŻăăźăŤĺ¸ăăăăă財ăĺż
čŚăăăăžăăăăăăŽĺ¸ăŽĺ¤ćŽľăŻăćĽăŤăăŁăŚĺ¤ăăăăăăăžăăăăžăăă˘ă¤ă
渊ćłăŤăŻäťĽä¸ăŽăăăŞăŤăźăŤăăăăžăă
</p>
<ul>
<li> ĺ¸ăŻčłźĺ
Ľĺ˝ćĽďźĺăŽĺŠç¨ăŤéăćĺšă</li>
<li> ăĺ
Ľćľ´ĺ¸ďźć䝼ä¸ăă¤ăăźăŤĺ¸ďźć䝼ä¸ăă§ăžă¨ăăŚč˛ˇăă¨ăăăšăŚăŽĺ¸ăďźĺ˛ĺźăŤăŞăă</li>
</ul>
<p>
渊ćłĺĽ˝ăăŽč˛ĺăăă¨ăăŽĺäşşăăĄăŻăă˘ă¤ă
渊ćłăŤćŻćĽăŽăăăŤéăŁăŚăăžăă彟ăăŻçć°ăžăăă§ăćĽăŤăăŁăŚä˝żăćć°ăŻç°ăŞăăžăăă˘ă¤ă
渊ćłăŤăŻĺ˛ĺźăŤăźăŤăăăăăăă°ăŤăźăă§ĺĺăăŚä¸ćăŤč˛ˇăă°ăĺč¨ćéăĺŽăć¸ăžăăă¨ăă§ăăăăăăăžăăă
</p>
<p>
ĺ
Ľćľ´ĺ¸ă¨ăăźăŤĺ¸ăŽćéă使ç¨ăăĺ
Ľćľ´ĺ¸ăŽćć°ă¨ăăźăŤĺ¸ăŽćć°ăĺ
Ľĺă¨ăăŚä¸ăăăăă¨ăăćăĺŽăĺč¨ćéăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăă使ç¨ăăćć°ăăĺ¤ăĺ¸ă財ăăă¨ă§ĺč¨ćéăĺŽăăŞăăŞăă財ăŁăĺ¸ăăšăŚă使ăăŞăă¨ăăăăăŽă¨ăăžăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var>
<var>x<sub>1</sub></var> <var>y<sub>1</sub></var> <var>b<sub>1</sub></var> <var>p<sub>1</sub></var>
<var>x<sub>2</sub></var> <var>y<sub>2</sub></var> <var>b<sub>2</sub></var> <var>p<sub>2</sub></var>
:
<var>x<sub>N</sub></var> <var>y<sub>N</sub></var> <var>b<sub>N</sub></var> <var>p<sub>N</sub></var>
</pre>
<p>
ďźčĄçŽăŽ<var>N</var>(1 ≤ <var>N</var> ≤ 365)ăŻćéăč¨çŽăăăćĽć°ă§ăăăçśă<var>N</var>čĄăŤă<var>i</var>ćĽçŽăŽĺ
Ľćľ´ĺ¸ăŽćé<var>x<sub>i</sub></var>(100 ≤ <var>x<sub>i</sub></var> ≤ 1000)ăăăźăŤĺ¸ăŽćé<var>y<sub>i</sub></var>(100 ≤ <var>y<sub>i</sub></var> ≤ 1000)ă使ç¨ăăĺ
Ľćľ´ĺ¸ăŽćć°<var>b<sub>i</sub></var>(0 ≤ <var>b<sub>i</sub></var> ≤ 6)ă使ç¨ăăăăźăŤĺ¸ăŽćć°<var>p<sub>i</sub></var>(0 ≤ <var>p<sub>i</sub></var> ≤ 6)ăä¸ăăăăăĺ
Ľćľ´ĺ¸ă¨ăăźăŤĺ¸ĺ
ąăŤćéăŻ50ĺĺťăżă§ăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăăăăŽćĽăŤă¤ăăŚćăĺŽăĺč¨ćéăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺäž 1</h2>
<pre>
2
100 100 1 1
1000 500 5 2
</pre>
<h2>ĺşĺäž 1</h2>
<pre>
200
4800
</pre>
<br/>
<h2>ĺ
Ľĺäž 2</h2>
<pre>
5
500 500 1 1
500 500 5 2
1000 100 0 6
1000 100 6 0
100 1000 0 0
</pre>
<h2>ĺşĺäž 2</h2>
<pre>
1000
2800
600
4960
0
</pre> | [
[
"2\n100 100 1 1\n1000 500 5 2\n",
"2\n100 100 1 1\n1000 500 5 2\n"
]
] |
p00274 | A Pair of Prizes |
<H1>ăăăăăŽćŻĺ</H1>
<p>
ă¸ă§ăŚĺă¨ă¤ă¨ăăăŻäť˛ăŽčŻăăŤăăăŤă§ăăă¸ă§ăŚĺăŻăŤăăťăŤçŠĺ
ˇčŞč˛ŠćŠ(ăŹăăŁăăł)ăŽćŻĺăéăăŚăăăäşäşşă§ĺşăăăă¨ăăăăŹăăŁăăłăčŚă¤ăăă¨ä˝ĺşŚăăăŁăŚăżăăťăŠăŽçąăŽĺ
Ľăăăă§ăăă¤ă¨ăăăŻćĽ˝ăăăăŞă¸ă§ăŚĺăăă°ă§čŚăŚăăă ăă§ăăăăă¸ă§ăŚĺăŽäťĺşŚăŽčŞçćĽăăŹăźăłăăŤăŹăăŁăăłăŽćŻĺăă˛ă¨ă¤ăăăăă¨ăŤăăžăăăă¤ă¨ăăăŻăŹăăŁăăłčŞä˝ăŤăŻăăžăčĺłăăăăžăăă§ăăăăă§ăăă°ă¸ă§ăŚĺă¨ăăăăăŽćŻĺă揲ăăă¨ćăŁăŚăăžăă
</p>
<p>
ă¤ă¨ăăăăăŁăŚăżăăă¨ćăăŹăăŁăăłăŻăďźĺăŽăăŁăŹăłă¸ă§ćŻĺăă˛ă¨ă¤ĺşăžăăĺĺăăŽăăŽăĺŤăćŻĺăä˝ç¨ŽéĄăăăŽăă¨ăăăăăăŽćŻĺăăăă¤ćŽăŁăŚăăăŽăăŻăăăăžăăăăăă1ĺăŽăăŁăŹăłă¸ă§ăŠăŽćŻĺăĺşăăăŻăăăăžăăăăăă§ăćŻĺăĺşăé çŞăŤăăăăăăă¤ă¨ăăăĺăćŻĺăĺż
ăďźă¤ĺžăăăăŤćä˝éĺż
čŚăŞăăŁăŹăłă¸ăŽĺć°ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźă1ă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var>
<var>k<sub>1</sub></var> <var>k<sub>2</sub></var> ... <var>k<sub>N</sub></var>
</pre>
<p>
ĺăăźăżăťăăăŻ2čĄă§ăăă1čĄçŽăŤćŻĺăä˝ç¨ŽéĄăăăă襨ăć´ć°<var>N</var>(1 ≤ <var>N</var> ≤ 10000)ăä¸ăăăăăçśă1čĄăŤĺćŻĺăăăă¤ćŽăŁăŚăăăŽăă襨ăć´ć°<var>k<sub>i</sub></var>(0 ≤ <var>k<sub>i</sub></var> ≤ 10000)ăä¸ăăăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ100ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăĺăćŻĺăĺż
ăďźă¤ĺžăăăăŤćä˝éĺż
čŚăŞăăŁăŹăłă¸ăŽĺć°ăĺşĺăăăăă ăăä¸ĺŻč˝ăŞĺ ´ĺăŻNAă¨ĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
2
3 2
3
0 1 1
1
1000
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
3
NA
2
</pre>
<p>
ďźă¤çŽăŽăăźăżăťăăă§ăŻăéčŻăďźç¨ŽéĄçŽăďźç¨ŽéĄçŽăŽćŻĺăéŁçśă§ĺşăŚďźĺă§ć¸ăĺŻč˝ć§ăŻăăăăĺă税éĄăŽćŻĺăĺż
ăďźă¤ĺžăăăăŤăŻďźĺăăŁăŹăłă¸ăăĺż
čŚăăăă</br>
ďźă¤çŽăŽăăźăżăťăăă§ăŻăďźă¤äťĽä¸ćŽăŁăŚăăćŻĺăăă¨ăă¨çĄăăŽă§ä¸ĺŻč˝ă§ăăă</br>
ďźă¤çŽăŽăăźăżăťăăă§ăŻăćŻĺăŻďźç¨ŽéĄă ăăŞăŽă§ďźĺăŽăăŁăŹăłă¸ă§ăăŽćŻĺăĺż
ăďźă¤ĺžăăăă</br>
</p> | [
[
"2\n3 2\n3\n0 1 1\n1\n1000\n0\n",
"2\n3 2\n3\n0 1 1\n1\n1000\n0\n"
]
] |
p00275 | The Outcome of Bonze |
<H1>ĺ丝ăăăăŽçľćŤ</H1>
<p>
çžäşşä¸éŚăŽćă使ăŁăéćŻăŽďźă¤ăŤăăĺ丝ăăăăă¨ăăăăŽăăăăžăăçľľćă ăă使ăç°ĄĺăŞéćŻăŞăŽă§ĺşă漽ăăžăăŚăăžăăăăžăăŤăŻć§ă
ăŞć´žçĺăăăăžăăăăăă§čăăĺ丝ăăăăŻNäşşăŽĺĺ č
ă§ă䝼ä¸ăŽăăăŞăŤăźăŤă§čĄăăžăă
</p>
<ul>
<li> ďźďźćăŽăçˇăăďźďźćăŽăĺ丝ăăďźďźćăŽă姍ăăč¨ďźďźďźćăŽćă使ăă</li>
<li> çľľăčŚăăŞăăăăŤćăčŁăăăăŤăăŚăă桡ăăăćĺąąăăă¤ăăă</li>
<li> ĺĺ č
ăŽä¸äşşçŽăăé çŞăŤďźćăă¤ćĺąąăŽćăĺźăăNäşşçŽăŽćŹĄăŻăăžăä¸äşşçŽăăçš°ăčżăă
<ul>
<li> ĺźăăćăçˇăŞăăĺźăăäşşăŻăăŽćăćăŤĺ
Ľăăă</li>
<li> ĺźăăćăĺ丝ăŞăăĺźăăäşşăŻăăŽćăĺŤăăćăŁăŚăăćăăăšăŚăĺ ´ăăŤĺşăă</li>
<li> ĺźăăćă姍ăŞăăĺźăăäşşăŻăăŽćăĺŤăăĺ ´ăŤăăćăăăšăŚćăŤĺ
Ľăăă</li>
</ul>
</li>
<li> ćĺąąăŽćăăŞăăŞăŁăăçľäşă§ăä¸çŞĺ¤ăăŽćăćăŁăŚăăäşşăŽĺăĄă</li>
</ul>
<p>
ĺĺ č
ć°ă¨ćĺąąăŤçŠăžăăćăŽé çŞăä¸ăăăăă¨ăăéćŻăçľäşăăćçšă§ĺĺĺ č
ăćăŁăŚăăćć°ăćé ă§ä¸ŚăšăăăŽă¨ăĺ ´ăŤćŽăŁăŚăăćć°ăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăä¸ă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var>
<var>c<sub>1</sub>c<sub>2</sub> ... c<sub>100</sub>
</pre>
<p>
ĺăăźăżăťăăăŻ2čĄă§ăăă1čĄçŽăŤĺĺ č
ć°ă襨ăć´ć°<var>N</var>(2 ≤ <var>N</var> ≤ 10)ăä¸ăăăăăçśă1čĄăŤćĺąąăŤçŠăžăăćăŽä¸Śăłă襨ăćĺĺăä¸ăăăăăćĺ<var>c<sub>i</sub></var>ăŻ<var>i</var>çŞçŽăŤĺźăăăćă襨ăăŚăăăMăçˇăSăĺ丝ăLă姍ăŽćă襨ăăĺćĺăŽéăŤçŠşç˝ăŻçĄăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ100ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤăéćŻăçľäşăăćçšă§ăŽćć°ăŽä¸ŚăłăďźčĄăŤĺşĺăăăćć°ăŽä¸Śăłă¨ăăŚăĺĺĺ č
ăćăŁăŚăăćăŽćć°ăćé ăŤä¸Śăšă ăăŽăŽĺžăŤăĺ ´ăŤćŽăŁăŚăăćăŽćć°ăĺşĺăăăĺćć°ăŽéăŻçŠşç˝ďźă¤ă§ĺşĺăăčĄăŽçľăăăŤăŻçŠşç˝ăĺşĺăăŞăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
2
SSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
2
SSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMSL
5
MMMMMMSLSLLMMMSMMSLMMMLMMMMLSLLLLMLSMMLMMLLMSSSLMMMMLMLSMLMSMMMMMMMSMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM
0
</pre>
<h2>ĺşĺäž</h2>
<pre>
42 58 0
0 100 0
0 0 3 10 59 28
</pre> | [
[
"2\nSSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n2\nSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMSL\n5\nMMMMMMSLSLLMMMSMMSLMMMLMMMMLSLLLLMLSMMLMMLLMSSSLMMMMLMLSMLMSMMMMMMMSMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM\n0\n",
"2\nSSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n2\nSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMSL\n5\nMMMMMMSLSLLMMMSMMSLMMMLMMMMLSLLLLMLSMMLMMLLMSSSLMMMMLMLSMLMSMMMMMMMSMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM\n0\n"
]
] |
p00276 | Formation |
<H1>éŁĺ˝˘</H1>
<p>
ăăă°ăŠăăźé¤ćć Ąă§ăăă˘ăŤăéŤć Ąă§ăŻăăăźă ćŚăŽçŤśćăăă°ăŠăăźăŽĺ˝šĺ˛ă䝼ä¸ăŽďźăżă¤ăăŤĺăăŚăăžăă<br>
<table style="margin-left:24px">
<tr>
<td>ďź</td>
<td>ăłăźăăź</td>
<td>č¨čŞăççĽăăŚăăăăłăźăăŁăłă°ăčĄăă</td>
</tr>
<tr>
<td>ďź</td>
<td>ă˘ăŤă´ăŞăşăăź</td>
<td>čŤççćčăĺžćă§ăăăă˘ăŤă´ăŞăşă ăčăăă</td>
</tr>
<tr>
<td>ďź</td>
<td>ăăă˛ăźăżăź</td>
<td>čŞč§ŁĺăŤéˇăăŚăăăĺéĄăŽĺćăťăăăă°ăăăă</td>
</tr>
</table>
<br>
<p>
ăăŽéŤć Ąă§ăŻäťĽä¸ăŽăăăăăŽéŁĺ˝˘ă§ďźäşşä¸çľăŽăăźă ăć§ćăăŚăăžăă
</p>
<table style="margin-left:24px">
<tr>
<td>ďź</td>
<td>ăăŠăłăšăă¨ăăŚăăĺŽĺŽĺ</td>
</tr>
<tr>
<td>ďź</td>
<td>ăšăăźăăčŚčžźăăăăŞăšăŻăŽéŤăéćťĺ</td>
</tr>
<tr>
<td>ďź</td>
<td>ćŁç˘şăŤĺéĄă解ăć
éĺ</td>
</tr>
</table>
<br/>
<p>
獜ćăăă°ăŠăăłă°é¨ăŽăłăźăă§ăăăăŞăăŻăăăăăŽé¨ĺĄăăăžăçľăżĺăăăă§ăăă ăĺ¤ăăŽăăźă ăçľćă§ăăăăăćŻĺš´ć°ăé
ăŁăŚăăžăăăăă§ăăłăźăăźăŽäşşć°ăă˘ăŤă´ăŞăşăăźăŽäşşć°ăăăă˛ăźăżăźăŽäşşć°ăĺ
Ľĺă¨ăăŚä¸ăăăăă¨ăăć大ä˝ăăźă ä˝ăăăăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻ1ă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>Q</var>
<var>c<sub>1</sub></var> <var>a<sub>1</sub></var> <var>n<sub>1</sub></var>
<var>c<sub>2</sub></var> <var>a<sub>2</sub></var> <var>n<sub>2</sub></var>
:
<var>c<sub>Q</sub></var> <var>a<sub>Q</sub></var> <var>n<sub>Q</sub></var>
</pre>
<p>
1čĄçŽăŽ<var>Q</var>(0 ≤ <var>Q</var> ≤ 100)ăŻăăźă ć°ăćąăăăĺš´ć°ă§ăăăçśă<var>Q</var>čĄăŤĺĺš´ăŽĺ˝šĺ˛ĺĽăŽäşşć°ăä¸ăăăăăĺčĄăŤăŻăłăźăăźăŽäşşć°<var>c<sub>i</sub></var>(0 ≤ <var>c<sub>i</sub></var> ≤ 1000)ăă˘ăŤă´ăŞăşăăźăŽäşşć°<var>a<sub>i</sub></var>(0 ≤ <var>a<sub>i</sub></var> ≤ 1000)ăăăă˛ăźăżăźăŽäşşć°<var>n<sub>i</sub></var>(0 ≤ <var>n<sub>i</sub></var> ≤ 1000)ăä¸ăăăăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺš´ăă¨ăŤăä˝ćă§ăăć大ăŽăăźă ć°ă1čĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺäž</h2>
<pre>
4
3 0 0
1 1 1
9 4 1
0 1 2
</pre>
<h2>ĺşĺäž</h2>
<pre>
1
1
4
0
</pre> | [
[
"4\n3 0 0\n1 1 1\n9 4 1\n0 1 2\n",
"4\n3 0 0\n1 1 1\n9 4 1\n0 1 2\n"
]
] |
p00277 | Programming Contest |
<H1>ăăă°ăŠăăłă°ăłăłăăšă</H1>
<p>
ç˝č大ĺŚă§ăŻćŻĺš´ăăă°ăŠăăłă°ăłăłăăšăăéĺŹăăăŚăăžăăăăźă ăŽçˇć°ăNă¨ăăă¨ăăăăźă ăŤăŻ1ăăNăŽăăźă IDăăăăăĺ˛ăĺ˝ăŚăăăŚăăžăăăłăłăăšăăŻĺ
¨ăŚăŽăăźă ăŽĺžçšă0ăŽçść
ăăéĺ§ăăLç§ééŁçśăăŚčĄăăăžăă
</p>
<p>
äťĺš´ăŽăłăłăăšăăŻăăăŹăă§ä¸çśăăăăă¨ăŤăŞăăžăăăăłăłăăšăăŽéăăŹăăŤć ăăŽăŻăăăŽćçšă§ćăĺžçšăŽéŤăăăźă ă ăă§ăăăă ăă芲ĺ˝ăăăăźă ăč¤ć°ăăă¨ăăŻăăăŽä¸ă§ăăźă IDăŽä¸çŞĺ°ăăăăźă ăć ăăžăăć ăăšăăăźă ăĺ¤ăăă¨ăçŹćăŤăŤăĄăŠăĺăćżăăăžăă
</p>
<p>
ăăŞăăŻăłăłăăšăăŽăă°ăĺ
Ľćăăžăăăăă°ăŤăŻăăăăăźă ăŽĺžçšăĺ¤ĺăăćăŽăŹăłăźăăăăšăŚĺŤăžăăŚăăžăăĺăŹăłăźăăŻăăăźă <var>d</var>ăăłăłăăšăéĺ§<var>t</var>ç§ĺžăŽćçšă§<var>x</var>çšç˛ĺžăăăă¨ăă形ĺźă§ä¸ăăăăŚăăžăăăŞăăć¸çšăăăĺ ´ĺăăăăŽă§ăçžĺ¨ăŽĺžçšă0ăăĺ°ăăăŞăăă¨ăăăăžăă
</p>
<p>
ăłăłăăšăăŽăă°ăĺ
Ľĺă¨ăăăłăłăăšăéĺ§ăăçľäşăžă§ăŽéăŤăăŹăăŤć ăŁăćéăćăéˇăăăźă ăŽIDăĺ ąĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻ1ă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var> <var>R</var> <var>L</var>
<var>d<sub>1</sub></var> <var>t<sub>1</sub></var> <var>x<sub>1</sub></var>
<var>d<sub>2</sub></var> <var>t<sub>2</sub></var> <var>x<sub>2</sub></var>
:
<var>d<sub>R</sub></var> <var>t<sub>R</sub></var> <var>x<sub>R</sub></var>
</pre>
<p>
ďźčĄçŽăŻďźă¤ăŽć´ć°ăăăŞăă<var>N</var>(2 ≤ <var>N</var> ≤ 100000)ăŻăăźă ć°ă<var>R</var>(0 ≤ <var>R</var> ≤ 1000000)ăŻăă°ăŤĺŤăžăăăŹăłăźăăŽć°ă§ăăă<var>L</var>(1 ≤ <var>L</var> ≤ 1000000)ăŻăłăłăăšăăŽćéďźéˇăďźă襨ăăçśă<var>R</var>čĄăŤĺăŹăłăźăăŽć
ĺ ąăä¸ăăăăăĺăŹăłăźăăŻăăźă <var>d<sub>i</sub></var>(1 ≤ <var>d<sub>i</sub></var> ≤ <var>N</var>)ăăłăłăăšăéĺ§<var>t<sub>i</sub></var>(0 < <var>t<sub>i</sub></var> < <var>L</var>)ç§ĺžăŽćçšă§<var>x<sub>i</sub></var>(-1000 ≤ <var>x<sub>i</sub></var> ≤ 1000)çšç˛ĺžăăăăŻć¸çšăăăăă¨ă示ăăăă ăă<var>t<sub>i</sub></var>, <var>x<sub>i</sub></var>ăŻć´ć°ă§ăăă<var>t<sub>i-1</sub></var> ≤ <var>t<sub>i</sub></var>ă§ăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăłăłăăšăéĺ§ăăçľäşăžă§ăŽéăŤăăŹăăŤć ăŁăćéăćăéˇăăăźă ăŽIDăďźčĄăŤĺşĺăăăăă ăăćăéˇăăăźă ăč¤ć°ăăă¨ăăŻăăăŽä¸ă§ăăźă IDăŽä¸çŞĺ°ăăăăźă ăĺşĺăăă
</p>
<h2>ĺ
Ľĺäž 1</h2>
<pre>
3 4 600
3 100 5
1 200 10
2 400 20
3 500 20
</pre>
<h2>ĺşĺäž 1</h2>
<pre>
1
</pre>
<br/>
<h2>ĺ
Ľĺäž 2</h2>
<pre>
3 5 600
3 100 5
1 200 10
2 300 30
1 400 -8
2 400 -27
</pre>
<h2>ĺşĺäž 2</h2>
<pre>
3
</pre> | [
[
"3 4 600\n3 100 5\n1 200 10\n2 400 20\n3 500 20\n",
"3 4 600\n3 100 5\n1 200 10\n2 400 20\n3 500 20\n"
]
] |
p00278 | Study Session |
<H1>ĺ埡äź</H1>
<p>
ăăă°ăŠăăźé¤ćć ĄăŽă˘ăŤăéŤć ĄăŤăŻăçĺžčŞčşŤă§éĺśăăăŚăăźăŻăŞĺ埡äźăăăăžăăăăă°ăŠăăźăŻć°ăăćčĄă常ăŤĺăĺ
Ľăăăă¨ă大ĺăŞăŽă§ăăăŽĺ埡äźăéăăŚčŞĺŚčŞçżăŽçżć
Łă躍ăŤă¤ăăăă¨ăăăŽć´ťĺăŽăăăă§ăă
</p>
<p>
çĺžăŻĺ
¨é¨ă§<var>N</var>äşşăăăăăăăăĺ
ĽĺŚćăŽăăă°ăŠăăłă°ăłăłăăšăăŽçľćă§ĺžăăăăšăłă˘ăćăŁăŚăăžăăĺ埡äźă§ăŻ<var>N</var>äşşăŽçĺžăŽăăĄä˝äşşăăăŞăźăăźăŤăŞăăĺăŞăźăăźăăăăăăŽă°ăŤăźăăéĺśăăă¨ă¨ăăŤăčŞăăŽéĺśăăă°ăŤăźăăŤĺĺ ăăžăă
</p>
<p>
ăŞăźăăźäťĽĺ¤ăŽçĺžăŻăčŞĺăŽăšăłă˘ăăăä˝ăăšăłă˘ăŽăŞăźăăźăéĺśăăă°ăŤăźăăŤăŻĺĺ ă§ăăžăăăăžăă0䝼ä¸ăŽăăĺ¤<var>r</var>ăďźă¤ćąşăăă°ăŤăźăăŤĺĺ ăăçĺžă¨ăŞăźăăźăŽăšăłă˘ăŽĺˇŽă<var>r</var>䝼ĺ
ă¨ăŞăăăăŤăăŚăăžăăă¤ăžăăă°ăŤăźăăŽăŞăźăăźăŽăšăłă˘ă<var>s</var>ăŽă¨ăăčŞĺăŽăšăłă˘ă<var>s</var>ăčś
ăăŚăăăăăăă㯠<var>s</var> - <var>r</var> ćŞćşăŞăă°ăăăŽă°ăŤăźăăŤăŻĺĺ ă§ăăžăăă
</p>
<p>
ăăŞăăŻĺ埡äźăŽĺŽčĄĺ§ĺĄéˇă§ăăăéĺśćşĺăŽăăăŤăˇăăĽăŹăźăˇă§ăłăčĄăăă¨ăŤăăžăăăăˇăăĽăŹăźăˇă§ăłă§ăŻăăŞăźăăźă誰ăăăŞăçść
ăăĺ§ăă䝼ä¸ăŽćä˝ăä˝ĺăçš°ăčżăăžăă
</p>
<ul>
<li> çĺžăăŞăźăăźăŤĺ ăăă</li>
<li> çĺžăăŞăźăăźăăĺ¤ăă</li>
<li> čŚćąćçšă§ăŽăŞăźăăźăŽçľăżĺăăăŤă¤ăăŚăăŠăŽă°ăŤăźăăŤăĺĺ ă§ăăŞăçĺžă<var>x</var>人䝼ä¸ăŤăŞăăăăŞăćĺ°ăŽ<var>r</var>ăćąăăă</li>
</ul>
<p>
ăăŽăăăŞăˇăăĽăŹăźăˇă§ăłăčĄăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻ1ă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var> <var>Q</var>
<var>s<sub>1</sub></var>
<var>s<sub>2</sub></var>
:
<var>s<sub>N</sub></var>
<var>QUERY<sub>1</sub></var>
<var>QUERY<sub>2</sub></var>
:
<var>QUERY<sub>Q</sub></var>
</pre>
<p>
1čĄçŽăŤçĺžăŽć°<var>N</var>(1 ≤ <var>N</var> ≤ 1000000)ăĺŚçčŚćąăŽć°<var>Q</var>(0 ≤ <var>Q</var> ≤ 1000)ăä¸ăăăăă
</p>
<p>
çśă<var>N</var>čĄăŤ<var>i</var>çŞçŽăŽçĺžăŽăšăłă˘ă示ăć´ć°<var>s<sub>i</sub></var>(0 ≤ <var>s<sub>i</sub></var> ≤ 1,000,000,000)ăä¸ăăăăăçĺžăŻ1,2,...,<var>N</var> ă§çŞĺˇäťăăăăŚăăăăŽă¨ăăă
</p>
<p>
çśă<var>Q</var>čĄăŤĺŚçčŚćą<var>QUERY<sub>i</sub></var>ăä¸ăăăăăĺŚçčŚćąăŻćçłťĺé ăŤä¸ăăăăăĺŚçčŚćąăŻADD, REMOVE, CHECKăŽ3税éĄăăăĺ<var>QUERY<sub>i</sub></var>ăŻäťĽä¸ăŽăăăăăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
ADD <var>a</var>
</pre>
<p>
ăžăăŻ
</p>
<pre>
REMOVE <var>a</var>
</pre>
<p>
ăžăăŻ
</p>
<pre>
CHECK <var>x</var>
</pre>
<p>
ADD <var>a</var>ăŻçŞĺˇ<var>a</var>(1 ≤ <var>a</var> ≤ <var>N</var>)ăŽçĺžăăŞăźăăźăŤĺ ăăăă¨ă襨ăă
</p>
<p>
REMOVE <var>a</var>ăŻçŞĺˇ<var>a</var>(1 ≤ <var>a</var> ≤ <var>N</var>)ăŽçĺžăăŞăźăăźăăĺ¤ăăă¨ă襨ăă
</p>
<p>
CHECK <var>x</var>ăŻĺşĺčŚćąă襨ăăăŠăŽă°ăŤăźăăŤăĺĺ ă§ăăŞăçĺžăŽć°ăŽä¸é<var>x</var>(0 ≤ <var>x</var> ≤ <var>N</var>)ăä¸ăăăăă
</p>
<p>
ăŞăăĺ
ĽĺăŻäťĽä¸ăŽćĄäťśăćşăăăăŽă¨ăăă
</p>
<ul>
<li> ăŠăŽćçšă§ăăăŞăźăăźăŽäşşć°ă100äşşăčś
ăăăă¨ăŻăŞăă</li>
<li> ăăŽćçšă§ăŞăźăăźă§ăăçĺžăăŞăźăăźăŤĺ ăăăă¨ăŻăŞăă</li>
<li> ăăŽćçšă§ăŞăźăăźă§ăŞăçĺžăăŞăźăăźăăĺ¤ăăă¨ăŻăŞăă</li>
</ul>
<h2>ĺşĺ</h2>
<p>
ćçłťĺé ăŤĺĺşĺčŚćąăŽćçšă§ăăŠăŽă°ăŤăźăăŤăĺĺ ă§ăăŞăçĺžăx人䝼ä¸ăŤăŞăăăăŞćĺ°ăŽ<var>r</var>ă1čĄăŤĺşĺăăăăă ăăăŠăŽăăăŞ<var>r</var>ăé¸ăă§ă<var>x</var>人䝼ä¸ăŤăăăă¨ăä¸ĺŻč˝ă§ăăă°NAă¨ĺşĺăăă
</p>
<h2>ĺ
Ľĺäž 1</h2>
<pre>
5 8
5
10
8
7
3
ADD 1
ADD 3
CHECK 0
CHECK 1
CHECK 2
CHECK 3
CHECK 4
CHECK 5
</pre>
<h2>ĺşĺäž 1</h2>
<pre>
NA
2
1
0
0
0
</pre>
<br/>
<h2>ĺ
Ľĺäž 2</h2>
<pre>
5 28
5
10
8
7
3
CHECK 0
CHECK 1
CHECK 2
CHECK 3
CHECK 4
CHECK 5
ADD 1
CHECK 0
CHECK 1
CHECK 2
CHECK 3
CHECK 4
CHECK 5
REMOVE 1
ADD 3
CHECK 0
CHECK 1
CHECK 2
CHECK 3
CHECK 4
CHECK 5
ADD 1
CHECK 0
CHECK 1
CHECK 2
CHECK 3
CHECK 4
CHECK 5
</pre>
<h2>ĺşĺäž 2</h2>
<pre>
NA
NA
NA
NA
NA
0
NA
NA
NA
2
0
0
NA
5
3
1
0
0
NA
2
1
0
0
0
</pre> | [
[
"5 8\n5\n10\n8\n7\n3\nADD 1\nADD 3\nCHECK 0\nCHECK 1\nCHECK 2\nCHECK 3\nCHECK 4\nCHECK 5\n",
"5 8\n5\n10\n8\n7\n3\nADD 1\nADD 3\nCHECK 0\nCHECK 1\nCHECK 2\nCHECK 3\nCHECK 4\nCHECK 5\n"
]
] |
p00279 | Happy End Problem |
<H1>ăăăăźă¨ăłăĺéĄ</H1>
<p>
ăăăăăźă¨ăłăĺéĄăă¨ĺźă°ăăć°ĺŚăŽćŞč§ŁćąşĺéĄăŤé˘éŁăăăăă°ăŠă ăć¸ăăŚăżăžăăăăĺšłé˘ä¸ăŤä¸ăăăă<var>N</var>ĺăŽçšăăăăĄăăăŠ<var>k</var>ĺăŽçšăçľăă§ă§ăăĺ¸ĺ¤č§ĺ˝˘ăŽăăĄăćăé˘çŠăŽĺ°ăăăăŽăčŚă¤ăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăNĺăŽçšăŽĺş§ć¨ăä¸ăăăăĺžă質ĺă¨ăăŚĺ¸ĺ¤č§ĺ˝˘ăŽč§ăŽĺć°<var>k</var>ăăăă¤ăä¸ăăăăžăă
</p>
<p>
ďźčŁčśłďźăăăăźă¨ăłăĺéĄăŤă¤ăăŚďź<br/>
ĺšłé˘ä¸ăŤăŠăŽďźçšăĺăç´çˇä¸ăŤäšăăŞăăăăŤ<var>N</var>ĺăŽçšă罎ăăžăăăăŽă¨ăăăŠăŽăăăŤçšă罎ăăŚăăkĺăŽçšăăăžăé¸ăśă¨kĺăŽč§ăăă¤ĺ¸ĺ¤č§ĺ˝˘ăĺż
ăä˝ăăă¨äşćłăăăŚăăžăă äťăŽă¨ăăăä¸č§ĺ˝˘ăŞăă°<var>N</var>=3ăĺč§ĺ˝˘ăŞăă°<var>N</var>=5ăäşč§ĺ˝˘ăŞăă°<var>N</var>=9ăĺ
č§ĺ˝˘ăŞăă°<var>N</var>=17ă§ăăă°ăăăă¨ăăďźďźďźďźĺš´ăžă§ăŤč¨źćăăăŚăăžăăăžăăä¸č§ĺ˝˘äťĽä¸ăŽăăšăŚăŽkč§ĺ˝˘ăŤĺŻžăăŚă<var>N</var>=1+2<sup><var>k</var>-2</sup>ă¨ăăäşćłăăăăžăăăăăžă 訟ćăăăŚăăžăăăăăăŻďźďźďźĺš´ăŤăăăç 犜ăé˛ăăăăŚăăéŁĺă§ăă<br/>
ăăŽĺéĄăŤăŻăăăăăăźă¨ăłăĺéĄăă¨ăăç´ ćľăŞĺĺăă¤ăăăăŚăăžăăăăçˇĺĽłăăăŽĺéĄăç 犜ăăŚăăăăĄăŤäť˛čŻăăŞăŁăŚăă¤ăăŤçľĺŠăăăă¨ăŤăĄăŞăă§ăĺäşşăŽć°ĺŚč
ăĺäťăăăăă§ăăăăăłăăăŻă§ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻ1ă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var>
<var>x<sub>1</sub></var> <var>y<sub>1</sub></var>
:
<var>x<sub>N</sub></var> <var>y<sub>N</sub></var>
<var>Q</var>
<var>k<sub>1</sub></var>
:
<var>k<sub>Q</sub></var>
</pre>
<p>
ďźčĄçŽăŤĺšłé˘ä¸ăŽçšăŽĺć°<var>N</var>(3 ≤ <var>N</var> ≤ 40)ăä¸ăăăăăçśă<var>N</var>čĄăŤĺçšăŽĺş§ć¨ăä¸ăăăăăĺçšăŤăŻ1ăă<var>N</var>ăžă§ăŽçŞĺˇăăĺ
Ľĺăăăé çŞăŤäťăăăăŚăăă<var>x<sub>i</sub></var>ă¨<var>y<sub>i</sub></var>(-10000 ≤ <var>x<sub>i</sub></var>, <var>y<sub>i</sub></var> ≤ 10000)ăŻ<var>i</var>çŞçŽăŽçšăŽăăăă<var>x</var>座ć¨ă¨<var>y</var>座ć¨ă襨ăć´ć°ă§ăăă<var>x</var>蝸ăŽćŁćšĺăŻĺłĺă, <var>y</var>蝸ăŽćŁćšĺăŻä¸ĺăăŤĺăăăŽă¨ăăă
</p>
<p>
çśăďźčĄăŤčłŞĺăŽć°<var>Q</var>(1 ≤ <var>Q</var> ≤ <var>N</var>)ăä¸ăăăăăçśă<var>Q</var>čĄăŤčłŞĺăä¸ăăăăă<var>k<sub>i</sub></var>(3 ≤ <var>k<sub>i</sub></var> ≤ <var>N</var>)ăŻ<var>i</var>çŞçŽăŽčłŞĺă§ăăĺ¸ĺ¤č§ĺ˝˘ăŽč§ăŽĺć°ă襨ăă
</p>
<p>
ăŞăăĺ
ĽĺăŻäťĽä¸ăŽćĄäťśăćşăăăăŽă¨ăăă
</p>
<ul>
<li> ĺ
ĽĺăăăçšăŽĺş§ć¨ăŻăăšăŚç°ăŞăă </li>
<li> ăŠăŽďźçšăĺăç´çˇä¸ăŤăŻäšăăŞăă</li>
<li> ĺ質ĺăŤĺŻžăăŚé˘çŠćĺ°ăŽĺ¸ĺ¤č§ĺ˝˘ăŻďźă¤ă§ăăăďźçŞçŽăŤĺ°ăăĺ¸ĺ¤č§ĺ˝˘ă¨ăŽé˘çŠăŽĺˇŽăŻ 0.0001䝼ä¸ă</li>
</ul>
<h2>ĺşĺ</h2>
<p>
質ĺăă¨ăŤăé˘çŠăćĺ°ăŽĺ¸ĺ¤č§ĺ˝˘ăŽĺ
¨é çšă1čĄăŤĺşĺăăăĺ¸ĺ¤č§ĺ˝˘ăŽé çšă§ćăä¸ăŤăăăăŽăŽä¸ă§ćă塌ăŤăăé çšăăé ăŤăĺćč¨ĺ¨ăă§é çšăŽçŞĺˇăĺşĺăăăé çšăŽçŞĺˇăŽéăŻçŠşç˝1ă¤ă§ĺşĺăăčĄăŽçľăăăŤăŻçŠşç˝ćĺăĺşĺăăŞăăăă ăăĺ¸ĺ¤č§ĺ˝˘ăä˝ăăŞăĺ ´ĺăŻNAă¨ĺşĺăăă
</p>
<h2>ĺ
Ľĺäž 1</h2>
<pre>
5
0 0
3 0
5 2
1 4
0 3
3
3
4
5
</pre>
<h2>ĺşĺäž 1</h2>
<pre>
1 4 5
1 2 4 5
1 2 3 4 5
</pre>
<br/>
<h2>ĺ
Ľĺäž 2</h2>
<pre>
6
0 0
3 0
5 2
1 4
0 3
3 2
4
3
4
5
6
</pre>
<h2>ĺşĺäž 2</h2>
<pre>
6 3 5
6 3 4 5
1 2 6 4 5
NA
</pre>
| [
[
"5\n0 0\n3 0\n5 2\n1 4\n0 3\n3\n3\n4\n5\n",
"5\n0 0\n3 0\n5 2\n1 4\n0 3\n3\n3\n4\n5\n"
]
] |
p00280 | Tennis |
<h1>ăăăš</h1>
<p>
ă¸ă§ăŚĺă¨ă¤ă¨ăăăŻćźäźăżăŤăăăšăăăžăăăă ăăćźäźăżăŻćéăéăăăŚăăăŽă§ăçăćéă§çľăăăăăŤăĺžçšăŤă¤ăăŚäťĽä¸ăŽďźă¤ăŽăŤăźăŤă§čĄăăžăă
</p>
<ul>
<li> ç¸ćăďźçšäťĽä¸ăŽă¨ăăŤĺ
ăŤďźçšă¨ăă°ĺăĄă</li>
<li> ďźĺŻžďźăŽĺçšăŤăŞăŁăă¨ăăŻăăăŽç´ĺžăŤéŁçśăăŚďźçšă¨ăŁăćšăĺăĄă</li>
<li> ďźĺŻžďźăŽĺžăŤĺćšăďźçšăă¤ă¨ăŁăă¨ăăŻĺźăĺăă</li>
</ul>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2013_tennis" width="600">
</center>
<p>
䝼ä¸ăŽĺłăŻăă¸ă§ăŚĺă¨ă¤ă¨ăăăŽčŠŚĺă§čľˇăăĺžăăăšăŚăŽçśćłă襨ăăŚăăžăă丸ăŽä¸ăŽĺˇŚăŽć°ăă¸ă§ăŚĺăŽĺžçšăĺłăă¤ă¨ăăăŽĺžçšă§ăăă¨ć¸ăăç˘ĺ°ăŻă¸ă§ăŚĺăďźçšă¨ăŁăăă¨ăăă¨ć¸ăăç˘ĺ°ăŻă¤ă¨ăăăďźçšă¨ăŁăăă¨ă襨ăăžăă
</p>
<p>
ă¸ă§ăŚĺă¨ă¤ă¨ăăăŽĺžçšăä¸ăăăăă¨ăă芌ĺéĺ§ăăăăŽĺžçšçśćłăŤăŞăăžă§ăŤăä¸ăŽĺłă§éăĺžăăăšăŚăŽçľčˇŻăĺćăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻďźă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>j</var> <var>y</var>
</pre>
<p>
<var>j</var> (0 ≤ <var>j</var> ≤ 6) ăă¸ă§ăŚĺăŽĺžçšă<var>y</var> (0 ≤ <var>y</var> ≤ 6) ăă¤ă¨ăăăŽĺžçšă§ăăăăă ăă<var>j</var> 㨠<var>y</var> ăă¨ă㍠0 ă§ăăăă¨ăŻăŞăăăžăă<var>j</var> ă 6 ăŽă¨ă㯠<var>y</var> 㯠4ă<var>y</var> ă 6 ăŽă¨ă㯠<var>j</var> 㯠4 ă§ăăă
</p>
<h2>ĺşĺ</h2>
<p>
ä¸ăŽĺłă§ă芌ĺéĺ§ďź0-0ă¨ć¸ăăă丸ďźăăä¸ăăăăĺžçšăć¸ăăă丸ăžă§ăŽăăšăŚăŽçľčˇŻăĺşĺăăăçľčˇŻăŻĺłăŽç˘ĺ°ăŤćˇťăăăăčąĺ(A,B)ăŽĺă§čĄ¨ăăčžć¸ĺźé ĺşďźčąĺčžć¸ă§ĺčŞă丌ăă§ăăé çŞďźăŤăŞăăăăŤä¸Śăšăăďźă¤ăŽçľčˇŻăďźčĄăŤĺşĺăăăçľčˇŻăŽĺĺžăŤăŻçŠşç˝ăĺşĺăăŞăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž1</h2>
<pre>
2 2
</pre>
<h2>ĺşĺäž1</h2>
<pre>
AABB
ABAB
ABBA
BAAB
BABA
BBAA
</pre>
<h2>ĺ
Ľĺäž2</h2>
<pre>
5 1
</pre>
<h2>ĺşĺäž2</h2>
<pre>
AAAABA
AAABAA
AABAAA
ABAAAA
BAAAAA
</pre> | [
[
"2 2\n",
"2 2\n"
]
] |
p00281 | Computation of Salary |
<h2>茪ćšăŽçľŚćč¨çŽ</h2>
<p>
ăŻăˇăŻăă¤ăă¤ăŞăçľĺăŽčŚŞćšăăăčˇäşşă塼äşçžĺ ´ăŤć´žéŁăăçžĺ ´ă§ăă¤ăăă¤ăŞăăăŚăăăĺťĺš´ăŻĺˇĽäşăĺ˘ăăŚĺ¤§ĺ˛ăăăăă¨ćăŁăăŽăăăăăĄăăŁă¨çľŚćăŽĺşăćšăăžăăăŚăŽă
ăăŚăă¨ăăŚăŻĺ¤§čľ¤ĺăŤăŞăŁăŚăăžăŁăăŽăăăâŚăăăă§ăäťĺš´ăŻčˇäşşăăĄă¸ăŽçľŚćăŽĺşăćšă塼复ăăăăŽăăă
</p>
<p>
čˇäşşăăĄăŽçľŚćăŻă塼äşăŽç¨ŽéĄă¨ăăŞăăĺć°ă§ćąşăăŚăăăă¤ăžăă<br>
čˇäşşăŽçľŚć ďź ç¨ŽéĄ 1 ăŽĺ䞥 × ç¨ŽéĄ 1 ăăăŞăăĺć°<br>
+ ç¨ŽéĄ 2 ăŽĺ䞥 × ç¨ŽéĄ 2 ăăăŞăăĺć°<br>
....<br>
+ ç¨ŽéĄ <var>M</var> ăŽĺ䞥 × ç¨ŽéĄ <var>M</var> ăăăŞăăĺć°<br>
<br>
ă¨ăŞăăŽăăăăăăč¨çŽăăăăăŤăăŚăă§ăŻăăŠăŽčˇäşşăăŠăŽç¨ŽéĄăŽĺˇĽäşăä˝ĺăăŞăăăă揥ăŽăăăŞčĄ¨ăŤč¨é˛ăăŚăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2013_salary">
</center>
<br>
<p>
äžăă°ăä¸ăŽčĄ¨ă§ăŻăčˇäşşďźă塼äşďźăďźĺă塼äşďźăďźĺăăŞăăăă¨ă示ăăŚăăă
</p>
<p>
čˇäşşăăĄăăăŞăăäťäşăŽĺć°ăŻăăĺ¤ăăăăăăăă¤ăăŻĺˇĽäşăŽĺ䞥ăçĽăăăŽă§ăĺ䞥ăăăăăă¨ĺ¤ăăŞăăçăŽä¸ćşăĺşăŹăă羌ćă調ć´ăăăă¨ćăăŚăăăăăăăăŻăˇăăăăăăăăă°ăŠă ăäťăăŁăŚĺăăŞăăŚăŽă
ăăĄăăŁă¨ăżăŚăăăăăă
</p>
<pre>
//ççĽ
int i, j;
for ( i = 0; i < N; i++ ){
c[i] = 0;
for ( j = 0; j < M; j++ ){
c[i] = c[i] + a[i][j]*b[j];
}
}
//ççĽ
</pre>
<p>
<var>N</var> ăŻčˇäşşăŽć°ă§ <var>M</var> ăŻĺˇĽäşăŽç¨ŽéĄăŽć°ăăăĺ¤ć° <var>a[i][j]</var> ăŤčˇäşşiăĺˇĽäş <var>j</var> ăăăŞăăĺć°ăă<var>b[j]</var> ăŤĺˇĽäş <var>j</var> ăŽĺ䞥ăăăăŚă<var>c[i]</var> ăŤčˇäşş <var>i</var> ăŽçľŚćăć źç´ăăŚăăăĺăŁăŚăăăŻăăŞăŽăŤăăăă¨ăăăă¨ăč¨ăăďźăăăăäťĺš´ăŽçľŚćăčˇäşşăăĄăŤćăăŞăă¨ăžăăăŽăăăăťăťăťăťăťăŞăă¨ăăŞăăăăŽă
ă
</p>
<p>
ăăă§ăŻăčˇäşşăŽăăŞăăäťäşăŽĺć°ă¨ĺ塼äşăŽĺ䞥ăŽć
ĺ ąăä¸ăăăăă¨ăăĺčˇäşşăŽçľŚćăč¨çŽăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻ1ă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var> <var>M</var>
<var>s<sub>1</sub></var> <var>t<sub>1</sub></var> <var>e<sub>1</sub></var>
<var>s<sub>2</sub></var> <var>t<sub>2</sub></var> <var>e<sub>2</sub></var>
:
0 0 0
<var>L</var>
<var>b<sub>11</sub></var> <var>b<sub>12</sub></var> ... <var>b<sub>1M</sub></var>
<var>b<sub>21</sub></var> <var>b<sub>22</sub></var> ... <var>b<sub>2M</sub></var>
:
<var>b<sub>L1</sub></var> <var>b<sub>L2</sub></var> ... <var>b<sub>LM</sub></var>
</pre>
<ul>
<li> 1čĄçŽăŻčˇäşşăŽć° <var>N</var>(1 ≤ <var>N</var> ≤ 10000)ă¨ĺˇĽäşăŽç¨ŽéĄăŽć° <var>M</var>(1 ≤ <var>M</var> ≤ 10000)ă</li>
<li> çśăăŚă塼äşăŽč¨é˛ă¨ăăŚăčˇäşşăŽçŞĺˇ <var>s<sub>i</sub></var> (1 ≤ <var>s<sub>i</sub></var> ≤ <var>N</var>) ă¨ĺˇĽäşăŽç¨ŽéĄăŽçŞĺˇ <var>t<sub>i</sub></var>(1 ≤ <var>t<sub>i</sub></var> ≤ <var>M</var>)ăăăăłčˇäşş <var>s<sub>i</sub></var> ăĺˇĽäş <var>t<sub>i</sub></var> ăăăŞăăĺć° <var>e<sub>i</sub></var> (1 ≤ <var>e<sub>i</sub></var> ≤ 50000) ăăăŞăčĄăďźčĄäťĽä¸ä¸ăăăăă塼äşăŽč¨é˛ăŻăźăďźă¤ăŽčĄă§çľăăăăă ăă<var>e<sub>i</sub></var> ăŽĺč¨ăŻ 1 äťĽä¸ 50000 䝼ä¸ă§ăăăăžăă塼äşăŽč¨é˛ăŤăŻăăŠăŽčˇäşşă¨ĺˇĽäşăŽç¨ŽéĄăŽçľăďźĺşŚäťĽä¸çžăăŞăă塼äşăăăŞăăĺć°ă 0 ă§ăăčˇäşşă¨ĺˇĽäşăŽç¨ŽéĄăŽçľăŻä¸ăăăăŞăă</li>
<li> çśă 1 čĄăŻçľŚćăŽçŽĺşăčĄăĺć° <var>L</var> (1 ≤ <var>L</var> ≤ 100) ă</li>
<li> çśă <var>L</var> čĄăŻă<var>i</var> ĺçŽăŽçľŚćăŽçŽĺşăŤĺż
čŚăŞăĺˇĽäş <var>j</var> ăŽĺ䞥 <var>b<sub>ij</sub></var> (0 ≤ <var>b<sub>ij</sub></var> ≤ 10000) ăŽä¸Śăłă</li>
</ul>
<h2>ĺşĺ</h2>
<p>
䝼ä¸ăŽĺ˝˘ĺźă§ă<var>i</var> ĺçŽăŽçľŚćăŽçŽĺşăŤăăŁăŚĺžăăăčˇäşş <var>j</var> ăŽçľŚć <var>c<sub>ij</sub></var> ăé çŞăŤĺşĺăăăĺ羌ćăŽéăŻçŠşç˝ďźă¤ă§ĺşĺăă
</p>
<pre>
<var>c<sub>11</sub></var> <var>c<sub>12</sub></var> ... <var>c<sub>1N</sub></var>
<var>c<sub>21</sub></var> <var>c<sub>22</sub></var> ... <var>c<sub>2N</sub></var>
:
<var>c<sub>L1</sub></var> <var>c<sub>L2</sub></var> ... <var>c<sub>LN</sub></var>
</pre>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž</h2>
<pre>
4 6
1 2 1
2 3 2
2 4 3
3 1 5
4 2 4
4 3 2
4 6 10
0 0 0
3
1 3 2 4 0 10
6 5 4 3 2 1
5 1 1 5 5 1
</pre>
<h2>ĺşĺäž</h2>
<pre>
3 16 5 116
5 17 30 38
1 17 25 16
</pre> | [
[
"4 6\n1 2 1\n2 3 2\n2 4 3\n3 1 5\n4 2 4\n4 3 2\n4 6 10\n0 0 0\n3\n1 3 2 4 0 10\n6 5 4 3 2 1\n5 1 1 5 5 1\n",
"4 6\n1 2 1\n2 3 2\n2 4 3\n3 1 5\n4 2 4\n4 3 2\n4 6 10\n0 0 0\n3\n1 3 2 4 0 10\n6 5 4 3 2 1\n5 1 1 5 5 1\n"
]
] |
p00282 | Jinkoki |
<h1>奾ĺŤč¨</h1>
<p>
大ăăŞć°ă襨ăăă¨ăăă¨ăćĺć°ăĺ¤ăăŞăăăä˝ĺăăăăăăŞăăŞăŁăŚăăžăăŽă§ăăŞăăŞăé˘ĺă§ăă大ăăŞć°ăăăăăăă襨ăăăăŤăäşşă
ăŻć°ăŽĺä˝ă使ăŁăŚăăžăăăćąć¸ć䝣ăŤć¸ăăăă奾ĺŤč¨ăă¨ăăćŹăŽä¸ă§ăŻăć°ăŽĺä˝ă揥ăŽăăăŤć¸ăăăŚăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2013_jinkouki1" width="740">
</center>
<br>
<p>
ăă¨ăă°ăďźăŽďźďźďźäšăŽăăăŞă¨ăŚă大ăăŞć°ăŻăďźďźďźçŠŁďźďźďźďź(ăă)ďźďźďźďźĺďźďźďźďźäşŹďźďźďźďźĺ
ďźďźďźďźĺďźďźďźä¸ďźďźďźďźă¨čĄ¨ăăžăăăăă§ăŻăćŁăŽć´ć° <var>m</var> 㨠<var>n</var> ăä¸ăăăăă¨ăă<var>m</var> ㎠<var>n</var> äšă奾ĺŤč¨ăŽĺä˝ă使ăŁăŚä¸ăŽăăăŤčĄ¨ăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>m</var> <var>n</var>
</pre>
<p>
<var>m</var> (2 ≤ <var>m</var> ≤ 20) ăĺşć°ă<var>n</var> (1 ≤ <var>n</var> < 240) ăćć°ă襨ăăăă ăă<var>m<sup>n</sup></var>㯠10<sup>72</sup> ćŞćşă§ăăă
</p>
<p>
ăăźăżăťăăăŽć°ăŻ 100 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤă<var>m<sup>n</sup></var> ă奾ĺŤč¨ăŽĺä˝ă§čĄ¨ăăćĺĺă1čĄăŤĺşĺăăăăă ăăĺĺä˝ăŻäťĽä¸ăŽčĄ¨č¨ă§ĺşĺăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2013_jinkouki2" width="740">
</center>
<br>
<p>
<var>m<sup>n</sup></var>ă襨ăćĺĺăŻă1 ăă 9999 ăžă§ăŽć°ă¨ä¸ăŽčĄ¨ăŤçžăăĺä˝ă襨ăćĺĺăăăŞăăćĺĺăŤăŻăä˝ĺ㪠0 ăĺä˝ăĺŤăăŞăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž</h2>
<pre>
2 10
5 20
10 8
20 17
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
1024
95Cho3674Oku3164Man625
1Oku
131Gai720Kei
</pre> | [
[
"2 10\n5 20\n10 8\n20 17\n0 0\n",
"2 10\n5 20\n10 8\n20 17\n0 0\n"
]
] |
p00283 | Knocker of the Gigas Cedar |
<h1>塨樚ăŽĺťăżć</h1>
<p>
ăăŞă㯠<var>N</var> 税éĄăŽéĺ
ˇă使ăŁăŚăçŽăŽĺăŽĺˇ¨ć¨šăĺăĺăăă¨ăăŚăăžăăăŻăăăŻă樚ăŽčäš
ĺ㯠<var>D</var>ăăăŞăăŽçľé¨ĺ¤ăŻ 0 ă§ăăăéĺ
ˇ <var>i</var> ă§ďźĺ樚ăĺŠăă¨ć¨šăŽčäš
ĺ㯠<var>a<sub>i</sub></var> ć¸ăăăăŞă㯠<var>e<sub>i</sub></var> ăŽçľé¨ĺ¤ăĺžăžăăăă ăăéĺ
ˇ <var>i</var> ă使ăăăăŤăŻăăăŞă㯠<var>r<sub>i</sub></var> 䝼ä¸ăŽçľé¨ĺ¤ăćăŁăŚăăŞăăă°ăŞăăžăăă樚ăŽčäš
ĺă 0 䝼ä¸ăŤăŞăă¨ć¨šăŻĺăăžăă
</p>
<p>
樚ăŽčäš
ĺă¨éĺ
ˇăŤă¤ăăŚăŽć
ĺ ąăä¸ăăăăă¨ăă樚ăĺăĺăăŤăŻćä˝ä˝ĺ樚ăĺŠăăŞăăă°ăăăŞăăăćąăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>D</var> <var>N</var>
<var>a<sub>1</sub></var> <var>e<sub>1</sub></var> <var>r<sub>1</sub></var>
<var>a<sub>2</sub></var> <var>e<sub>2</sub></var> <var>r<sub>2</sub></var>
:
<var>a<sub>N</sub></var> <var>e<sub>N</sub></var> <var>r<sub>N</sub></var>
</pre>
<p>
1 čĄçŽăŤć¨šăŽčäš
ĺă襨ăć´ć° <var>D</var> (1 ≤ <var>D</var> ≤ 100) ă¨éĺ
ˇăŽç¨ŽéĄăŽć° <var>N</var>(1 ≤ <var>N</var> ≤ 100) ăä¸ăăăăăçśă <var>N</var> čĄăŤéĺ
ˇ 1 ăă <var>N</var> ăžă§ăŽć
ĺ ąăä¸ăăăăă<var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 100) 㨠<var>e<sub>i</sub></var> (0 ≤ <var>e<sub>i</sub></var> ≤ 100) ăŻăéĺ
ˇiăďźĺ使ăăă¨ă§ć¸ă樚ăŽčäš
ĺă¨ăăŞăăĺžăăă¨ăŽă§ăăçľé¨ĺ¤ăăăăă襨ăă<var>r<sub>i</sub></var> (0 ≤ <var>r<sub>i</sub></var> ≤ 100) ăŻéĺ
ˇă使ăăăăŤĺż
čŚăŞçľé¨ĺ¤ă襨ăă<var>a<sub>i</sub></var>, <var>e<sub>i</sub></var>, <var>r<sub>i</sub></var> ăŻăăšăŚć´ć°ă§ăăă<br>
<br>
ăăźăżăťăăăŽć°ăŻ 50 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
樚ăĺăĺăăŽăŤĺż
čŚăŞă樚ăĺŠăćĺ°ăŽĺć°ăďźčĄăŤĺşĺăăăăă ăă樚ăĺăĺăăă¨ăä¸ĺŻč˝ăŞĺ ´ĺ㯠<span>NA</span> ă¨ĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž</h2>
<pre>
15 4
1 1 0
1 2 2
5 10 5
8 1 15
60 4
5 2 0
8 8 2
3 5 0
49 0 18
100 1
1 1 1
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
6
4
NA
</pre>
| [
[
"15 4\n1 1 0\n1 2 2\n5 10 5\n8 1 15\n60 4\n5 2 0\n8 8 2\n3 5 0\n49 0 18\n100 1\n1 1 1\n0 0\n",
"15 4\n1 1 0\n1 2 2\n5 10 5\n8 1 15\n60 4\n5 2 0\n8 8 2\n3 5 0\n49 0 18\n100 1\n1 1 1\n0 0\n"
]
] |
p00284 | Infinite Express |
<h1>çĄéćĽčĄ</h1>
<p>
ă ă˛ăłééăŽă ă˛ăłçˇăŤăŻçĄéĺăŽé§
ăăăăžăăé§
ăŤăŻ âŚ, -3, -2, -1, 0, 1, 2, 3, ⌠ă¨çŞĺˇăćŻăăăŚăăŚăĺé§
ăŻć°ç´çˇä¸ăŽć´ć°ă¨ĺăé çŞă§éŁăĺăŁăŚăăžăăăăŞăăŻăăžăăăçŞĺˇăŽé§
ăăéťčťăŤäšăăăăăă大ăăŞçŞĺˇăŽé§
ăŤĺăăăă¨ăăŚăăžăă
</p>
<p>
ă ă˛ăłçˇăŤăŻçĄé税éĄăŽĺżŤééťčťăčľ°ăŁăŚăăžăăăăă㯠0 ç´ĺżŤéă1 ç´ĺżŤéă2 ç´ĺżŤéă3 ç´ĺżŤéă⌠ăŽăăăŤçŞĺˇă§ĺźă°ăăŚăăžăă<var>n</var> ç´ĺżŤéăŽéťčťăŻă2<var><sup>n</sup></var> ăŽĺć°ăŽçŞĺˇăŽé§
ăŤĺčťăăžăăăă¨ăă°ă1ç´ĺżŤéăŻé§
âŚ, -4, -2, 0, 2, 4, ⌠ăŤă3 ç´ĺżŤéăŻé§
âŚ, -24, -16, -8, 0, 8, 16, 24, ⌠ăŤĺčťăăă¨ăăŁăĺ
ˇĺă§ăă0 ç´ĺżŤéăŻăăšăŚăŽé§
ăŤĺčťăăăŽă§ăćŹĺ˝ăŻĺé§
ĺčťă§ăăă ă˛ăłééăŻă忍éăă¨ĺźăă§ăăžăă
</p>
<p>
ăŠăŽç´ăŽĺżŤééťčťăăăăĺčťé§
ăă揥ăŽĺčťé§
ăžă§ç§ťĺăăăŽăŤ1ĺä˝ćéăăăăžăăăžăă忍ééťčťéăŽäšăćăăŤăăăćéăŻçĄčŚă§ăăăăŽă¨ăăžăăäščťé§
<var>s</var> ă¨éčťé§
<var>d</var> ăä¸ăăăăă¨ăă<var>s</var> ăă <var>d</var> ă¸ç§ťĺăăăŽăŤĺż
čŚăŞćĺ°ăŽćéăćąăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăă<var>s</var> ăă <var>d</var> ă¸ç§ťĺăăéăŤă大ăăŞçŞĺˇăăĺ°ăăŞçŞĺˇăŽé§
ăŤĺăăŁăŚăŽç§ťĺăŻčŞăăăăŞăăăŽă¨ăăžăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻ1ă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var>
<var>s<sub>1</sub></var> <var>d<sub>1</sub></var>
<var>s<sub>2</sub></var> <var>d<sub>2</sub></var>
:
<var>s<sub>N</sub></var> <var>d<sub>N</sub></var>
</pre>
<p>
ďźčĄçŽăŤç§ťĺăŽĺć°ă襨ă <var>N</var> (1 ≤ <var>N</var> ≤ 100) ăä¸ăăăăăçśă <var>N</var> čĄăŤăäščťé§
ăŽçŞĺˇ <var>s<sub>i</sub></var> ă¨éčťé§
ăŽçŞĺˇ <var>d<sub>i</sub></var> (-1,000,000,000 ≤ <var>s<sub>i</sub></var> < <var>d<sub>i</sub></var> ≤ 1,000,000,000) ăä¸ăăăăă
</p>
<h2>ĺşĺ</h2>
<p>
ä¸ăăăăäščťé§
ă¨éčťé§
ăă¨ăŤă秝ĺăŤĺż
čŚăŞćĺ°ăŽćéăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<h2>ĺ
Ľĺäž</h2>
<pre>
3
0 7
-1048576 0
-3 5
</pre>
<h2>ĺşĺäž</h2>
<pre>
3
1
4
</pre>
| [
[
"3\n0 7\n-1048576 0\n-3 5\n",
"3\n0 7\n-1048576 0\n-3 5\n"
]
] |
p00285 | Microorganism Power Generation |
<h1>垎ççŠçşéť</h1>
<p>
飯沟ĺ壍ăŻçŁć˘ŻĺąąăŽĺ´ć°ĺă§ăľăăăŞĺžŽççŠăčŚă¤ăăžăăăăăŽĺžŽççŠăŽéă¨éďźä˝ăă¤ăĺä˝ăăă¨ăéťć°ă¨ăăŤăŽăźăćžĺşăăžăăăăŽĺžŽççŠăç 犜ăăă°ăĺ°ćĽăŽă¨ăăŤăŽăźĺąćŠăăćă
ăćăăăăăăăžăăă
</p>
<p>
茳ĺŻăçśăăă¨ă垎ççŠăŻĺä˝ăăă¨ăă ăéťć°ă¨ăăŤăŽăźăçşçăăăăă¨ă¨ăĺä˝ăă垎ççŠăŽăăăŞăĺä˝ăŻăŞăăă¨ăăăăăžăăăăăăŤčŚłĺŻăçśăăă¨ăĺä˝ă§ćžĺşăăăéťć°ă¨ăăŤăŽăźăŻă垎ççŠăä˝ĺ
ăŤćă¤ćŞçĽăŽç˛ĺďźĺ壍ăŻăăăçŁć˘ŻĺąąăŤăĄăŞăă§ďź˘ç˛ĺă¨ĺăĽăăžăăďźăŽéă§ćąşăžăăă¨ăăăăăžăăăĺä˝ăăéă¨éăä˝ĺ
ăŤćă¤ďź˘ç˛ĺăŽéăăăăă <var>bm</var> 㨠<var>bw</var> ă¨ăăă¨ăĺä˝ăŤăăćžĺşăăăéťć°ă¨ăăŤăŽăźăŻ |<var>bm</var> - <var>bw</var>| × (|<var>bm</var> - <var>bw</var>| - 30)<sup>2</sup> ă¨ăăĺźă§č¨çŽă§ăăžăă
</p>
<p>
ăăŽçşčŚăŤăăă垎ççŠăŽéĺŁăăĺžăăăć大ăŽéťć°ă¨ăăŤăŽăźăč¨çŽă§ăăăăăŤăŞăăžăăăăăă§ăŻă垎ççŠăŽéĺŁăŤĺŤăžăăéă¨éăŽć°ă¨ăĺĺä˝ăćă¤ďź˘ç˛ĺăŽéăä¸ăăăăă¨ăăăăŽĺžŽççŠăŽéĺŁăăĺžăăăć大ăŽéťć°ă¨ăăŤăŽăźăč¨çŽăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźă2ă¤ăŽčĄă§ç¤şăăăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>M</var> <var>W</var>
<var>bm<sub>1</sub></var> <var>bm<sub>2</sub></var> ... <var>bm<sub>M</sub></var>
<var>bw<sub>1</sub></var> <var>bw<sub>2</sub></var> ... <var>bw<sub>W</sub></var>
</pre>
<p>
ďźčĄçŽăŽ <var>M</var> 㨠<var>W</var> (1 ≤ <var>M,W</var> ≤ 12) ăŻăăăăéă¨éăŽĺžŽççŠăŽć°ă§ăăăďźčĄçŽăŤă<var>i</var> çŞçŽăŽéăä˝ĺ
ăŤćă¤ďź˘ç˛ĺăŽé <var>bm<sub>i</sub></var> (0 ≤ <var>bm<sub>i</sub></var> ≤ 50) ăä¸ăăăăăďźčĄçŽăŤă<var>i</var> çŞçŽăŽéăä˝ĺ
ăŤćă¤ďź˘ç˛ĺăŽé <var>bw<sub>i</sub></var> (0 ≤ <var>bw<sub>i</sub></var> ≤ 50) ăä¸ăăăăă<br>
<br>
ăăźăżăťăăăŽć°ăŻ 20 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤă垎ççŠăŽéĺŁăăĺžăăăéťć°ă¨ăăŤăŽăźăŽć大ĺ¤ă1čĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž</h2>
<pre>
3 3
0 20 30
10 20 30
10 10
32 10 15 8 20 10 6 45 50 41
18 0 37 25 45 11 25 21 32 27
7 3
23 14 39 6 47 16 23
19 37 8
0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
12000
53906
11629
</pre>
| [
[
"3 3\n0 20 30\n10 20 30\n10 10\n32 10 15 8 20 10 6 45 50 41\n18 0 37 25 45 11 25 21 32 27\n7 3\n23 14 39 6 47 16 23\n19 37 8\n0 0\n",
"3 3\n0 20 30\n10 20 30\n10 10\n32 10 15 8 20 10 6 45 50 41\n18 0 37 25 45 11 25 21 32 27\n7 3\n23 14 39 6 47 16 23\n19 37 8\n0 0\n"
]
] |
p00286 | Mystery of an Ancient Ruin |
<h1>ĺ¤äťŁéşčˇĄăŽčŹ</h1>
<p>
ĺ¤äťŁéşčˇĄăăčś
大ĺăăżă ăăăçşčŚăăăăĺŚč
éăŻăăăVLA(Very Long Amidakuji)ă¨ĺ˝ĺăăăĺćăŽçľćăVLA㯠<var>N</var> ćŹăŽç¸ŚćŁăćă¤ăăă¤ăăŽé¨ĺăŽçľăżĺăăă§ć§ćăăăĺ¤ăăŽĺ ´ĺçš°ăčżăăĺŤăă§ăăăă¨ăăăăŁăăäžăă°ăĺłăŽVLAăŻďźç¨ŽéĄăŽé¨ĺAă¨Bă使ăŁăďźă¤ăŽé¨ĺăăć§ćăăăŚăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2013_monument" width="400">
</center>
<p>
ăăŽVLAăŽä¸çŤŻăŤĺˇŚăăé çŞăŤ 1,2,3,4,5 ă¨çŞĺˇăă¤ăăăăăăăŽçŞĺˇăăVLAăăăŠăďźăăżă ăăăŽăăŠăćšăŤă¤ăăŚăŻĺéĄććĺžăŽčŁčśłăĺç
§ăăŚăă ăă)ăä¸çŤŻăŤăăŠăçăăĺ ´ćăŽç¸ŚćŁăŤăăŽçŞĺˇăćŻăăăăšăŚăŽçŞĺˇăŤă¤ăăŚăăŠăçľăăĺžă§ăä¸çŤŻăŤćŻăăăçŞĺˇă塌ăăčŞă㨠4,2,5,1,3 ăŤăŞăăăăŽăăăŤă1,2,3,4,5 ă¨ăăçŞĺˇăŽĺă 4,2,5,1,3 ă¨ăăĺăŤĺ¤ćăăăă
</p>
<p>
彟ăăŻVLAăŤăăŁăŚ 1 ăă <var>N</var> ăžă§ăŽçŞĺˇăŽĺăăŠăŽăăăŤĺ¤ćăăăăŽăăçĽăăăăăćä˝ćĽă§ăăŠăăŽăŻĺ¤§ĺ¤ăăă ăăăă§ăă˝ăłăłç˛ĺĺĺşĺ ´č
ă§ăăĺŞç§ăŞăăă°ăŠăăźăŽĺăăĄăŤăVLAăŽăˇăăĽăŹăźăˇă§ăłăäžé źăăă
</p>
<p>
VLAăŻă¨ăŚăéˇăăăăăăŽăžăžăŽçść
ă§ăŻăăă°ăŠăăźăăĄăŤć
ĺ ąăäźăăăă¨ăă§ăăŞăăăăă§ĺŚč
ăăĄăŻăé¨ĺăŽç¨ŽéĄăčąĺ¤§ćĺďźă¤ă§čĄ¨ăăVLAăĺźă§čĄ¨çžăăăă¨ăŤăăă
</p>
<p>
é¨ĺăŻĺăä˝ç˝Žé˘äżă§ăă縌ćŁăä¸č´ăăăăăŤă塌ăăé çŞăŤ <span>+<span> ćźçŽĺă§ćĽçśăăăăăă¨ăă°ăä¸ăăA,B,C,D ă¨ăăé çŞă§éŁçľăăăé¨ĺăŽĺ㯠<span>A+B+C+D</span> ă¨ăăĺźă§čĄ¨č¨ăăăă
</p>
<p>
é¨ĺăŽĺă襨ăĺź <var>seq</var> ㎠<var>m</var> ĺăŽçš°ăčżăăŻă<var>m</var>(<var>seq</var>) ă¨čĄ¨č¨ă§ăăăăă¨ăă°ă<span>A+B</span> ăŽ2ĺăŽçš°ăčżă㯠<span>2(A+B)</span> ă¨čĄ¨ăăăă㯠<span>A+B+A+B</span> ă¨ĺăă§ăăăăžăă<var>seq</var> ăďźă¤ăŽé¨ĺ <var>a</var> ăŽĺ ´ĺăŻă<var>a</var> ăĺ˛ăăăŁăăççĽăăŚăć§ăăŞăă<span>4(A+B)</span> 㨠<span>3(X+Y)</span> ăăăăŽé çŞă§éŁçľăăVLA㯠<span>4(A+B)+3(X+Y)</span> ă¨čĄ¨ăăăăžăăăăŁă㯠<span>2(4(A+B)+3(X+Y))+10C</span> ăŽăăăŤĺ
ĽăĺăŤăăŚăć§ăăŞăă
</p>
<p>
ăăă§ăŻă縌ćŁăŽć° <var>N</var>ăĺé¨ĺăŽć
ĺ ąăč¤ć°ăŽVLAăŽĺźăĺ
Ľĺă¨ăăĺĺźă襨ăVLAăŤăăŁăŚ1ăă <var>N</var> ăžă§ăŽçŞĺˇăŽĺăăŠăŽăăăŤĺ¤ćăăăăăĺşĺăăăăă°ăŠă ăä˝ćăăŞăăă
</p>
<p>
ďźâťčŁčśłďźăăżă ăăăŽăăŠăćšăŤă¤ăăŚďź<br>
ăăżă ăăăŽăă縌ćŁăŽä¸çŤŻăăĺşçşăăŚä¸ăăä¸ă¸é˛ăăăă ăă横ćŁăăăĺ°çšă§ăŻăăŽć¨ŞćŁă§ă¤ăŞăăŁăĺĽăŽç¸ŚćŁăŤç§ťĺăăăăăăă縌ćŁăŽä¸çŤŻăŤăăŠăçăăžă§çš°ăčżăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻďźă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var> <var>K</var>
<var>p<sub>1</sub></var> <var>h<sub>1</sub></var>
<var>g</var><sub>1</sub>(1,1) <var>g</var><sub>1</sub>(1,2) .. <var>g</var><sub>1</sub>(1,<var>N</var>-1)
<var>g</var><sub>1</sub>(2,1) <var>g</var><sub>1</sub>(2,2) .. <var>g</var><sub>1</sub>(2,<var>N</var>-1)
:
<var>g</var><sub>1</sub>(<var>h</var><sub>1</sub>-1,1) <var>g</var><sub>1</sub>(<var>h</var><sub>1</sub>-1,2) .. <var>g</var><sub>1</sub>(<var>h</var><sub>1</sub>-1,<var>N</var>-1)
<var>p<sub>2</sub></var> <var>h<sub>2</sub></var>
<var>g</var><sub>2</sub>(1,1) <var>g</var><sub>2</sub>(1,2) .. <var>g</var><sub>2</sub>(1,<var>N</var>-1)
<var>g</var><sub>2</sub>(2,1) <var>g</var><sub>2</sub>(2,2) .. <var>g</var><sub>2</sub>(2,<var>N</var>-1)
:
<var>g</var><sub>2</sub>(<var>h</var><sub>2</sub>-1,1) <var>g</var><sub>2</sub>(<var>h</var><sub>2</sub>-1,2) .. <var>g</var><sub>2</sub>(<var>h</var><sub>2</sub>-1,<var>N</var>-1)
:
<var>p<sub>K</sub></var> <var>h<sub>K</sub></var>
<var>g<sub>K</sub></var>(1,1) <var>g<sub>K</sub></var>(1,2) .. <var>g<sub>K</sub></var>(1,<var>N</var>-1)
<var>g<sub>K</sub></var>(2,1) <var>g<sub>K</sub></var>(2,2) .. <var>g<sub>K</sub></var>(2,<var>N</var>-1)
:
<var>g<sub>K</sub></var>(<var>h<sub>K</sub></var>-1,1) <var>g<sub>K</sub></var>(<var>h<sub>K</sub></var>-1,2) .. <var>g<sub>K</sub></var>(<var>h<sub>K</sub></var>-1,<var>N</var>-1)
<var>E</var>
expression<sub>1</sub>
expression<sub>2</sub>
:
expression<var><sub>E</sub></var>
</pre>
<p>
1čĄçŽăŤç¸ŚćŁăŽć°ă襨ăć´ć° <var>N</var> (2 ≤ <var>N</var> ≤ 12) ă¨é¨ĺăŽç¨ŽéĄăŽć° <var>K</var> (1 ≤ <var>K</var> ≤ 26)ăä¸ăăăăă
</p>
<p>
2čĄçŽäťĽé㍠<var>K</var> 税éĄăŽé¨ĺăŽć
ĺ ąăä¸ăăăăăĺé¨ĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<ul>
<li> ćĺăŽčĄăŻé¨ĺĺă襨ăďźă¤ăŽčąĺ¤§ćĺ <var>p<sub>i</sub></var> ă¨é¨ĺ <var>i</var> ăŽç¸ŚćŁăŽéˇăă襨ăć´ć° <var>h<sub>i</sub></var> (1 ≤ <var>h<sub>i</sub> ≤ 20)ăĺŤăă</li>
<li> çśă<var>h<sub>i</sub></var>-1 čĄă§é¨ĺ <var>i</var> ăŽć¨ŞćŁăŽć
ĺ ąăä¸ăăăăă<var>g<sub>i</sub></var>(<var>r, c</var>) ăŻé¨ĺ <var>i</var> ăŽä¸çŤŻăăéˇă <var>r</var> ăŽä˝ç˝ŽăŤăăăŚă塌ăă <var>c</var> çŞçŽăŽç¸ŚćŁă¨ <var>c</var>+1 çŞçŽăŽç¸ŚćŁăă¤ăŞă横ćŁăŽćçĄă襨ăă横ćŁăăăă¨ă㯠<var>g<sub>i</sub></var>(<var>r</var>, <var>c</var>) = 1ă横ćŁăăŞăă¨ă㯠<var>g<sub>i</sub></var>(<var>r</var>, <var>c</var>) = 0ă§ăăă
</ul>
<p>
çśăďźčĄăŤĺźăŽć° <var>E</var> (1 ≤ <var>E</var> ≤ 100) ăä¸ăăăăăçśă <var>E</var> čĄăŤVLAăŽĺźă襨ăćĺĺ expression<sub><var>i</var></sub>ďź1ćĺ䝼ä¸1000ćĺ䝼ä¸ďźăä¸ăăăăă
</p>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽćĄäťśăćşăăă
</p>
<ul>
<li> ç°ăŞăé¨ĺăŤĺăĺĺă使ăăăăă¨ăŻăŞăă </li>
<li> ĺé¨ĺ <var>i</var> ăŤă¤ăăŚă<var>g<sub>i</sub></var>(<var>r</var>, <var>c</var>)㨠<var>g<sub>i</sub></var>(<var>r</var>, <var>c</var>+1)ăĺć㍠1 ă¨ăŞăăă¨ăŻăŞăă</li>
<li> ĺźăŤĺŤăžăăć´ć°ăŻ 1 äťĽä¸ 1,000,000,000 䝼ä¸ă§ăăă</li>
<li> ĺźăŤăŻçŠşç˝ăŻĺŤăžăăŞăă</li>
</ul>
<h2>ĺşĺ</h2>
<p>
ĺźăă¨ăŤăVLAăŤăă1ăăNăžă§ăŽĺăŽĺ¤ćçľćăďźčĄăŤĺşĺăăăăăăăăŽć°ĺăŽéăŻçŠşç˝1ă¤ă§ĺşĺăă
</P>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž</h2>
<pre>
5 2
A 5
1 0 0 1
0 1 0 0
1 0 1 0
0 1 0 1
B 4
1 0 0 1
0 1 0 0
0 0 1 0
2
2(A+B)
1000000000(1000000000A+1000000000B)
</pre>
<h2>ĺşĺäž</h2>
<pre>
4 2 5 1 3
1 2 3 4 5
</pre> | [
[
"5 2\nA 5\n1 0 0 1\n0 1 0 0\n1 0 1 0\n0 1 0 1\nB 4\n1 0 0 1\n0 1 0 0\n0 0 1 0\n2\n2(A+B)\n1000000000(1000000000A+1000000000B)\n",
"5 2\nA 5\n1 0 0 1\n0 1 0 0\n1 0 1 0\n0 1 0 1\nB 4\n1 0 0 1\n0 1 0 0\n0 0 1 0\n2\n2(A+B)\n1000000000(1000000000A+1000000000B)\n"
]
] |
p00287 | Wall |
<h1>ĺŁ</h1>
<p>
ďźXXXĺš´ăçŞçśĺşçžăă夊ćľăŽäžľĺ
Ľăé˛ăăăăŤăäşşéĄăŻĺŁăä˝ăăăŽä¸ăŤéăčžźăă ăăăŽçľćăäşşéĄăŽć´ťĺé ĺăŻăăŽĺŁă§ĺ˛ăžăăçŻĺ˛ăŤéĺŽăăăŚăăžăŁăăăăŽé ĺăŻăä¸çŠşăăčŚă㨠<var>W</var> × <var>H</var> ăŽéˇćšĺ˝˘ă§ăăăé ĺĺ
é¨ăŤăŻ <var>x</var> 蝸ăăă㯠<var>y</var> 蝸ăŤĺŻžăăŚĺšłčĄăŞĺŁăăăă¤ăč¨ç˝ŽăăăŚăăăć´ťĺé ĺăŽäžăä¸ĺłăŤç¤şăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2013_wall1" width="360">
</center>
<br>
<p>
äşşéĄăŻć´ťĺé ĺĺ
ăčŞçąăŤç§ťĺăăăă¨ăă§ăăăăĺŁăčśăăăăăŤăŻä¸ĺŽéăŽčłćşăćśč˛ťăăŞăăă°ăŞăăŞăăăă ăăĺŁăčśăăăă¨ăŻă§ăăăďźĺłä¸ăŽ (1)ďźăĺŁăŽäş¤çšăčśăăă㨠(2)ăĺŁăć´ťĺé ĺăŽĺ˘çăŽä¸ă秝ĺăăă㨠(3)ăć´ťĺé ĺĺ¤ăŤĺşăă㨠(4) ăŻă§ăăŞăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2013_wall2" width="640">
</center>
<br>
<p>
é ĺĺ
é¨ăŽĺŁăŽć
ĺ ąă¨ăăă¤ăăŽĺ§çšă¨çľçšăŽçľăĺ
Ľĺăăĺ§çšăăçľçšă¸ç§ťĺăăăăăŤčśăăŞăăă°ăŞăăŞăĺŁăŽć°ăŽćĺ°ĺ¤ăč¨çŽăăăăă°ăŠă ăä˝ćăăŞăăăăă ăăĺŁăŻĺš
ăŽăŞăçˇĺă¨ăăžăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻďźă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>W</var> <var>H</var> <var>M</var>
<var>px</var><sub>1</sub> <var>py</var><sub>1</sub> <var>qx</var><sub>1</sub> <var>qy</var><sub>1</sub>
<var>px</var><sub>2</sub> <var>py</var><sub>2</sub> <var>qx</var><sub>2</sub> <var>qy</var><sub>2</sub>
:
<var>px<sub>M</sub></var> <var>py<sub>M</sub></var> <var>qx<sub>M</sub></var> <var>qy<sub>M</sub></var>
<var>Q</var>
<var>sx</var><sub>1</sub> <var>sy</var><sub>1</sub> <var>gx</var><sub>1</sub> <var>gy</var><sub>1</sub>
<var>sx</var><sub>2</sub> <var>sy</var><sub>2</sub> <var>gx</var><sub>2</sub> <var>gy</var><sub>2</sub>
:
<var>sx<sub>Q</sub></var> <var>sy<sub>Q</sub></var> <var>gx<sub>Q</sub></var> <var>gy<sub>Q</sub></var>
</pre>
<p>
1čĄçŽăŤé ĺăŽć¨ŞăŽéˇăă¨ç¸ŚăŽéˇăă襨ăć´ć° <var>W</var>, <var>H</var> (2 ≤ <var>W,H</var> ≤ 1,000,000,000) ă¨ĺŁăŽć° <var>M</var> (0 ≤ <var>M</var> ≤ 100) ăä¸ăăăăă
</p>
<p>
çśă <var>M</var> čĄăŤĺŁă襨ăçˇĺăŽć
ĺ ąăä¸ăăăăăĺčĄăŤä¸ăăăăďźă¤ăŽć´ć° <var>px<sub>i</sub></var>, <var>py<sub>i</sub></var>, <var>qx<sub>i</sub></var>, <var>qy<sub>i</sub></var> (0 ≤ <var>px<sub>i</sub></var>, <var>qx<sub>i</sub></var> ≤ <var>W</var>, 0 ≤ <var>py<sub>i</sub></var>, <var>qy<sub>i</sub></var> ≤ <var>H</var>) ăŻăăăă <var>i</var> çŞçŽăŽçˇĺăŽçŤŻçšăŽ <var>x</var> 座ć¨ă<var>y</var> 座ć¨ăăăă˛ă¨ă¤ăŽçŤŻçšăŽ <var>x</var> 座ć¨ă<var>y</var> 座ć¨ă襨ăă
</p>
<p>
çśă1čĄăŤčłŞĺăŽć° <var>Q</var> (1 ≤ <var>Q</var> ≤ 100) ăä¸ăăăăăçśă <var>Q</var> čĄăŤĺ質ĺăä¸ăăăăăĺ質ĺăŤĺŤăžăăďźă¤ăŽć´ć° <var>sx<sub>i</sub></var>, <var>sy<sub>i</sub></var>, <var>gx<sub>i</sub></var>, <var>gy<sub>i</sub></var> (0 < <var>sx<sub>i</sub></var>, <var>gx<sub>i</sub></var> < <var>W</var>, 0 < <var>sy<sub>i</sub></var>, <var>gy<sub>i</sub></var> < <var>H</var>) ăŻăăăăĺ§çšăŽ <var>x</var> 座ć¨ă<var>y</var> 座ć¨ăçľçšăŽ <var>x</var> 座ć¨ă<var>y</var> 座ć¨ă襨ăă
</p>
<p>ĺ
ĽĺăŻäťĽä¸ăŽćĄäťśăćşăăă</p>
<ul>
<li> ĺçˇĺ㯠<var>x</var> 蝸ăăă㯠<var>y</var> 蝸ăŤĺŻžăăŚĺšłčĄă§ăăăéˇăăŻ1䝼ä¸ă§ăăă</li>
<li> ďźă¤ăŽäşăăŤĺšłčĄăŞçˇĺăĺăçšăăăăŻçˇĺăĺ
ąćăăăă¨ăŻăŞăă</li>
<li> ăšăżăźăĺ°çšăă´ăźăŤĺ°çšăŻĺŁä¸ăŤăăăă¨ăŻăŞăă</li>
<li> ăŠăŽçˇĺăć´ťĺé ĺăŽĺ˘çă¨çˇĺăĺ
ąćăăăă¨ăŻăŞăă</li>
</ul>
<h2>ĺşĺ</h2>
<p>
質ĺăă¨ăŤăĺŁăčśăăĺć°ăŽćĺ°ĺ¤ăĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž 1</h2>
<pre>
5 6 5
0 2 5 2
0 3 5 3
0 4 3 4
1 4 1 6
3 0 3 6
2
2 5 4 1
2 5 4 5
</pre>
<h2>ĺşĺäž 1</h2>
<pre>
3
1
</pre>
<h2>ĺ
Ľĺäž 2</h2>
<pre>
4 4 0
1
1 1 2 2
</pre>
<h2>ĺşĺäž 2</h2>
<pre>
0
</pre>
<h2>ĺ
Ľĺäž 3</h2>
<pre>
4 7 3
0 2 2 2
3 3 4 3
0 5 4 5
3
1 1 1 3
1 1 1 4
1 1 1 6
</pre>
<h2>ĺşĺäž 3</h2>
<pre>
0
0
1
</pre>
| [
[
"5 6 5\n0 2 5 2\n0 3 5 3\n0 4 3 4\n1 4 1 6\n3 0 3 6\n2\n2 5 4 1\n2 5 4 5\n",
"5 6 5\n0 2 5 2\n0 3 5 3\n0 4 3 4\n1 4 1 6\n3 0 3 6\n2\n2 5 4 1\n2 5 4 5\n"
]
] |
p00288 | Algorithm Exam |
<h1>ă˘ăŤă´ăŞăşă ć¤ĺŽčŠŚé¨</h1>
<p>
ăăŞăăŻă¤ăşă˘ĺ°ĺşăŤăăăă˘ăŤă´ăŞăşă ć¤ĺŽčŠŚé¨ăéĺśăăŚăăăéĺśč˛ťăćĺ°ăŤăăăă¨čăăŚăăžăăéĺśč˛ťăŻăäźĺ ´ä˝żç¨ćăăăšăŽä˝żç¨ćă秝ĺčŁĺŠéăŽçˇĺă§ăă
</p>
<p>
äťĺš´ăŻ <var>N</var> äşşăŽĺé¨č
çťé˛ăăăăăăăă <var>c<sub>i</sub></var> äşşăžă§ĺăĺ
ĽăĺŻč˝ăŞ <var>M</var> ĺăŽäźĺ ´ă確äżăăžăăăăăŞăăŻĺĺé¨č
ăĺż
ăăŠăăăŽäźĺ ´ăŤĺ˛ăĺ˝ăŚăŞăăă°ăŞăăžăăă1 人䝼ä¸ĺ˛ăĺ˝ăŚăäźĺ ´ăŤă¤ăăŚăŻăäşşć°ăŤăăăăă <var>f<sub>i</sub></var> ĺăŽäźĺ ´ä˝żç¨ćăćŻćăĺż
čŚăăăăžăă
</p>
<p>
ă¤ăşă˘ĺ°ĺşăŻĺłăŤç¤şăăăăŤćąčĽżćšĺă¨ĺĺćšĺ㍠1 km ééă§éăčľ°ăŁăŚăăăĺé¨č
ăŽĺŽśă¨äźĺ ´ăŻäş¤ĺˇŽçšä¸ăŤăăă¨čăăžăăĺĺé¨č
ăŻĺŽśăăäźĺ ´ăžă§éăŤć˛żăŁăŚĺžćŠă§ç§ťĺă§ăăžăăăžăăăăŽć¤ĺŽčŠŚé¨ă§ăŻă1 人䝼ä¸ĺé¨č
ăĺăĺ
Ľăăĺäźĺ ´ăŤă¤ă 1 ĺ°ăŽăˇăŁăăŤăăšăéčĄăăăăŽă§ăĺé¨č
ăŻăăšăĺŠç¨ăăăă¨ăă§ăăžăăăă ăăčŞĺăĺé¨ăăäźĺ ´čĄăăŽăăšăŤăăäšăăžăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2013_algorithm" width="600">
</center>
<br>
<p>
ĺăˇăŁăăŤăăšăŻăäźĺ ´ăăăŽćąčĽżćšĺăŽčˇé˘ă¨ĺĺćšĺăŽčˇé˘ăŽĺă <var>D</var> 䝼ĺ
ăŽăăšăŚăŽäş¤ĺˇŽçšăŤĺčťăăžăďźĺłăŻ <var>D</var> = 3 ăŽĺ ´ĺďźăăăšăŽä˝żç¨ć㯠<var>D</var> ăŤćŻäžăă<var>D</var> ă 1 km ĺ˘ăă㨠<var>B</var> ĺä¸ăăăžăăă¤ăžăăăˇăŁăăŤăăšăéčĄăăăŤăŻ 1 äźĺ ´ăăă <var>D × B</var> ĺăŽč˛ťç¨ăćŻćăĺż
čŚăăăăžăăăŞăă<var>D</var> ĺăł <var>B</var> ăŻăăšăŚăŽäźĺ ´ă§ĺ
ąéăŽĺ¤ăç¨ăăžăă
</p>
<p>
秝ĺčŁĺŠéă¨ăŻăĺĺé¨č
ăŤĺż
čŚăŞćä˝éăŽĺžćŠă§ăŽç§ťĺăŤĺŻžăăŚéĺśč
ăĺé¨č
ăŤćŻćă貝ç¨ă§ă1 km ăŤă¤ă㌠1 ĺăćăĺż
čŚăăăăžăă
</p>
<p>
ăăŞăăŻĺé¨č
ăŽĺŽśă¨äźĺ ´ăŽä˝ç˝Žăäźĺ ´ăŽĺăĺ
ĽăĺŻč˝äşşć°ă¨ä˝żç¨ćă<var>D</var> ă 1 km ĺ˘ăăă¨ăăŤĺ çŽăăăćé <var>B</var> ăŽć
ĺ ąăĺ
Ľĺăăźăżă¨ăăŚćăŁăŚăăăĺĺé¨č
ă¸ăŽäźĺ ´ĺ˛ăĺ˝ăŚă¨ <var>D</var> ăćąşĺŽăăăă¨ăă§ăăžăďźăă ăă<var>D</var> 㯠0 䝼ä¸ăŽć´ć°)ăăăŽă¨ăăéĺśč˛ťăŽćĺ°ĺ¤ăćąăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻč¤ć°ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăŽçľăăăŻăźăďźă¤ăŽčĄă§ç¤şăăăăĺăăźăżăťăăăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var> <var>M</var> <var>B</var>
<var>ax</var><sub>1</sub> <var>ay</var><sub>1</sub>
<var>ax</var><sub>2</sub> <var>ay</var><sub>2</sub>
:
<var>ax<sub>N</sub></var> <var>ay<sub>N</sub></var>
<var>bx</var><sub>1</sub> <var>by</var><sub>1</sub> <var>c</var><sub>1</sub> <var>f</var><sub>1</sub>
<var>bx</var><sub>2</sub> <var>by</var><sub>2</sub> <var>c</var><sub>2</sub> <var>f</var><sub>2</sub>
:
<var>bx<sub>M</sub></var> <var>by<sub>M</sub></var> <var>c<sub>M</sub></var> <var>f<sub>M</sub></var>
</pre>
<p>
1 čĄçŽăŻďźă¤ăŽć´ć°ăăăŞăă<var>N</var> (1 ≤ <var>N</var> ≤ 100) ăŻĺé¨č
ăŽäşşć°ă<var>M</var> (1 ≤ <var>M</var> ≤ 5) ăŻäźĺ ´ć°ă§ăăă<var>B</var> (0 ≤ <var>B</var> ≤ 1000) ăŻăˇăŁăăŤăăšăéčĄăăéăŤă<var>D</var>ă 1 km ĺ˘ăăă¨ăăŤĺ çŽăăăćéă§ăăăçśă <var>N</var> čĄăŤĺĺé¨č
ăŽĺŽśăŽĺş§ć¨ăä¸ăăăăă<var>ax<sub>i</sub></var>, <var>ay<sub>i</sub></var> (-1000 ≤ <var>ax<sub>i</sub></var>, <var>ay<sub>i</sub></var> ≤ 1000) ăŻăăăăĺé¨č
<var>i</var> ăŽĺŽśăŽ <var>x</var> 座ć¨ă¨ <var>y</var> 座ć¨ă示ăăçśă <var>M</var> čĄăŤĺäźĺ ´ăŽć
ĺ ąăä¸ăăăăă<var>bx<sub>i</sub></var>, <var>by<sub>i</sub></var> (-1000 ≤ <var>bx<sub>i</sub></var>, <var>by<sub>i</sub></var> ≤ 1000) ăŻăăăăäźĺ ´ <var>i</var> ㎠<var>x</var> 座ć¨ă¨ <var>y</var> 座ć¨ă示ăă<var>c<sub>i</sub></var>(1 ≤ <var>c<sub>i</sub></var> ≤ 100) ăŻäźĺ ´ <var>i</var> ăŽĺăĺ
ĽăĺŻč˝äşşć°ă<var>f<sub>i</sub></var> (0 ≤ <var>f<sub>i</sub></var> ≤ 100000) ăŻäźĺ ´ <var>i</var> ăŽä˝żç¨ćă示ăăăă ăă<var>c<sub>1</sub></var> ăă<var>c<sub>M</sub></var> ăžă§ăŽĺč¨ăŻ <var>N</var> 䝼ä¸ă§ăăă
</p>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽćĄäťśăćşăăă¨čăăŚăăă
</p>
<ul>
<li> 使ç¨ăăäźĺ ´ăćąşăăă¨ăă<var>D = i</var> ăŤăăăăăăăŽäźĺ ´ă¸ăŽĺé¨č
ăŽĺ˛ăĺ˝ăŚćšăŽăăĄç§ťĺčŁĺŠéăćĺ°ă¨ăŞăă¨ăăŽééĄă <var>F</var>(<var>i</var>) ă¨ăăăăăŽă¨ăă<var>F</var>(<var>i</var>+2) - <var>F</var>(<var>i</var>+1) ≥ <var>F</var>(<var>i</var>+1)-<var>F</var>(<var>i</var>) ăćçŤăăă</li>
</ul>
<p>
ăăźăżăťăăăŽć°ăŻ 10 ăčś
ăăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăźăżăťăăăă¨ăŤčŠŚé¨ăŽéĺśč˛ťăŽćĺ°ĺ¤ă 1 čĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž</h2>
<pre>
1 1 1
0 0
0 0 1 0
1 1 0
0 0
-3 0 2 3
1 3 1
0 0
-3 0 2 3
0 -5 2 0
4 0 2 1
4 3 1
0 0
0 0
0 0
0 0
-3 0 2 3
0 -5 2 0
4 0 2 1
6 3 1
0 0
0 0
0 0
0 0
0 0
0 0
-3 0 2 3
0 -5 2 0
4 0 2 1
6 3 2
0 0
0 0
0 0
0 0
0 0
0 0
-3 0 2 3
0 -5 2 0
4 0 2 1
10 5 1
0 0
2 0
4 0
8 0
100 0
100 0
100 0
100 0
100 0
100 0
-3 0 1 0
1 0 1 0
3 0 2 0
15 0 1 0
105 0 6 0
10 5 2
0 0
2 0
4 0
8 0
100 0
100 0
100 0
100 0
100 0
100 0
-3 0 1 0
1 0 1 0
3 0 2 0
15 0 1 0
105 0 6 0
0 0 0
</pre>
<h2>ĺşĺäž</h2>
<pre>
0
3
5
11
18
28
20
38
</pre> | [
[
"1 1 1\n0 0\n0 0 1 0\n1 1 0\n0 0\n-3 0 2 3\n1 3 1\n0 0\n-3 0 2 3\n0 -5 2 0\n4 0 2 1\n4 3 1\n0 0\n0 0\n0 0\n0 0\n-3 0 2 3\n0 -5 2 0\n4 0 2 1\n6 3 1\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n-3 0 2 3\n0 -5 2 0\n4 0 2 1\n6 3 2\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n-3 0 2 3\n0 -5 2 0\n4 0 2 1\n10 5 1\n0 0\n2 0\n4 0\n8 0\n100 0\n100 0\n100 0\n100 0\n100 0\n100 0\n-3 0 1 0\n1 0 1 0\n3 0 2 0\n15 0 1 0\n105 0 6 0\n10 5 2\n0 0\n2 0\n4 0\n8 0\n100 0\n100 0\n100 0\n100 0\n100 0\n100 0\n-3 0 1 0\n1 0 1 0\n3 0 2 0\n15 0 1 0\n105 0 6 0\n0 0 0\n",
"1 1 1\n0 0\n0 0 1 0\n1 1 0\n0 0\n-3 0 2 3\n1 3 1\n0 0\n-3 0 2 3\n0 -5 2 0\n4 0 2 1\n4 3 1\n0 0\n0 0\n0 0\n0 0\n-3 0 2 3\n0 -5 2 0\n4 0 2 1\n6 3 1\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n-3 0 2 3\n0 -5 2 0\n4 0 2 1\n6 3 2\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n-3 0 2 3\n0 -5 2 0\n4 0 2 1\n10 5 1\n0 0\n2 0\n4 0\n8 0\n100 0\n100 0\n100 0\n100 0\n100 0\n100 0\n-3 0 1 0\n1 0 1 0\n3 0 2 0\n15 0 1 0\n105 0 6 0\n10 5 2\n0 0\n2 0\n4 0\n8 0\n100 0\n100 0\n100 0\n100 0\n100 0\n100 0\n-3 0 1 0\n1 0 1 0\n3 0 2 0\n15 0 1 0\n105 0 6 0\n0 0 0\n"
]
] |
p00289 | Catch a Thief |
<h1>ă˘ăŤăťăăłćç˛ä˝ćŚ</h1>
<p>
ćŞçă˘ăŤăťăăłăŻĺ¤§čăŤăăăăŤăŹă¸ă§ăźăăéăŽăˇăŁăăăłăçăżĺťăŁăăčŚé¨ă§ăăăăŞăăŻăă˘ăŤăťăăłă䝲éăŽăłăăŚć°ăŤăˇăŁăăăłă渥ăăăăă¨ăăć
ĺ ąăćăŤĺ
Ľăăăăă ăăłăăŚć°ăŻă˘ăŤăťăăłăŽă˘ă¸ăăžă§ĺşĺăăŞăăŽă§ăă˘ă¸ăăŽĺ¤ă§ć¸ĄăăăăăăăŞăăŻă˘ăŤăťăăłăĺž
ăĄäźăăăŚćăžăăăă¨ăŤăăăăăŽçşăŻĺ¤ăĺä¸çşăŞăŽă§ăéăč¤éăŤĺ
Ľăçľăă§ăăŚăăŠăŽéăä¸ćšéčĄăŤăŞăŁăŚăăăă˘ăŤăťăăłăă˘ă¸ăăăĺă渥ăĺ ´ćăžă§ăŠăŽçľčˇŻăéăăŽăăŻăăăăŞăăăäşşĺĄä¸čśłăŽăăăĺž
ăĄäźăĺ ´ćăŻďźă¤ăŤč¨ĺŽăăŞăăă°ăŞăăŞăă
</p>
<p>
ăăŞăăŻăă˘ă¸ăăĺŤăăăă¤ăăŽĺ°çšăé¸ăłăăăăăă¤ăŞăéă調ăšăĺ°ĺłăä˝ăŁăăĺ°ĺłä¸ăŽĺ°çšăŽăŠăăă§ĺă渥ăăčĄăăăăăăăĺă渥ăĺ ´ćăĺ¤ć揥珏ă䝼ä¸ăŽăăăŤĺž
ăĄäźăĺ ´ćăé¸ăśă
</p>
<ol>
<li> ă˘ă¸ăăŻĺąéşăŞăŽă§ă˘ă¸ă䝼ĺ¤ăŽĺ°çšă</li>
<li> ă˘ăŤăťăăłăă˘ă¸ăăăĺă渥ăĺ ´ćăžă§ăŠăŽăăăŞçľčˇŻăéăŁăŚăĺż
ăéăĺ°çšă</li>
<li> 1, 2 ăŽä¸Ąćšăćşăăĺ°çšăŽăăĄăĺă渥ăĺ ´ćăŤăăŠăçăăžă§ăŤééăăŞăăă°ăŞăăŞăĺ°çšăŽć°ăăăĺ°ăŞăĺ°çšăăă ăăăłăăŚć°ăŤčŚă¤ăăăŞăăăăŤăăăăăŤă1, 2 ăćşăăĺ°çšăäťăŤăŞăĺ ´ĺăŽăżăĺă渥ăĺ ´ćăĺž
ăĄäźăĺ ´ćăŤăăă</li>
</ol>
<p>
ă˘ă¸ăă¨ĺž
ăĄäźăĺ ´ćăŽĺčŁăăăŞăĺ°çšăă¤ăŞăéăŽć
ĺ ąăŽăă¨ăŤă質ĺă¨ăăŚĺă渥ăĺ ´ćăč¤ć°ĺ
Ľĺăăăă¨ăăăăăăăŽĺă渥ăĺ ´ćăŤă¤ăăŚĺž
ăĄäźăĺ ´ćăĺşĺăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻďźă¤ăŽăăźăżăťăăăăăŞăăĺ
ĽĺăăźăżăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var> <var>M</var>
<var>s</var><sub>1</sub> <var>t</var><sub>1</sub>
:
<var>s<sub>M</sub></var> <var>t<sub>M</sub></var>
<var>Q</var>
<var>r</var><sub>1</sub>
:
<var>r<sub>Q</sub></var>
</pre>
<p>
ďźčĄçŽăŻďźă¤ăŽć´ć°ăăăŞăă<var>N</var> (3 ≤ <var>N</var> ≤ 100000) ăŻĺ°çšăŽć°ă<var>M</var>(<var>N</var>-1 ≤ <var>M</var> ≤ 300000) ăŻĺ°ĺłăŤć¸ăăăăšăŚăŽéăŽć°ă襨ăăçśă <var>M</var> čĄăŤéŁăĺăŁăĺ°çšăŽéăç´ćĽă¤ăŞăéăä¸ăăăăă<var>s<sub>i</sub></var> 㨠<var>t<sub>i</sub></var> (1 ≤ <var>s<sub>i</sub></var> ≠ <var>t<sub>i</sub></var> ≤ <var>N</var>) 㯠<var>i</var> çŞçŽăŽéăŽăăăăĺ§çšăçľçšă¨ăŞăĺ°çšăŽçŞĺˇă襨ăăăă ăăă˘ă¸ăăŽçŞĺˇăŻ1ă¨ăăă˘ă¸ăăăăŻăăšăŚăŽĺ°çšă¸ĺ°éă§ăăă
</p>
<p>
çśăďźčĄăŤčłŞĺăŽć° <var>Q</var>(1 ≤ <var>Q</var> < <var>N</var> ) ăä¸ăăăăăçśă <var>Q</var> čĄăŤčłŞĺăä¸ăăăăă<var>i</var> çŞçŽăŽčłŞĺă¨ăăŚăĺă渥ăĺ ´ćăŽçŞĺˇ <var>r<sub>i</sub></var> (2 ≤ <var>r<sub>i</sub></var> ≤ <var>N</var>) ăä¸ăăăăă
</p>
<h2>ĺşĺ</h2>
<p>
質ĺăă¨ăŤăĺž
ăĄäźăĺ ´ćăŽçŞĺˇăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž 1</h2>
<pre>
6 7
1 2
2 3
1 3
1 4
4 5
5 6
6 1
5
2
3
4
5
6
</pre>
<h2>ĺşĺäž 1</h2>
<pre>
2
3
4
4
5
</pre>
<h2>ĺ
Ľĺäž 2</h2>
<pre>
11 15
1 2
1 3
1 4
2 5
3 6
3 7
3 9
4 7
4 10
4 11
6 2
6 8
7 9
8 11
9 6
10
6
2
10
8
9
3
5
11
4
7
</pre>
<h2>ĺşĺäž 2</h2>
<pre>
6
2
4
6
9
3
2
11
4
7
</pre> | [
[
"6 7\n1 2\n2 3\n1 3\n1 4\n4 5\n5 6\n6 1\n5\n2\n3\n4\n5\n6\n",
"6 7\n1 2\n2 3\n1 3\n1 4\n4 5\n5 6\n6 1\n5\n2\n3\n4\n5\n6\n"
]
] |
p00290 | The Number of Chairs |
<h1>ć¤
ĺăŽçˇć°</h1>
<p>
é¸ćăŽăżăŞăăăăă˝ăłăłç˛ĺĺăŤăăăăăăă˝ăłăłç˛ĺĺăŽćŹé¸ăŻäźć´Ľĺ¤§ĺŚă§čĄăăăäźĺ ´ĺ
ă§ăŻ
ďźă¤ăŽćşăŤďźăăźă ăĺ˛ăĺ˝ăŚăăăžăăăă˝ăłăłç˛ĺĺăŻďźăăźă ďźäşşăŞăŽă§ăăăźă ć°ĂďźčăŽć¤
ĺăĺż
čŚă§ăă大ĺŚă§ăŻăäťăŤăć§ă
ăŞă¤ăăłăăŽäźĺ ´č¨ĺśă§ćşă¨ć¤
ĺăćşĺăăćŠäźăăăăžăăăĺż
čŚăŞćşă¨ć¤
ĺăŽć°ăć§ă
ă§ăăăăă§ăăăă¤ăăłăăŤĺŻžăăŚćşĺăăćşăŽć°ă¨ăćşďźă¤ăăăăŤĺż
čŚăŞć¤
ĺăŽć°ăä¸ăăăăă¨ăăĺż
čŚăŞć¤
ĺăŽçˇć°ăč¨çŽăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>d</var> <var>c</var>
</pre>
<p>
ĺ
ĽĺăŻďźčĄă§ăăăĺż
čŚăŞćşăŽć° <var>d</var> (1 ≤ <var>d</var> ≤ 100) ă¨ćşďźă¤ăăăăŤĺż
čŚăŞć¤
ĺăŽć° <var>c</var> (1 ≤ <var>c</var> ≤ 10) ă襨ăć´ć°ăä¸ăăăăă
</p>
<h2>ĺşĺ</h2>
<p>
ă¤ăăłăăŤăăăŚĺż
čŚăŞć¤
ĺăŽçˇć°ăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäžďź</h2>
<pre>
20 2
</pre>
<h2> ĺşĺäžďź</h2>
<pre>
40
</pre>
<h2>ĺ
Ľĺäžďź</h2>
<pre>
1 1
</pre>
<h2> ĺşĺäžďź</h2>
<pre>
1
</pre> | [
[
"20 2\n",
"20 2\n"
]
] |
p00291 | A Fat Wallet |
<h1>ă貥ĺ¸ăĄăżă診ć</h1>
<p>
ďźćăŤćśč˛ťç¨ăďźďź
ăŤăŞăŁăŚăăăă貥ĺ¸ă祏貨ă§ăăłăăłăŤăŞăŁăŚăăžăăăăĺăééĄăćăĄćŠăăŞă祏貨ăŽćć°ăĺ°ăŞăăăăă§ăăăă祏貨ăŽĺč¨ăďźďźďźďźĺ䝼ä¸ăŞăă祏貨ăăćăŤä¸ĄćżăăŚăă貥ĺ¸ăŽăĄăżăçść
ă解ćśă§ăăžăă
</p>
<p>
ă貥ĺ¸ăŽä¸ăŽçĄŹč˛¨ăŽćć°ă税éĄăă¨ăŤä¸ăăăăă¨ăă祏貨ăăćăŤä¸Ąćżă§ăăăăŠăăăĺ¤ĺŽăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>c1</var> <var>c5</var> <var>c10</var> <var>c50</var> <var>c100</var> <var>c500</var>
</pre>
<p>
ĺ
ĽĺăŻďźčĄăăăŞăă<var>c1</var>ă<var>c5</var>ă<var>c10</var>ă<var>c50</var>ă<var>c100</var>ă<var>c500</var> (0 ≤ <var>c1, c5, c10, c50, c100, c500</var> ≤ 50) ăŻăăăăăă1ĺă5ĺă10ĺă50ĺă100ĺă500ĺ祏貨ăŽćć°ă襨ăă
</p>
<h2>ĺşĺ</h2>
<p>
祏貨ăăćăŤä¸Ąćżă§ăăăŞă1 ăăăăă§ăŞăăă° 0 ăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäžďź</h2>
<pre>
3 1 4 0 4 1
</pre>
<h2> ĺşĺäžďź</h2>
<pre>
0
</pre>
<br>
<h2>ĺ
Ľĺäžďź</h2>
<pre>
2 1 4 3 2 3
</pre>
<h2> ĺşĺäžďź</h2>
<pre>
1
</pre>
<br>
<h2>ĺ
Ľĺäžďź </h2>
<pre>
21 5 9 3 1 1
</pre>
<h2>ĺşĺäžďź</h2>
<pre>
0
</pre>
<br>
<h2>ĺ
Ľĺäžďź</h2>
<pre>
2 4 3 3 3 1
</pre>
<h2> ĺşĺäžďź</h2>
<pre>
1
</pre>
<br>
<h2>ĺ
Ľĺäžďź</h2>
<pre>
50 50 50 4 0 0
</pre>
<h2> ĺşĺäžďź</h2>
<pre>
1
</pre>
| [
[
"3 1 4 0 4 1\n",
"3 1 4 0 4 1\n"
]
] |
p00292 | The Last One is the Best |
<h1>ćŽăçŠăŤăŻçŚăăă</h2>
<p>
<var>K</var> ĺăŽçłăăă<var>P</var> äşşăé çŞăŤďźă¤ăă¤çłăĺăă˛ăźă ăăăăžăă<var>P</var> äşşçŽăçłăĺăŁăćçšă§ăăžă çłăćŽăŁăŚăăă°ăăžăďźäşşçŽăăé çŞăŤďźă¤ăă¤çłăĺăŁăŚăăăžăăăăŽă˛ăźă ă§ăŻăćĺžăŽçłăĺăŁăäşşăĺăĄă¨ăŞăăžăă<var>K</var> ă¨<var>P</var> ăä¸ăăăăă¨ăăä˝äşşçŽăĺă¤ăĺ¤ĺŽăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var>
<var>K</var><sub>1</sub> <var>P</var><sub>1</sub></var>
<var>K</var><sub>2</sub> <var>P</var><sub>2</sub></var>
:
<var>K<sub>N</sub></var> <var>P<sub>N</sub></var>
</pre>
<p>
ďźčĄçŽăŤăŻă˛ăźă ăčĄăĺć° <var>N</var> (1 ≤ <var>N</var> ≤ 100) ăä¸ăăăăăçśă <var>N</var> čĄăŤă<var>i</var> ĺçŽăŽă˛ăźă ăŤăăăçłăŽĺć° <var>K<sub>i</sub></var> (2 ≤ <var>K<sub>i</sub></var> ≤ 1000) ă¨ăă˛ăźă ăŤĺĺ ăăäşşć° <var>P<sub>i</sub></var> (2 ≤ <var>P<sub>i</sub></var> ≤ 1000) ăä¸ăăăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăăăăŽă˛ăźă ăŤă¤ăăŚăä˝äşşçŽăĺă¤ăăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž</h2>
<pre>
3
10 3
2 10
4 2
</pre>
<h2> ĺşĺäž</h2>
<pre>
1
2
2
</pre>
| [
[
"3\n10 3\n2 10\n4 2\n",
"3\n10 3\n2 10\n4 2\n"
]
] |
p00293 | Bus Timetable |
<h1>衯çˇăăšăŽćĺťčĄ¨</h1>
<p>
ăăšăăă˘ăŽĺĽćŹĄéĺăŻăĺ¸ĺ
ăŽăăšăăăĺŠç¨ăăŚăăžăăăăćĽăľă¨ăĺĽćŹĄéĺăŽĺŽśăŽĺăŽăăšĺăăĺşçşăăăăšăŚăŽăăšăĺçăŤĺăăăă¨ăćăçŤăĄăžăăăăăŽăăšĺăŤăŻéŁŻçĺąąčĄăă¨éś´ăąĺčĄăăŽďźă¤ăŽăăščˇŻçˇăéăăžăăĺ衯çˇăŽćĺťčĄ¨ăŻćăŤĺ
Ľăăžăăăăďźă¤ăŽćĺťčĄ¨ă¨ăăŚăžă¨ăăćšăăăšĺă§ĺçăćŽăăăăăŞăăžăă
</p>
<p>
ĺĽćŹĄéĺăĺŠăăăăăŤăďźă¤ăŽčˇŻçˇăŽćĺťčĄ¨ăăďźćďźĺăĺşćşă¨ăăŚĺşçşćĺťăćŠăé ăŤďźă¤ăŽćĺťčĄ¨ă¨ăăŚăžă¨ăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var> <var>h</var><sub>1</sub> <var>m</var><sub>1</sub> <var>h</var><sub>2</sub> <var>m</var><sub>2</sub> ... <var>h<sub>N</sub></var> <var>m<sub>N</sub></var>
<var>M</var> <var>k</var><sub>1</sub> <var>g</var><sub>1</sub> <var>k</var><sub>2</sub> <var>g</var><sub>2</sub> ... <var>k<sub>M</sub></var> <var>g<sub>M</sub></var>
</pre>
<p>
ďźčĄçŽăŤă飯çĺąąčĄăăŽăăšăŽć°ă襨ăć´ć° <var>N</var> (1 ≤ <var>N</var> ≤ 100) ă¨ăăăăŤçśăăŚéŁŻçĺąąčĄăăŽăăšĺşçşćĺťăćŠăé ăŤä¸ăăăăăĺşçşćĺťăŻć´ć° <var>h<sub>i</sub></var> (0 ≤ <var>h<sub>i</sub></var> ≤ 23) 㨠<var>m<sub>i</sub></var> (0 ≤ <var>m<sub>i</sub></var> ≤ 59) ăăăŞăă<var>h<sub>i</sub></var> ć <var>m<sub>i</sub></var> ĺ㍠<var>i</var> çŞçŽăŽăăšăĺşçşăăăă¨ă襨ăăďźčĄçŽăŤăéś´ăąĺčĄăăŽăăšăŽć°ă襨ăć´ć° <var>M</var> (1 ≤ <var>M</var> ≤ 100) ă¨ăăăăŤçśăăŚéś´ăąĺčĄăăŽăăšĺşçşćĺťăćŠăé ăŤä¸ăăăăăĺşçşćĺťăŻć´ć° <var>k<sub>i</sub></var> (0 ≤ <var>k<sub>i</sub></var> ≤ 23) 㨠<var>g<sub>i</sub></var> (0 ≤ <var>g<sub>i</sub></var> ≤ 59) ăăăŞăă<var>k<sub>i</sub></var> ć <var>g<sub>i</sub></var> ĺ㍠<var>i</var> çŞçŽăŽăăšăĺşçşăăăă¨ă襨ăăĺă衯çˇăŤăŻăĺăćĺťăŤĺşçşăăăăšăŻăŞăăăŽă¨ăăă
</p>
<h2>ĺşĺ</h2>
<p>
ďźă¤ăŽčˇŻçˇăŽćĺťčĄ¨ăăďźćďźĺăĺşćşă¨ăăŚĺşçşćĺťăćŠăé ăŤďźă¤ăŤăžă¨ăăćĺťčĄ¨ăďźčĄăŤĺşĺăăăăă ăăĺăćĺťăŤč¤ć°ăŽăăšăĺşçşăăă¨ăăŻďźă¤ă ăăĺşĺăăăĺşçşćĺťăŽćă¨ĺă <span>:</span> ă§ĺşĺăăĺăďźćĄăŽă¨ăăŻĺˇŚăŤďźăă˛ă¨ă¤ĺ ăăŚďźćĄă§ĺşĺăăăćĺťă¨ćĺťăŽéăŻçŠşç˝1 ă¤ă§ĺşĺăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäžďź </H2>
<pre>
2 9 8 15 59
1 8 27
</pre>
<h2>ĺşĺäžďź</h2>
<pre>
8:27 9:08 15:59
</pre>
<h2>ĺ
Ľĺäžďź </h2>
<pre>
2 0 0 21 0
3 7 30 21 0 23 7
</pre>
<h2>ĺşĺäžďź</h2>
<pre>
0:00 7:30 21:00 23:07
</pre> | [
[
"2 9 8 15 59\n1 8 27\n",
"2 9 8 15 59\n1 8 27\n"
]
] |
p00294 | Railroad II |
<h1>éé衯çˇII</h1>
<p>
ăăăăŽä˝ăčĄăŤăŻăĺłăŽăă㪠<var>N</var> ĺăŽé§
ăăăŞăĺç°çśăŽéé衯çˇăăăăžăăăăŽčˇŻçˇăŽĺé§
ăŤăŻ 0 ăă <var>N</var>-1 ăžă§ăŽçŞĺˇăé çŞăŤĺ˛ăĺ˝ăŚăăăŚăăŚăéŁăŽé§
ăžă§100 ĺă§ç§ťĺăăăă¨ăă§ăăžăă秝ĺăŻăŠăĄăăŽćšĺăŤă§ăĺŻč˝ă§ăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_railroad" width="240">
</center>
<br>
<p>
ăăăăŻăăŽčˇŻçˇä¸ăŽăăă¤ăăŽé§
ă§č˛ˇăçŠăăăăă¨ćăŁăŚăăžăăăăă§ăăăă°ăŠă ăä˝ćăăŚç§ťĺ貝ăč¨çŽăăăă¨ăŤăăžăăăăăé§
ăĺ§çšă¨ăăŚă財ăçŠăăăăăšăŚăŽé§
ă訪ĺăăćĺ°ăŽč˛ťç¨ďźĺďźăćąăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăĺăé§
ăä˝ĺşŚč¨ŞĺăăŚăčŻăăăŠăŽăăăŞé çŞă§é§
ă訪ĺăăŚăć§ăăžăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var> <var>M</var> <var>p</var>
<var>d</var><sub>1</sub>
<var>d</var><sub>2</sub>
:
<var>d<sub>M</sub></var>
</pre>
<p>
1čĄçŽăŤé§
ăŽć° <var>N</var> (2 ≤ <var>N</var> ≤ 100000)ă財ăçŠăăăé§
ăŽć° <var>M</var> (1 ≤ <var>M</var> ≤ 10000 ă㤠<var>M</var> < <var>N</var>)ăĺşçşăăé§
ăŽçŞĺˇ <var>p</var> (0 ≤ <var>p</var> ≤ <var>N</var>-1) ăä¸ăăăăăçśă <var>M</var> čĄăŤč˛ˇăçŠăăăé§
ăŽçŞĺˇ <var>d<sub>i</sub></var> (0 ≤ <var>d<sub>i</sub></var> ≤ <var>N</var>-1) ăä¸ăăăăăăă ăă<var>d<sub>i</sub></var>ăŻĺ
¨ăŚç°ăŞăă<var>p</var> ăăžăăŠăŽ <var>d<sub>i</sub></var> ă¨ăç°ăŞăăăŽă¨ăăă
</p>
<h2>ĺşĺ</h2>
<p>
ćĺ°ăŽč˛ťç¨ăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäžďź </h2>
<pre>
5 4 0
1
2
3
4
</pre>
<h2>ĺşĺäžďź</h2>
<pre>
400
</pre>
<h2>ĺ
Ľĺäžďź</h2>
<pre>
7 2 1
6
2
</pre>
<h2>ĺşĺäžďź</h2>
<pre>
400
</pre>
| [
[
"5 4 0\n1\n2\n3\n4\n",
"5 4 0\n1\n2\n3\n4\n"
]
] |
p00295 | Floppy Cube |
<h1>ăăăăăźăăĽăźă</h1>
<p>
ăăăăăźăăĽăźăăăăă°ăŠăăłă°ă§č§ŁăăŚăżăžăăăăăăăăăźăăĽăźăăŻĺłăŽăăăŤčĄ¨é˘ăŤč˛ăŽă¤ăăďźĺăŽçŤćšä˝ăăć§ćăăăŚăăçŤä˝ăăşăŤă§ăăăĽăźăăŽĺăĺ蝢ăăăăă¨ăŤăăŁăŚăďźă¤ăŽĺé˘ăŽč˛ăăăăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_floppyCube1" width="300">
</center>
<br>
<p>
ăăăăăźăăĽăźăăŤĺŻžăăŚăŻä¸ĺłăŽăăăŞďźç¨ŽéĄăŽćä˝ăčĄăăă¨ăă§ăăä¸ĺăŽćä˝ă§ă獯ăŤăăďźă¤ăŽéŁćĽăăăăĽăźăăďźďźďźĺşŚĺ蝢ăăăă¨ăă§ăăžăăăăăăăăăăăŤăĺłă§ăŻăä¸é˘ăŤďź(辤č˛)ăä¸é˘ăŤďź(çˇč˛)ăĺłĺé˘ăŤâĄ(éťč˛)ă塌ĺé˘ăŤâ(éč˛)ăĺłĺĽĽé˘ăŤâ(ć°´č˛)ă塌弼é˘ăŤâ ç´Ťč˛) ăŽč¨ĺˇăäťăăŚăăçść
ăĺćçść
ă¨ăăŚăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_floppyCube2" width="600">
</center>
<br>
<p>
ăăăăăźăăĽăźăăŽĺćçść
ăä¸ăăăăăŽă§ăăăşăŤă解ăăăăŤĺż
čŚăŞćĺ°ăŽćä˝ĺć°ăćąăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var>
<var>puzzle</var><sub>1</sub>
<var>puzzle</var><sub>2</sub>
:
<var>puzzle</var><sub>N</sub>
</pre>
<p>
ďźčĄçŽăŽ<var>N</var> (1 ≤ <var>N</var> ≤ 30) ăŻćä˝ĺć°ăč¨çŽăăăăăşăŤăŽć°ă§ăăăçśăNčĄăŤĺăăăăăźăăĽăźăăŽĺćçść
<var>puzzle<sub>i</sub></var> ăä¸ăăăăă<var>puzzle<sub>i</sub></var> ăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>p</var><sub>1</sub> <var>p</var><sub>2</sub> <var>p</var><sub>3</sub> <var>p</var><sub>4</sub> <var>p</var><sub>5</sub> <var>p</var><sub>6</sub> <var>p</var><sub>7</sub> <var>p</var><sub>8</sub> <var>p</var><sub>9</sub> <var>p</var><sub>10</sub> <var>p</var><sub>11</sub> <var>p</var><sub>12</sub> <var>p</var><sub>13</sub> <var>p</var><sub>14</sub> <var>p</var><sub>15</sub> <var>p</var><sub>16</sub> <var>p</var><sub>17</sub> <var>p</var><sub>18</sub> <var>p</var><sub>19</sub> <var>p</var><sub>20</sub> <var>p</var><sub>21</sub> <var>p</var><sub>22</sub> <var>p</var><sub>23</sub> <var>p</var><sub>24</sub> <var>p</var><sub>25</sub> <var>p</var><sub>26</sub> <var>p</var><sub>27</sub> <var>p</var><sub>28</sub> <var>p</var><sub>29</sub> <var>p</var><sub>30</sub>
</pre>
<p>
ĺăăăăăźăăĽăźăăŽć
ĺ ąăŻ 30 ĺăŽć´ć° <var>p<sub>i</sub></var> (1 ≤ <var>p<sub>i</sub></var> ≤ 6) ăăăŞăă<var>p<sub>i</sub></var> ăŻăä¸ĺłăŽăăăŤăăăăăźăăĽăźăăŽĺé˘ăŤçŞĺˇ <var>i</var> ăćŻăŁăă¨ăăŽăăăŽăăĽăźăăŽé˘ăŽč˛ă襨ăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_floppyCube3" width="600">
</center>
<br>
<p>
ăăşăŤăŻăĺ¤ăă¨ăďźĺăŽćä˝ă§č§Łăăă¨ăă§ăăă¨äťŽĺŽăăŚăăă
</p>
<h2>ĺşĺ</h2>
<p>
ăăşăŤăă¨ăŤăćĺ°ăŽćä˝ĺć°ăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž </h2>
<pre>
4
1 1 1 1 1 1 1 1 1 2 2 2 4 4 4 6 6 6 5 5 5 3 3 3 3 3 3 3 3 3
3 3 3 1 1 1 1 1 1 2 2 2 4 4 6 4 6 6 5 5 5 3 3 3 3 3 3 1 1 1
3 3 3 1 1 3 1 1 1 2 2 5 6 4 4 4 6 6 2 5 5 3 3 3 1 3 3 1 1 1
1 3 1 3 1 3 3 1 3 2 2 2 6 4 4 6 6 4 5 5 5 1 3 1 1 3 1 3 1 3
</pre>
<h2>ĺşĺäž</h2>
<pre>
0
1
2
7
</pre> | [
[
"4\n1 1 1 1 1 1 1 1 1 2 2 2 4 4 4 6 6 6 5 5 5 3 3 3 3 3 3 3 3 3\n3 3 3 1 1 1 1 1 1 2 2 2 4 4 6 4 6 6 5 5 5 3 3 3 3 3 3 1 1 1\n3 3 3 1 1 3 1 1 1 2 2 5 6 4 4 4 6 6 2 5 5 3 3 3 1 3 3 1 1 1\n1 3 1 3 1 3 3 1 3 2 2 2 6 4 4 6 6 4 5 5 5 1 3 1 1 3 1 3 1 3\n",
"4\n1 1 1 1 1 1 1 1 1 2 2 2 4 4 4 6 6 6 5 5 5 3 3 3 3 3 3 3 3 3\n3 3 3 1 1 1 1 1 1 2 2 2 4 4 6 4 6 6 5 5 5 3 3 3 3 3 3 1 1 1\n3 3 3 1 1 3 1 1 1 2 2 5 6 4 4 4 6 6 2 5 5 3 3 3 1 3 3 1 1 1\n1 3 1 3 1 3 3 1 3 2 2 2 6 4 4 6 6 4 5 5 5 1 3 1 1 3 1 3 1 3\n"
]
] |
p00296 | Baton Relay Game |
<h1>ăăăłăŞăŹăźă˛ăźă </h1>
<p>
ă˘ăŤăéŤć Ąă§ăŻăćŻĺš´ĺ
¨ć Ąçĺžăĺĺ ăăă˛ăźă ăčĄăŁăŚăăžăăăžăăć ĄĺşăŤ <var>N</var> äşşăŽĺ
¨ć Ąçĺžăĺ形ăŤä¸ŚăłăžăăĺłăŽăăăŤăĺçĺžăŻ 0 ăă <var>N</var>-1 ăžă§ăŽçŞĺˇăć¸ăăăăźăăąăłăäťăăŚăăžăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_button" width="280">
</center>
<br>
<p>
ă˛ăźă ă§ăŻăăăłăďźćŹä˝żăăćĺăŻăźăăąăł 0 çŞăŽçĺžăăăăłăćăŁăŚăăžăăăăăăă䝼ä¸ăŽćé ă <var>M</var> ĺçš°ăčżăăžăăăžăăçžćçšă§ăăăłăćăŁăŚăăçĺžăéŠĺ˝ăŞćŁăŽć´ć° <var>a</var> ă厣č¨ăăžăă<var>a</var> ăĺść°ăŽă¨ăăŻćč¨ĺăăĺĽć°ăŽă¨ăăŻĺćč¨ĺăăŤéŁăŽçĺžăŤăăăłă渥ăăŚăăă<var>a</var> çŞçŽăŤăăăłăĺăĺăŁăçĺžăčąč˝ăăžăăčąč˝ăăçĺžăŻăćč¨ĺăă§éŁăŽçĺžăŤăăăłă渥ăăĺăăćăăžăă
</p>
<p>
ă˛ăźă ăçľăăŁăĺžăŤĺăŤćŽăŁăçĺžăŻăćžčŞ˛ĺžăŽćé¤ăďźĺš´éĺ
é¤ăăăžăăăăăăăăć°ĺš´ăŻçĺžć°ăĺ˘ăăăăăĺ
¨ć ĄçĺžăéăăăŽăéŁăăăŞăŁăŚăăŚăăžăăăăă§ă獜ćăăă°ăŠăăłă°é¨ăŽăăŞăăŻăăˇăăĽăŹăźăˇă§ăłă§ćé¤ăĺ
é¤ăăăçĺžăćąăăăăă°ăŠă ăä˝ćăăăăé źăžăăžăăă
</p>
<p>
ćĺŽăăçĺžăćé¤ăĺ
é¤ăăăŚăăăăŠăăă質ĺăăă¨ăăăăăŤçăăăăă°ăŠă ăä˝ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var> <var>M</var> <var>Q</var>
<var>a</var><sub>1</sub> <var>a</var><sub>2</sub> ... <var>a<sub>M</sub></var>
<var>q</var><sub>1</sub> <var>q</var><sub>2</sub> ... <var>q<sub>Q </sub></var>
</pre>
<p>
ĺ
ĽĺăŻďźčĄă§ăăăďźčĄçŽăŤçĺžăŽäşşć° <var>N</var> (10 ≤ <var>N</var> ≤ 200000)ăçš°ăčżăĺć° <var>M</var> (5 ≤ <var>M</var> < <var>N</var>)ăçĺžăćé¤ăĺ
é¤ăăăăăŠăăăĺăĺăăă質ĺăŽĺć° <var>Q</var> (1 ≤ <var>Q</var> ≤ 1000) ăä¸ăăăăăçśăďźčĄăŤă<var>i</var> ĺçŽăŽçš°ăčżăă§ćĺăŤăăăłăćăŁăŚăăçĺžă厣č¨ăăć´ć°<var>a<sub>i</sub></var> (1 ≤ <var>a<sub>i</sub></var> ≤ 100) ăä¸ăăăăăçśăďźčĄăŤă質ĺă¨ăăŚăźăăąăłçŞĺˇ <var>q<sub>i</sub></var> (0 ≤ <var>q</var> < <var>N</var>) ăä¸ăăăăă
</p>
<h2>ĺşĺ</h2>
<p>
質ĺăă¨ăŤăăźăăąăłçŞĺˇ <var>q<sub>i</sub></var> ăŽçĺžăćé¤ăĺ
é¤ăăăăăŠăăă <var>i</var> čĄçŽăŤĺşĺăăăćé¤ăĺ
é¤ăăăăŞă 1 ăăăăăŞăăŞă 0 ăĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž </h2>
<pre>
10 5 3
2 6 5 18 3
3 0 5
</pre>
<h2>ĺşĺäž</h2>
<pre>
1
0
1
</pre> | [
[
"10 5 3\n2 6 5 18 3\n3 0 5\n",
"10 5 3\n2 6 5 18 3\n3 0 5\n"
]
] |
p00297 | Star Watching |
<h1>夊ä˝čŚłć¸Ź</h1>
<p>
ăăć´ăăĺ¤ăŽĺ¸°ăéă犺ăčŚä¸ăăă¨ăăăŤăŻçĄć°ăŽćă埡ăčźăćă
ăăăăăŤčŚăăćă
ăăă
ăăăŞćăăăŽćă
ăĺ¤çŠşă彊ăŁăŚăăžăă
</p>
<p>
ăăŞăăŻăľă¨ćăăžăăăăăŽć犺ăŤčŞĺăŽć座ăăăŁăăăŠăăŞăŤç´ ćľă ăăă¨ăăăă§ăăŞăăŻă˛ă¨ă¤ăŽĺşćşăćąşăăé¨ĺąăŽçŞăăčŚăăćă
ăéŠĺ˝ăŤă¤ăŞăăŚčŞĺăŽć座ăä˝ăăă¨ăŤăăžăăăăăŽĺşćşă¨ăŻăăăŠăŽďźă¤ăŽćăé¸ăă§ăăăăăăŽćăăăŽĺˇŽăăăĺŽć° <var>d</var> 䝼ä¸ăŤăŞăăăăŞćăŽă°ăŤăźăăä˝ăăăăŽä¸ă§ä¸çŞĺ¤§ăăăăŽăčŞĺăŽć座ăŤăăăďźăă¨ăăăăŽă§ăăäžăă°ăĺłăŽăăăŞçŞăăčŚăăĺ¤çŠşăčăăŚăżăžăăăďźĺ¤ĺ´ăŽéˇćšĺ˝˘ăŻçŞć ă§ăďźă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_starWatching1" width="340">
</center>
<br>
<p>
ăăŽĺ¤çŠşăŤăŻăćăăăăăăă 1ďź12, 2ďź4ďź1ďź8, 3ďź5ďź4 ăŽďźă¤ăŽćăăăăžăăă<var>d</var> = 2 ă¨ăăă¨äžăă°äťĽä¸ăŽăăăŞďźă¤ăŽć座 A, B, C ăă§ăăžăă
</p>
<center>
<table>
<tr>
<td style="text-align:center"><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_starWatching2" width="160"></td>
<td style="text-align:center"><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_starWatching3" width="160"></td>
<td style="text-align:center"><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_starWatching4" width="160"></td>
</tr>
<tr>
<td style="text-align:center" width="180">大ăăă 12 ăŽć座 A</td>
<td style="text-align:center" width="180">大ăăă 10 ăŽć座 B</td>
<td style="text-align:center" width="180">大ăăă 16 ăŽć座 C</td>
</tr>
</table>
</center>
<br>
<p>
ć座ăŽĺ¤§ăăă揥ăŽăăăŤćąşăăăă¨ăŤăăžăăăăăć座ăŽćăăăšăŚĺŤăăăăŞăçŞć ăŤĺšłčĄăŞčžşăăăŞăéˇćšĺ˝˘ăŽăăĄăé˘çŠăćăĺ°ăăăăŽăé¸ăłăžăăăăŽéˇćšĺ˝˘ăŽé˘çŠăăăŽć座ăŽĺ¤§ăăă¨ăăžăăäžăă°ăä¸ăŽĺ¤çŠşă§ăŻć座 A, B, CăŽĺ¤§ăăăŻăăăă12, 10, 16ăŤăŞăăŽă§ăć座Căćă大ăăć座ă¨ăŞăăžăă
</p>
<p>
<var>N</var> ĺăŽćăŽä˝ç˝Žă¨ćăăăăăăłć´ć° <var>d</var> ăä¸ăăăăă¨ăăä¸çŞĺ¤§ăăć座ăŽé˘çŠăćąăăăăă°ăŠă ăä˝ćăăŚăă ăăăćăŽä˝ç˝ŽăŻçŞć ăŽĺˇŚä¸é
ăĺçšă¨ăă座ć¨ă§ä¸ăăăă蝸ăŻĺłăŽăăăŞĺăă¨ăăžăăć座ăć§ćăăćăďźă¤ăŽĺ ´ĺăăćă
ă蝸ăŤĺšłčĄăŞç´çˇä¸ăŤăăĺ ´ĺăŻăăăŽć座ăŽé˘çŠăŻ 0 ă¨ăŞăăă¨ăŤćł¨ćăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var> <var>d</var>
<var>x</var><sub>1</sub> <var>y</var><sub>1</sub> <var>b</var><sub>1</sub>
<var>x</var><sub>2</sub> <var>y</var><sub>2</sub> <var>b</var><sub>2</sub>
:
<var>x<sub>N</sub></var> <var>y<sub>N</sub></var> <var>b<sub>N</sub></var>
</pre>
<p>
1 čĄçŽăŤćăŽć° <var>N</var> (1 ≤ <var>N</var> ≤ 200000) ă¨ć´ć° <var>d</var> (0 ≤ <var>d</var> ≤ 10<sup>9</sup>) ăä¸ăăăăăçśă <var>N</var> čĄăŤă<var>i</var> çŞçŽăŽćăŽĺş§ć¨ă襨ăć´ć° <var>x<sub>i</sub></var> (0 ≤ <var>x<sub>i</sub></var> ≤ 2000000) 㨠<var>y<sub>i</sub></var> (0 ≤ <var>y<sub>i</sub></var> ≤ 2000000)ăćăăă襨ăć´ć° <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 10<sup>9</sup>) ăä¸ăăăăăĺ
ĽĺăăăćăŽĺş§ć¨ăŻăăšăŚç°ăŞăă
</p>
<h2>ĺşĺ</h2>
<p>
ä¸çŞĺ¤§ăăć座ăŽé˘çŠăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž</h2>
<br>
<h2>ĺ
Ľĺäž</h2>
<pre>
9 2
1 1 1
1 5 12
2 3 2
3 2 4
4 4 1
5 1 3
5 3 8
6 5 5
7 2 4
</pre>
<h2> ĺşĺäž</h2>
<pre>
16
</pre> | [
[
"9 2\n1 1 1\n1 5 12\n2 3 2\n3 2 4\n4 4 1\n5 1 3\n5 3 8\n6 5 5\n7 2 4\n",
"9 2\n1 1 1\n1 5 12\n2 3 2\n3 2 4\n4 4 1\n5 1 3\n5 3 8\n6 5 5\n7 2 4\n"
]
] |
p00298 | Mighty Man |
<h1>ĺćăĄ</h1>
<p>
ĺćăĄăăĄăéăĺćăĄĺŚĺăăăăžăăăĺćăĄĺŚĺăŽéĺäźă§ăŻăĺćăĄăăĄăéĺăçľăă§čĄé˛ăăžăă
</p>
<p>
ĺćăĄăăĄăŻĺ¸¸ăŤčŞĺăăĄăŽĺăčŞç¤şăăăä¸ćšă§ă彟ăăŽĺ¤§ĺăŻčŞĺă§ćŠăăăăăăžăăăăăă§ĺ˝źăăŽä¸é¨ăä¸çŞä¸ăŤăŞăăăăŽä¸ăŤĺ¤§ĺ˘ăŽäşşă縌ä¸ĺăŤćăĄăăăŚćŠăăă¨ă§ăĺŽéăŤćŠăäşşć°ăć¸ăăăă¨čăăžăăă
</p>
<p>
ăŻăăăŤă<var>N</var> äşşăŽĺćăĄăŻĺ°é˘ăŽä¸ăŤć¨Şä¸ĺăŤä¸Śăă§ăăŚăăăăă塌ĺ´ăă ďź,ďź,ďź,..., <var>N</var> ă¨éăçŞĺˇă§ĺźă°ăăŚăăžăăéăçŞĺˇ <var>i</var> ăŽĺćăĄăŽä˝é㯠<var>w<sub>i</sub></var> ă§ć大 <var>c<sub>i</sub></var> ăŽééăžă§ćă¤ăă¨ăă§ăăžăă
</p>
<p>
ĺćăĄăŻă䝼ä¸ăŽćĄäťśăăăšăŚćşăăă¨ăă ăăéŁăŤçŤăŁăŚăă塌ĺłăŠăĄăăăŽĺćăĄăćăĄăăăăă¨ăă§ăăžăă
</p>
<ul>
<li> čŞĺăŽä¸ä¸ăŤăŻĺćăĄăŻăăŞăăă¤ăžăă誰ăăŤćăĄä¸ăăăăŚăăăŞăăă誰ăăćăĄăăăŚăăăŞăă</li>
<li> éŁăŽĺćăĄăŽä˝éăăčŞĺăćă¤ăă¨ăŽă§ăăć大ăŽéé䝼ä¸ă§ăăăăă ăăéŁăŽĺćăĄăć˘ăŤčŞ°ăăćăĄä¸ăăŚăăăŞăă縌ăŤçŠăżä¸ăăŁăĺćăĄăăĄăŽä˝éăŽĺč¨ăăčŞĺăćă¤ăă¨ăŽă§ăăć大ăŽéé䝼ä¸ă§ăŞăăă°ăŞăăŞăă</li>
</ul>
<p>
äžăă°ă揥ăŽăăăŞďźäşşăŽĺćăĄăŽéĺăčăăŚăżăžăăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_mightyMan1" width="240">
</center>
<br>
<p>
ä¸ĺłăŽăăăŤăďźăŽĺćăĄăćă¤ăă¨ăŽă§ăăéăă <var>w<sub>3</sub></var> 䝼ä¸ăŽă¨ăăďźăŽĺćăĄăŻďźăŽĺćăĄăćăĄăăăăă¨ăă§ăăžăăçśăăŚăďźăŽĺćăĄăćă¤ăă¨ăŽă§ăăéăă <var>w<sub>2</sub></var> + <var>w<sub>3</sub></var> 䝼ä¸ăŽă¨ăăďźăŽĺćăĄăŻďźăŽĺćăĄăćăĄăăăăă¨ăă§ăăžăă
</p>
<center>
<table>
<tr>
<td><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_mightyMan2" width="240"></td>
<td>
→
</td>
<td><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_mightyMan3" width="240"></td>
</tr>
</table>
</center>
<br>
<p>
ăžăăä¸ĺłăŽăăăŤďźăŽĺćăĄăďźăŽĺćăĄăćăĄăăăĺ ´ĺăŻăďźăŽĺćăĄăŽéŁăăďźăŽĺćăĄăćăŁăďźăŽĺćăĄăŤăŞăăŽă§ăďźăŽĺćăĄăŻďźăŽĺćăĄăćăĄăăăăă¨ăă§ăăžăă
</p>
<center>
<table>
<tr>
<td><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_mightyMan4" width="240"></td>
<td>
→
</td>
<td><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_mightyMan5" width="240"></td>
</tr>
</table>
</center>
<br>
<p>
ďźăŽĺćăĄăăä¸ăŽĺłăŽăăăŤďźă¨ďźăŽĺćăĄă严ćšćă¤ăă¨ăŻă§ăăžăăă
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_PCK2014_mightyMan6" width="240">
</center>
<br>
<p>
ĺćăĄĺŚĺăŽĺ°ĺąăăă°ăŠăăźă¨ăăŚăä¸çŞä¸ă§ćŠăăă¨ăŤăŞăćĺ°ăŽäşşć°ăćąăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var>
<var>c<sub>1</sub></var> <var>w<sub>1</sub></var>
<var>c<sub>2</sub></var> <var>w<sub>2</sub></var>
:
<var>c<sub>N</sub></var> <var>w<sub>N</sub></var>
</pre>
<p>
1 čĄçŽăŤĺćăĄăŽäşşć° <var>N</var> (1 ≤ <var>N</var> ≤ 1000) ăä¸ăăăăăçśă <var>N</var> čĄăŤ <var>i</var> çŞçŽăŽĺćăĄăćăŚăééăŽćĺ¤§ĺ¤ <var>c<sub>i</sub></var> (1 ≤ <var>c<sub>i</sub></var> ≤ 100000) ă¨ä˝é <var>w<sub>i</sub></var> (1 ≤ <var>w<sub>i</sub></var> ≤ 100000) ăä¸ăăăăă
</p>
<h2>ĺşĺ</h2>
<p>
ćĺ°ăŽäşşć°ăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž </h2>
<br>
<h2>ĺ
Ľĺäžďź </h2>
<pre>
3
150 120
100 50
80 100
</pre>
<h2>ĺşĺäžďź</h2>
<pre>
1
</pre>
<br>
<h2>ĺ
Ľĺäžďź</h2>
<pre>
8
50 100
20 20
30 20
90 50
140 30
30 60
59 120
10 10
</pre>
<h2>ĺşĺäžďź</h2>
<pre>
3
</pre>
| [
[
"3\n150 120\n100 50\n80 100\n",
"3\n150 120\n100 50\n80 100\n"
]
] |
p00299 | School Cafeteria |
<h1>ĺŚéŁ</h1>
<p>
äťćĽăŻďźşĺ¤§ĺŚăŽăŞăźăăłăăŁăłăăšă§ăăćŻĺš´ăăŽćĽăŽćźäźăżăŤăŻă大ĺ˘ăŽéŤć ĄçăăĄăĺŚéŁăŤĺăă¤ăăăžăăăăă§ďźşĺ¤§ĺŚăŽäşĺĺąăŻăčĄĺăŽéˇăăć大ă§ăŠăŽăăăăŽčˇé˘ăŤăŞăăăäşć¸Źăăăă¨ăŤăăžăăăäşĺ調ćťăŽçľćă§ă䝼ä¸ăŽăă¨ăĺăăŁăŚăăžăă
</p>
<ul>
<li> čĄĺăŤăŻăăăă 1 ăă <var>N</var> ăžă§ăŽçŞĺˇăćŻăăă <var>N</var> äşşă丌ăłăžăă</li>
<li> <var>C</var> ĺăŽéŤć ĄçăŽă㢠(<var>a<sub>i</sub></var>, <var>b<sub>i</sub></var>) ăăăăăŤă¤ăăŚă䝼ä¸ăŽďźç¨ŽéĄăŽĺśç´ăăăăžăďź
<ul>
<li>ďźă¤çŽăŽĺśç´ăŻé ĺşăŤé˘ăăăăŽă§äťĽä¸ăŽăăăăă§ăďź<br>
<var>a<sub>i</sub></var> 㯠<var>b<sub>i</sub></var> ăăăĺ
ăăžăăŻĺăä˝ç˝ŽăŤä¸Śă°ăŞăăŚăŻăŞăăŞă<br>
<var>a<sub>i</sub></var> 㯠<var>b<sub>i</sub></var> ăăăĺžăăžăăŻĺăä˝ç˝ŽăŤä¸Śă°ăŞăăŚăŻăŞăăŞă<br>
<var>a<sub>i</sub></var> 㯠<var>b<sub>i</sub></var> ăăĺ
ă§ăăĺăä˝ç˝Žă§ăăĺžă§ăăă<br>
</li>
<li>ďźă¤çŽăŽĺśç´ăŻčˇé˘ăŤé˘ăăăăŽă§äťĽä¸ăŽăăăăă§ăďź<br>
<var>a<sub>i</sub></var> 㨠<var>b<sub>i</sub></var> 㯠<var>d<sub>i</sub></var> ăĄăźăăŤäťĽä¸é˘ăăŞăăă°ăŞăăŞă<br>
<var>a<sub>i</sub></var> 㨠<var>b<sub>i</sub></var> 㯠<var>d<sub>i</sub></var> ăĄăźăăŤäťĽĺ
ăŤä¸Śă°ăŞăăă°ăŞăăŞă<br>
</li>
</li>
</ul>
</ul>
<p>
ăžăăĺ
é ăăĺăčˇé˘ăŽĺ ´ćăŤč¤ć°ăŽäşşă丌ăśăă¨ăă§ăăčĄĺăŽĺ
é ăŤăŻĺ¸¸ăŤçŞĺˇ 1 ăŽäşşă丌ăśăă¨ăĺăăŁăŚăăžăă
</p>
<p>
ä¸ăăăă <var>C</var> ĺăŽĺśç´ăăăšăŚćşăăčĄĺăŤă¤ăăŚăĺ
é ăăćĺžĺ°žăžă§ăŽčˇé˘ăć大ă¨ăŞăăăăŞä¸Śăłćšăăăĺ ´ĺăŽčˇé˘ăćąăăăăă°ăŠă ăä˝ćăăŚăă ăăăăă ăăăŠăăžă§ăé˘ăăăă¨ăă§ăăĺ ´ĺ㯠<span>inf</span> ă¨ăĺśç´ăćşăă丌ăłćšăä¸ĺŻč˝ăŞĺ ´ĺ㯠<span>-1</span> ă¨ĺşĺăăŚăă ăăă
</p>
<h2>ĺ
Ľĺ</h2>
<p>
ĺ
ĽĺăŻäťĽä¸ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>N</var> <var>C</var>
<var>constraint<sub>1</sub></var>
<var>constraint<sub>2</sub></var>
:
<var>constraint<sub>C</sub></var>
</pre>
<p>
1 čĄçŽăŤčĄĺăŤä¸ŚăśéŤć ĄçăŽäşşć° <var>N</var> (2 ≤ <var>N</var> ≤ 100) ă¨ĺśç´ăŽć° <var>C</var> (0 ≤ <var>C</var> ≤ 200) ăä¸ăăăăăçśă <var>C</var> čĄăŤĺĺśç´ <var>constraint<sub>i</sub></var> ă揥ăŽĺ˝˘ĺźă§ä¸ăăăăă
</p>
<pre>
<var>a<sub>i</sub>o<sub>i</sub>b<sub>i</sub>s<sub>i</sub>d<sub>i</sub></var>
</pre>
<p>
ĺśç´ăŤăŻçŠşç˝ăŻĺŤăžăăŞăă<var>a<sub>i</sub></var>, <var>o<sub>i</sub></var>, <var>b<sub>i</sub></var>, <var>s<sub>i</sub></var>, <var>d<sub>i</sub></var> ăŽćĺłă䝼ä¸ăŤç¤şăă
</p>
<ul>
<li> <var>a<sub>i</sub></var> 㨠<var>b<sub>i</sub></var> (1 ≤ <var>a<sub>i</sub></var>, <var>b<sub>i</sub></var> ≤ <var>N</var> ă㤠<var>a<sub>i</sub></var> ≠ <var>b<sub>i</sub></var> ) ăŻéŤć ĄçăŽçŞĺˇă<var>d<sub>i</sub></var> ăŻčˇé˘ (0 ≤ <var>d</var> ≤ 10000) ă襨ăć´ć°ă§ăăă</li>
<li> <var>o<sub>i</sub></var> ăŻé ĺşăŽĺśç´ăćĺŽăă <span><=</span>ă<span>>=</span>ă<span>*</span> ăŽăăăăăŽćĺĺă§ăăă<span><=</span> ăŽĺ ´ĺă<var>a<sub>i</sub></var> 㯠<var>b<sub>i</sub></var> ăăăĺ
ăăžăăŻĺăä˝ç˝ŽăŤä¸Śă°ăŞăăŚăŻăŞăăŞăăă<span>>=</span> ăŽĺ ´ĺă<var>a<sub>i</sub></var> 㯠<var>b<sub>i</sub></var> ăăăĺžăăžăăŻĺăä˝ç˝ŽăŤä¸Śă°ăŞăăŚăŻăŞăăŞăăă<span>*</span> ăŽĺ ´ĺă<var>a<sub>i</sub></var> 㯠<var>b<sub>i</sub></var> ăăĺ
ă§ăăĺăä˝ç˝Žă§ăăĺžă§ăăăăăă¨ăćĺłăăăăă ă <var>o<sub>i</sub></var> ă <span>*</span> ă¨ăŞăĺśç´ăŻďźĺ䝼ä¸ä¸ăăăăăă¨ăŻăŞăă</li>
<li> <var>s<sub>i</sub></var> ăŻčˇé˘ăŽĺśç´ăćĺŽăă <span>+</span> ăžă㯠<span>-</span> ăŽćĺă§ăăă<span>+</span> ăŽĺ ´ĺă<var>a<sub>i</sub></var> 㨠<var>b<sub>i</sub></var> 㯠<var>d<sub>i</sub></var> ăĄăźăăŤäťĽä¸é˘ăăŞăăă°ăŞăăŞăăă<span>-</span> ăŽĺ ´ĺă<var>a<sub>i</sub></var> 㨠<var>b<sub>i</sub></var> 㯠<var>d<sub>i</sub></var> ăĄăźăăŤäťĽĺ
ăŤä¸Śă°ăŞăăă°ăŞăăŞăăăă¨ăćĺłăăă
</li>
</ul>
<p>
ăă ăăăăăă˘ăŤĺŻžăăŚč¤ć°ăŽĺśç´ăä¸ăăăăăă¨ăŻăŞăăăŽă¨ăăă
</p>
<h2>ĺşĺ</h2>
<p>
ĺ
é ăăćĺžĺ°žăžă§ăŽčˇé˘ăďźčĄăŤĺşĺăăă
</p>
<h2>ĺ
Ľĺşĺäž </h2>
<br>
<h2>ĺ
Ľĺäžďź</h2>
<pre>
3 2
1<=2-1
2<=3-2
</pre>
<h2> ĺşĺäžďź</h2>
<pre>
3
</pre>
<br>
<h2>ĺ
Ľĺäžďź </h2>
<pre>
3 3
1<=2-1
2<=3-2
1<=3+4
</pre>
<h2>ĺşĺäžďź</h2>
<pre>
-1
</pre>
<br>
<h2>ĺ
Ľĺäžďź </h2>
<pre>
3 2
1<=2-2
2*3+1
</pre>
<h2>ĺşĺäžďź</h2>
<pre>
inf
</pre>
| [
[
"3 2\n1\n",
"3 2\n1\n"
]
] |