<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<!-- DOMjudge version 3.3.2 -->
<title>Source: s1327</title>
<link rel="shortcut icon" href="../images/favicon.png" type="image/png" />
<link rel="stylesheet" href="../style.css" type="text/css" />
<link rel="stylesheet" href="style_jury.css" type="text/css" />
<script type="text/javascript" src="../js/sorttable.js"></script>
<script type="text/javascript" src="../js/domjudge.js"></script>
</head>
<body>

<h2>Source code for submission s1327</h2>

<p><a href="#diff">Go to diff to previous submission</a></p>

<div class="tabber"><div class="tabbertab"><h2 class="filename"><a name="source0"></a>ant.c</h2> 

<pre class="c" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808080; font-style: italic;">/*#include &lt;math.h&gt;*/</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #993333;">double</span> ah<span style="color: #009900;">&#40;</span><span style="color: #993333;">double</span> n<span style="color: #009900;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span>n<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?-</span>n<span style="color: #339933;">:</span>n<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #993333;">int</span> L<span style="color: #339933;">,</span>A<span style="color: #339933;">,</span>maxL<span style="color: #339933;">,</span>maxR<span style="color: #339933;">,</span>mid<span style="color: #339933;">,</span>mid2<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #993333;">double</span> L2<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #993333;">int</span> p<span style="color: #339933;">,</span>i<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #993333;">char</span> c<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #808080; font-style: italic;">/*struct {</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808080; font-style: italic;">&nbsp; </span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808080; font-style: italic;">&nbsp; }Pole[100000];*/</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/scanf.html"><span style="color: #000066;">scanf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d%d&quot;</span><span style="color: #339933;">,&amp;</span>L<span style="color: #339933;">,&amp;</span>A<span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span>EOF<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    L2<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>L<span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color:#800080;">2.0</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.opengroup.org/onlinepubs/009695399/functions/scanf.html"><span style="color: #000066;">scanf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d%1s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,&amp;</span>p<span style="color: #339933;">,&amp;</span>c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    maxL<span style="color: #339933;">=</span>maxR<span style="color: #339933;">=</span>mid2<span style="color: #339933;">=-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>c<span style="color: #339933;">==</span><span style="color: #ff0000;">'R'</span><span style="color: #009900;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      maxR<span style="color: #339933;">=</span>p<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">else</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      maxL<span style="color: #339933;">=</span>p<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    mid<span style="color: #339933;">=</span>p<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">2</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;=</span>A<span style="color: #339933;">;++</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <a href="http://www.opengroup.org/onlinepubs/009695399/functions/scanf.html"><span style="color: #000066;">scanf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d%1s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,&amp;</span>p<span style="color: #339933;">,&amp;</span>c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>c<span style="color: #339933;">==</span><span style="color: #ff0000;">'R'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>p<span style="color: #339933;">&lt;</span>maxR<span style="color: #009900;">&#41;</span> maxR<span style="color: #339933;">=</span>p<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>p<span style="color: #339933;">&gt;</span>maxL<span style="color: #009900;">&#41;</span> maxL<span style="color: #339933;">=</span>p<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ah<span style="color: #009900;">&#40;</span>p<span style="color: #339933;">-</span>L2<span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span>ah<span style="color: #009900;">&#40;</span>mid<span style="color: #339933;">-</span>L2<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> mid<span style="color: #339933;">=</span>p<span style="color: #339933;">;</span> mid2<span style="color: #339933;">=-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ah<span style="color: #009900;">&#40;</span>p<span style="color: #339933;">-</span>L2<span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span>ah<span style="color: #009900;">&#40;</span>mid<span style="color: #339933;">-</span>L2<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> mid2<span style="color: #339933;">=</span>p<span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #666666; font-style: italic;">//printf(&quot;%d%d%d\n&quot;,maxL,maxR,L);</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>maxL<span style="color: #339933;">==-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      mid<span style="color: #339933;">=</span>maxR<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>maxR<span style="color: #339933;">==-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      mid<span style="color: #339933;">=</span>maxL<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">     maxL<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>maxL<span style="color: #339933;">&gt;</span>maxR<span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>maxL<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>L<span style="color: #339933;">-</span>maxR<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;The last ant will fall down in %d seconds - started at %d&quot;</span><span style="color: #339933;">,</span>maxL<span style="color: #339933;">,</span>mid<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>mid2<span style="color: #339933;">!=-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot; and %d.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>mid2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">else</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div><h2><a name="diff"></a>Diff to submission <a href="1259">s1259</a></h2>
<div class="tabber"><div class="tabbertab"><h2 class="filename"><a name="diff"></a>ant.c</h2>

<pre class="output_text"><span class='diff-del'>--- c4.s1259.cteam125.ants.c.0.ant.c</span>
<span class='diff-add'>+++ c4.s1327.cteam125.ants.c.0.ant.c</span>
@@ -16,5 +16,5 @@
   }Pole[100000];*/
   while(scanf(&quot;%d%d&quot;,&amp;L,&amp;A)!=EOF){
<span class='diff-del'>-    L2=L/2.0;</span>
<span class='diff-add'>+    L2=(L-1)/2.0;</span>
     scanf(&quot;%d%1s\n&quot;,&amp;p,&amp;c);
     maxL=maxR=mid2=-1;
@@ -40,5 +40,5 @@
       mid=maxL;
     }
<span class='diff-del'>-    maxL=(maxL&gt;maxR)?maxL:(L-maxR);</span>
<span class='diff-add'>+     maxL=(maxL&gt;maxR)?maxL:(L-maxR);</span>
     printf(&quot;The last ant will fall down in %d seconds - started at %d&quot;,maxL,mid);
     if(mid2!=-1) printf(&quot; and %d.\n&quot;,mid2);
</pre>

</div></div>
</body>
</html>
