submission_id string | problem_id string | status string | code string | input string | output string | problem_description string |
|---|---|---|---|---|---|---|
s742049259 | p04047 | Runtime Error | n=int(input())
l=list(map(int,input().split()))
l.sort()
sum=0
for x in range(0,n*2+1,2):
sum+=min(l[x:x+2])
print(sum)
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s853478988 | p04047 | Runtime Error | def gcd(a,b):
if b == 0:
return a
return gcd(b,a%b)
N,k = map(int,raw_input().split())
#k = int(raw_input())
#A = map(int, raw_input().split())
ans = gcd(N,k)
print 3*(N - ans) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s866647203 | p04047 | Runtime Error | N = int(raw_input())
A = map(int, raw_input().split())
sum = 0
A.sort()
A = A[::2]
print sum(A)
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s786927693 | p04047 | Runtime Error | N = input()
kushi = sorted(list(map(int, input().split())))
even = kushi[0::2]
print(sum(even) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s862646417 | p04047 | Runtime Error | n = int(input())
L = map(int, input().split(" "))
L_sorted = sorted(L)
pairs = []
for index in range(0, len(L_sorted)/2, 2):
pairs.append(L_sorted[index : index +2])
answer = sum( min(x) for x in pairs)
print(answer) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s233463928 | p04047 | Runtime Error | ii=lambda:map(int,raw_input().split())
n,k=ii()
T,F=True,False
e=[[] for _ in range(n)]
for _ in range(n-1):
a,b=ii()
e[a-1]+=[b-1];e[b-1]+=[a-1]
cost=[0]*n
ans=10**5
def dfs(x,f):
if f>=0:vis[f]=T
q=[(x,0)]
while len(q):
v,c=q.pop(0)
if c>k/2:break
cost[v]=c;vis[v]=T
for w in e[v]:
if not vis[w]:q+=[(w,c+1)]
return n-vis.count(T)
if k%2:
for i in range(n):
for j in e[i]:
if i<j:vis=[F]*n;dfs(i,j);ans=min(ans,dfs(j,i))
else:
for i in range(n):vis=[F]*n;ans=min(ans,dfs(i,-1))
print ans
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s524941267 | p04047 | Runtime Error | N = int(input())
L = map(int, input().split())
sort(L)
sum = 0
for i in range(0,len(L),2):
sum += L[i]
print(sum) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s046243738 | p04047 | Runtime Error | N = int(input())
L = map(int, input().split())
sort(L)
sum = 0
for i in range(0,N):
sum += L[i*2]
print(sum) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s203588797 | p04047 | Runtime Error | N = int(input())
L = map(int, input().split())
sort(L)
sum = 0
for i in range(0,len(L),2):
sum += L[i]
print(sum) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s546655394 | p04047 | Runtime Error | n, x = map(int, raw_input().split())
def cal(n):
return n + 1 + (n - 2)*2
if n % x == 0:
l = cal(n) - cal(x)
else:
l = cal(n)
print l
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s421375316 | p04047 | Runtime Error | n = raw_input()
l = raw_input().split()
print(sum(sorted(l, reverse=True)[1::2])) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s457272852 | p04047 | Runtime Error | NX = input()
NX = "".join(NX).split(" ")
NX = [int(s) for s in NX]
D = NX[0]-NX[1]
if NX[0] ==0 or NX[1]==0:
print(str(0))
if NX[1]<D:
Mod = D%NX[1]
if Mod!=0:
print(int(2*NX[1]+NX[1]+(D-NX[1]/2)*3))
else:
print(int(NX[1]*4+D))
elif NX[1]==D:
print(int(3*NX[1]))
elif NX[1]>D:
Mod = NX[1]%D
if Mod!=0:
print(int(NX[1]+(Mod*3)+D+(D*2*int(NX[1]/D))))
else:
print(int(NX[1]+int((NX[1]/D))*2*D)) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s078375409 | p04047 | Runtime Error | #!/usr/bin/python3
import sys
sys.setrecursionlimit(100000)
N, X = list(map(int, input().split()))
def f(a,b):
if a > b:
a,b = b,a
if a==0 or b==0:
return 0
if b%a is 0:
return int(a*(2*(b/a)-1))
return int(2*a*int(b/a) + f(a,b%a))
print(N+f(N-X, X))
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s170659470 | p04047 | Runtime Error | n, x = map(int,input().split())
if x > n // 2:
x = n - x
xx = x
yy = n - x
ans = n
i = 0
while True:
ans += 2 * (yy // xx) * xx
yy %= xx
if yy == 0:
ans -= xx
break
if yy < xx:
tmp = xx
xx = yy
yy = tmp
print(ans)
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s849507092 | p04047 | Runtime Error | import sys
sys.setrecursionlimit(10**6)
def dfs1(s,c):
visited[s]=1
for i in v[s]:
if visited[i]==0:
d[c][i]=d[c][s]+1
dfs1(i,c)
return
def dfs2(c1,c2):
visited[c2]=1
dfs1(c1,c1)
dfs1(c2,c2)
return
n,k=map(int,raw_input().split())
d=[[0]*n for _ in xrange(n)]
v=[[] for _ in xrange(n)]
e=[]
for i in xrange(n-1):
a,b=map(int,raw_input().split())
a-=1
b-=1
v[a].append(b)
v[b].append(a)
e.append([a,b])
if k%2==0:
min_del=1000000
for i in xrange(n):
cnt=0
visited=[0]*n
dfs1(i,i)
for j in xrange(n):
if d[i][j]>k/2:
cnt+=1
min_del=min(min_del,cnt)
print(min_del)
else:
min_del=1000000
for i,j in e:
cnt=0
visited=[0]*n
d=[[0]*n for _ in xrange(n)]
dfs2(i,j)
for l in xrange(n):
if d[i][l]>(k-1)/2 or d[j][l]>(k-1)/2:
cnt+=1
min_del=min(min_del,cnt)
print(min_del) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s226244380 | p04047 | Runtime Error | def gcd(a,b):
if b==0:
return a
else:
return gcd(b,a%b)
n,x=map(int,raw_input().split())
print 3*(n-gcd(n,x)) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s704341736 | p04047 | Runtime Error | def gcd(a,b):
if b==0:
return a
else:
return gcd(b,a%b)
n,x=map(int,raw_input().split())
print 3*(n-gcd(n,x))
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s006997741 | p04047 | Runtime Error | n,x = map(int,raw_input().split())
print '%d' %(n + ((n/x) - 1)*2*x + 3*(n%x))
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s512345524 | p04047 | Runtime Error | n,x = map(int,raw_input().split())
if n > 2*x :
print '%d' %(n + (n/x - 1)*2*x + 3*(n-(n/x)*x))
else :
print '%d' %(n + x)
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s502251886 | p04047 | Runtime Error | import scipy.misc as scm
def combi(p,q):
return scm.comb(p,q,1)
ans=0
n=int(input())
k=[]
for i in range(n):
a,b=map(int,input().split())
k.append([a,b])
for i in range(n-1):
for j in range(i+1,n):
p=k[i][0]+k[i][1]+k[j][0]+k[j][1]
q=k[i][0]+k[j][0]
ans += combi(p,q) % (10**9+7)
ans = ans % (10**9+7)
print(ans)
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s852666915 | p04047 | Runtime Error | def f(a, b):
if b%a==0:
return b//a*2-1
else:
return b//a*a*2+f(b%a,a)
N, X = map(int, input().split())
ans = N + f(min(N-X,X), max(N-X,X))
print(ans)
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s415818222 | p04047 | Runtime Error | N = input()
L = input()
i = 0
array = []
anser = 0
while i < len(L):
if L[i] != ' ':
array.append(int(L[i]))
i+=1
i = 1
array.sort(reverse=True)
for i in range(array):
if i // 2 == 0:
anser+=i
print(anser) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s282052365 | p04047 | Runtime Error | import sys;
n,x=map(int,raw_input().split());
if(2*x<n):
print x+(n-x)+x+x+(n-2*x)*(2*x-1);
elif(2*x==n):
print x+(n-x)+x;
else:
print x+(n-x)+x+(n-x)+x+(n-x);
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s680582353 | p04047 | Runtime Error | # encoding: utf-8
n, x = map(int, raw_input().split())
ac_bc = n - x
s = ac_bc / 3
l = ac_bc - s
print ac_bc + s * 3 + l * 3 | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s911514871 | p04047 | Runtime Error | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
N, X = list(map(int, input().split()))
sum_ = X
prev = X
next = N - X
i = 0
while True:
num = prev // next
if i == 0:
sum_ += 2 * num * next
elif i % 2 == 1:
sum_ += 2 * num * next - next
else:
sum_ += 2 * num * next - next
mod_ = prev % next
if mod_ == 0:
break
sum_ += next
prev = next
next = mod_
i += 1
print(sum_) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s280459736 | p04047 | Runtime Error | N, X = map(int, raw_input().split())
ans = 0
if N%2 ==0:
d = min(X, N-X)
ans = (N-d)*3
else:
ans = (N-1)*3
print(ans) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s646624473 | p04047 | Runtime Error | N, X = map(int, raw_input().strip().split())
print N + (N-X)*2 -1 | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s529211517 | p04047 | Runtime Error | N, x = map(long, raw_input().split())
print (N - x) + 3 * x + 3 * (N - x - x)
| 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s948258491 | p04047 | Runtime Error | #! /usr/bin/env python3
N, X = map(int, input().split())
if X*2 == N:
print(X*3)
else:
print(X*3*((N-X)//X + (1 if (N-X)%X>0 else 0))) | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s902533382 | p04047 | Runtime Error | def bbq():
n = int(input())
a = input()
tmp = a.split()
l = [int(x) for x in tmp]
l.sort()
n = 0
i = 0
while(i<n:
n += l[i]
i += 2
print (n)
if __name__ == "__main__":
bbq() | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s820627721 | p04047 | Runtime Error | N=raw_input()
up=raw_input()
up=up.split()
up=map(int,up)
up.sort()
count=0
for i in range(N):
count+=up[i*2]
print count | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s777010165 | p04047 | Runtime Error | N=raw_input()
up=raw_input().split()
up=map(int,up)
up.sort()
count=0
for i in range(N):
count+=up[i*2]
print count | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s090382957 | p04047 | Runtime Error | N=raw_input()
up=raw_input().split()
up=up.sort()
count=0
for i in range(N):
count+=int(up[i*2])
print count | 2
1 3 1 2
| 3
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p>
<p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p>
<div style="text-align: center;">
<img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png">
<p>Example of a serving of Skewer Meal</p>
</img></div>
<p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>.
Also, he has an infinite supply of ingredients.</p>
<p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p>
<p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1≦N≦100</var></li>
<li><var>1≦L_i≦100</var></li>
<li>For each <var>i</var>, <var>L_i</var> is an integer.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var>
<var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>2
1 3 1 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>3
</pre>
<p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>5
100 1 2 3 14 15 58 58 58 29
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>135
</pre></section>
</div>
</span> |
s568266599 | p04048 | Wrong Answer | n,x=map(int,input().split())
def f(a,b):
if a>b: b,a=a,b
if b%a==0: return 2*(b//a)-1
return 2*a*(b//a)+ f(b%a,a)
print(n+ f(x,n-x)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s403994981 | p04048 | Wrong Answer | N, X = list(map(int, input().split()))
ans = N
N, X = X, N - X
while N and X:
if X > N:
d, m = divmod(X, N)
if m == 0:
ans += (d * 2 - 1) * N
else:
ans += d * 2 * N
N, X = N, m
else:
d, m = divmod(N, X)
ans += (d * 2 - 1) * X + m * 2
N, X = m, X - m
print(ans) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s758022949 | p04048 | Wrong Answer | N, X = list(map(int, input().split()))
ans = N
N, X = X, N - X
while N and X:
if X > N:
d, m = divmod(X, N)
ans += d * 2 * N
N, X = N, m
else:
d, m = divmod(N, X)
ans += (d * 2 - 1) * X + m * 2
N, X = m, X - m
print(ans) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s743451192 | p04048 | Wrong Answer | N, X = list(map(int, input().split()))
ans = N
N, X = X, N - X
while N and X:
if X > N:
d, m = divmod(X, N)
ans += d * 2 * N
N, X = N + m, X - d * N
else:
d, m = divmod(N, X)
ans += d * X + m * 2
N, X = m, X - m
print(ans) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s558618129 | p04048 | Wrong Answer | n,x=map(int,input().split())
print(4*n-4*x) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s754397376 | p04048 | Wrong Answer | import math
n,x = map(int,input().split())
a = n+(n-x)//x*x*2
b = math.gcd(n-x,x)
if b == x:
print(a-x)
else:
print(int(a+(x/b*2-1)*b)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s943933326 | p04048 | Wrong Answer | import math
n,x = map(int,input().split())
a = n+(n-x)//x*x*2
b = math.gcd(n-x,x)
if b == x:
print(a-x)
else:
print(a+(x*2-1)*b) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s740839397 | p04048 | Wrong Answer | import math
n,x = map(int,input().split())
a = n+(n-x)//x*x*2
b = math.gcd(n-x,x)
if b == x:
print(a-x)
else:
print(a+b*3) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s325881403 | p04048 | Wrong Answer | import math
n,x = map(int,input().split())
print(n+(n-x)//x*x*2+math.gcd(n-x,x)*3) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s917545372 | p04048 | Wrong Answer | import math
n,x = map(int,input().split())
print(n+n//x*x+math.gcd(n-x,x)*3) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s089149886 | p04048 | Wrong Answer | def make_divisors(n):
lower_divisors , upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n//i)
i += 1
return lower_divisors + upper_divisors[::-1]
n,x = map(int,input().split())
print(n-x+sum(make_divisors(x))*3) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s812722017 | p04048 | Wrong Answer | n,x = map(int,input().split())
ans = x
e = n-x
count = 0
while True:
if x%e == 0:
if count == 0:
ans += x//e*(e*2)
else:
ans += x//e*(e*2)-e
break
else:
if count%2 == 0:
ans += e+(x//e)*e*2
else:
ans += (x//e)*e*2
x,e = e,x%e
count += 1
print(ans) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s498114164 | p04048 | Wrong Answer | n,x=map(int,input().split())
ans=0
t=n-x
tt=x//t
ans+=x
while True:
if x%t==0:
ans+=tt*t*2
print(ans)
exit()
else:
ans+=tt*t*2+t
x=t
t=n-t*tt
tt=x//t | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s871038270 | p04048 | Wrong Answer | n,x = map(int, input().split())
print(3*(n-1)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s103575194 | p04048 | Wrong Answer | n, x = map(int, input().split())
print(3 * x if n / x == 2 else 3 * (n - 1)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s299822992 | p04048 | Wrong Answer | a = list(map(int,input().split()))
print((a[0]*(a[1]*2)) - (a[1]*(a[1]*2))) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s264325437 | p04048 | Wrong Answer | a = list(map(int,input().split()))
print((a[0]*4) - (a[1]*4)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s269110796 | p04048 | Wrong Answer | a = list(map(int,input().split()))
print(a[0]*4 + a[1]*4) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s027361320 | p04048 | Wrong Answer | a = list(map(int,input().split()))
print(a[0] * 4, a[1] * 4) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s051870114 | p04048 | Wrong Answer | N, X = [int(x) for x in input().split()]
#answer =
if N//2 >= X:
print(X + N-X + X + X + 2*X-1)
else: #N//2 < X
print(0) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s945749631 | p04048 | Wrong Answer | N,X = input().split()
N,X = int(N), int(X)
answer = X+ (N-X)
def rhombus(N,X):
if X==1:
return N+1
if X==0:
return 0
if N%X == 0:
return X*(N//X)*2-X
else:
k = N//X
return k*2*X + rhombus(X,N-(k*X))
answer = answer + rhombus(N-X,X)
print(answer) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s569920223 | p04048 | Wrong Answer | N,X = input().split()
N,X = int(N), int(X)
answer = X+ (N-X)
def rhombus(N,X):
if X==1:
return N+1
if X==0:
return 0
if N%X == 0:
return X*(N//X)*2-1
else:
k = N//X
return k*2*X + rhombus(X,N-(k*X))
answer = answer + rhombus(N-X,X)
print(answer) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s621976865 | p04048 | Wrong Answer | N,X = input().split()
N,X = int(N), int(X)
answer = X+ (N-X)
def rhombus(N,X):
if X==1:
return N+1
if X==0:
return 0
if N%X == 0:
return (N//X)*2-1
else:
k = N//X
return k*2*X + rhombus(X,N-(k*X))
answer = answer + rhombus(N-X,X)
print(answer) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s728596325 | p04048 | Wrong Answer | n, x = list(map(int, input().split()))
ans = 3 * 3 * x / 2 + n - x
print(ans) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s131789971 | p04048 | Wrong Answer | n,x=map(int,input().split())
print(4*(n-x)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s455302537 | p04048 | Wrong Answer | n, x = [int(i) for i in input().split()]
print(int(x + (n-x) + x + x + x/2 + x/2 + x/2)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s435063224 | p04048 | Wrong Answer | N, X = map(int, input().split())
print(3 * (N - X)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s694880264 | p04048 | Wrong Answer | N,X=map(int,input().split())
if N%X==0:
print((N-X)*3)
else:
print(N*3-3) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s488084319 | p04048 | Wrong Answer | N,X=map(int,input().split())
if N%2==0 and N//2==X:
print(3*X)
else:
print(N*3-3) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s242667221 | p04048 | Wrong Answer | N, X = map(int, input().split())
ans = X
base = N - X
elem = X
while True:
div, mod = divmod(base, elem)
ans += div * elem * 2
if mod == 0:
ans += base
break
base = elem
elem = mod
print(ans) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s656275378 | p04048 | Wrong Answer | n,x=map(int,input().split())
if n<=2*x:print(int(1.5*x))
else:
k=(2*(x/(n-2*x)))*(n-2*x)
ans=4*x+k
print(int(ans)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s507309030 | p04048 | Wrong Answer | n,x=map(int,input().split())
print(6*x) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s621283558 | p04048 | Wrong Answer | n,x=map(int,input().split())
print(3*x+n+1)
| 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s617177741 | p04048 | Wrong Answer | import sys
input = sys.stdin.readline
N, X = map(int, input().split())
def solve(n, x):
if n == 0:
return 0
if x == 1: return n * 3
m = x
y = n - n // x * x
if y == 0: return n // x * x * 3
return solve(m, y) + y * 3 * x
print(solve(max(N - X, X), min(N - X, X))) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s335049700 | p04048 | Wrong Answer | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd
# from fractions import gcd
from functools import reduce
from pprint import pprint
def myinput():
return map(int,input().split())
def mylistinput(n):
return [ list(myinput()) for _ in range(n) ]
def mycol(data,col):
return [ row[col] for row in data ]
def mysort(data,col):
data.sort(key=lambda x:x[col],reverse=False)
return data
def mymax(data):
M = -1*float("inf")
for i in range(len(data)):
m = max(data[i])
M = max(M,m)
return M
def mymin(data):
m = float("inf")
for i in range(len(data)):
M = min(data[i])
m = min(m,M)
return m
n,x = myinput()
def mycalc(a,b):
if b==0:
return 0
else:
return ( (a//b) * 3 * b ) + mycalc(b,a%b)
if n%2==1:
ans = (n-1)*3
else:
# if x==1:
# ans = (n-1)*3
# else:
ans = mycalc(n-x,x)
print(ans) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s658592611 | p04048 | Wrong Answer | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd
# from fractions import gcd
from functools import reduce
from pprint import pprint
def myinput():
return map(int,input().split())
def mylistinput(n):
return [ list(myinput()) for _ in range(n) ]
def mycol(data,col):
return [ row[col] for row in data ]
def mysort(data,col):
data.sort(key=lambda x:x[col],reverse=False)
return data
def mymax(data):
M = -1*float("inf")
for i in range(len(data)):
m = max(data[i])
M = max(M,m)
return M
def mymin(data):
m = float("inf")
for i in range(len(data)):
M = min(data[i])
m = min(m,M)
return m
n,x = myinput()
def mycalc(a,b):
if b==0:
return 0
else:
return ( (a//b) * 3 * b ) + mycalc(b,a%b)
if n%2==1:
ans = (n-1)*3
else:
# if x>(n//2):
# x = n - x
if x==1:
ans = (n-1)*3
else:
ans = mycalc(n-x,x)
print(ans) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s075102699 | p04048 | Wrong Answer | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd
# from fractions import gcd
from functools import reduce
from pprint import pprint
def myinput():
return map(int,input().split())
def mylistinput(n):
return [ list(myinput()) for _ in range(n) ]
def mycol(data,col):
return [ row[col] for row in data ]
def mysort(data,col):
data.sort(key=lambda x:x[col],reverse=False)
return data
def mymax(data):
M = -1*float("inf")
for i in range(len(data)):
m = max(data[i])
M = max(M,m)
return M
def mymin(data):
m = float("inf")
for i in range(len(data)):
M = min(data[i])
m = min(m,M)
return m
n,x = myinput()
def mycalc(a,b):
if b==0:
return 0
else:
return ( (a//b) * 3 * b ) + mycalc(b,a%b)
if n%2==1:
ans = (n-1)*3
else:
if x>n//2:
x = n - x
if x==1:
ans = (n-1)*3
else:
ans = mycalc(n-x,x)
print(ans) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s026962585 | p04048 | Wrong Answer | from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd
# from fractions import gcd
from functools import reduce
from pprint import pprint
def myinput():
return map(int,input().split())
def mylistinput(n):
return [ list(myinput()) for _ in range(n) ]
def mycol(data,col):
return [ row[col] for row in data ]
def mysort(data,col):
data.sort(key=lambda x:x[col],reverse=False)
return data
def mymax(data):
M = -1*float("inf")
for i in range(len(data)):
m = max(data[i])
M = max(M,m)
return M
def mymin(data):
m = float("inf")
for i in range(len(data)):
M = min(data[i])
m = min(m,M)
return m
n,x = myinput()
ans = (n-1)*3
print(ans) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s428390220 | p04048 | Wrong Answer | n,x=map(int,input().split())
a=n-x
b=a-x
s=x+a+x+x+b+b+b
print(s) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s338691775 | p04048 | Wrong Answer | def examA():
N = I()
L = LI()
L.sort()
ans = sum(L[::2])
print(ans)
return
def examB():
N, X = LI()
ans = N-X
while(X>0):
ans += (2 * (N//X) - 1) * X
#print(ans,N,X)
next_N = X
next_X = N%X
N = next_N
X = next_X
print(ans)
return
def examC():
ans = 0
print(ans)
return
def examD():
ans = 0
print(ans)
return
def examE():
ans = 0
print(ans)
return
def examF():
ans = 0
print(ans)
return
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]
sys.setrecursionlimit(10**6)
if __name__ == '__main__':
examB()
"""
""" | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s680770749 | p04048 | Wrong Answer | N,X = map(int,input().split())
print(N*3) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s923034079 | p04048 | Wrong Answer | n,x=map(int,input().split())
if x < n/2:
print(n + int(3.5 * x))
elif x == n/2:
print(3 * x)
else:
if x % (n-x) == 0:
print((n-x) * 3 * (x // (n-x)))
else:
q=n-x
r= x % (n-x)
ans = (n-x) * ((x//(n-x))*3 + 1)
while r != 0:
if q % r == 0:
ans += ((q//r - 1) * 2 + 1) * r
r=0
elif q % r != 0:
ans += (q//r) * 2 * r
q,r = r, q % r
print(ans)
| 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s730724643 | p04048 | Wrong Answer | n,x=map(int,input().split())
if x < n/2:
print(n + 3.5 * x)
elif x == n/2:
print(3 * x)
else:
if x % (n-x) == 0:
print((n-x) * 3 * (x // (n-x)))
else:
q=n-x
r= x % (n-x)
ans = (n-x) * ((x//(n-x))*3 + 1)
while r != 0:
if q % r == 0:
ans += ((q//r - 1) * 2 + 1) * r
r=0
elif q % r != 0:
ans += (q//r) * 2 * r
q,r = r, q % r
print(ans) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s541085462 | p04048 | Wrong Answer | num = [int(x) for x in input().split()]
N = num[0]
X = num[1]
result = N
a = N -X
b = X
if a < b:
c = a
a = b
b = c
while b >= 1:
result += (2*(a//b))*b
c = a%b
a = b
b = c
print(result) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s742191763 | p04048 | Wrong Answer | Input_num = [int(x) for x in input().split()]
N = Input_num[0]
X = Input_num[1]
Total_Length = 2*X + N + 3*(X//2)
print(Total_Length) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s219732171 | p04048 | Wrong Answer | def run():
N, X = map(int, input().split())
y = N-X
ans = N
while True:
y, X = max(y, X), min(y, X)
a = y//X
ans += a*X*2
if y%X == 0:
break
y, X = X, a
print(ans-X)
if __name__ == '__main__':
run() | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s715345696 | p04048 | Wrong Answer | n,x = [int(i) for i in input().split()]
length = n
n=n-x
while True:
if x==0:
length-=x
break
t=n//x
length+=2*t*x
a=n
n=x
x=a-t*x
print(length) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s506811118 | p04048 | Wrong Answer | n,x = [int(i) for i in input().split()]
length = n
n=n-x
while True:
if x==0:
break
t=n//x
length+=2*t*x
a=n
n=x
x=a-t*x
print(length) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s747448111 | p04048 | Wrong Answer | N,X = map(int,input().split())
if X<=N/2:
print(4*(N-X))
else:
print(3*X) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s295660787 | p04048 | Wrong Answer | n,x = map(int,input().split())
print(x*3 + (n-x)*2) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s085277730 | p04048 | Wrong Answer | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect_left
from heapq import heappush, heappop
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
N, X = MAP()
if X <= N/2:
print(4*N-4*X)
else:
print(6*N-5*X)
| 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s585033086 | p04048 | Wrong Answer | n, x = map(int, input().split())
print(2 * n + x) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s233090013 | p04048 | Wrong Answer | n, x = map(int, input().split())
ans = n
wall_side = n - x
light_length = n - (n - x)
while True:
if wall_side % light_length == 0:
ans += (wall_side // light_length - 1) * 2 + 1
break
else:
ans += 2 * (wall_side // light_length) * light_length
wall_side, light_length = light_length, wall_side % light_length
print(ans)
| 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s033188772 | p04048 | Wrong Answer | n,x=map(int,input().split())
if n-3*x>0:
total=2*n
else:
total=n+4*x-1
print(total)
| 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s791604642 | p04048 | Wrong Answer | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
N, X = MAP()
if N%2 == 1:
print((N-1)*3)
else:
print(N*3//2+abs(X-N//2)*3)
| 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s097379139 | p04048 | Wrong Answer | n, x = map(int, input().split())
a, b = max(n-x,x),min(n-x,x)
res = a+b
while b!=0:
q = a/b
r = a%b
res += (b*2)*q
if (r==0):
res -= b
a, b = b, r
print(res) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s548884385 | p04048 | Wrong Answer | n, x = map(int, input().split())
ans = 0
a, b = max(n-x,x),min(n-x,x)
res = a+b
while b:
q = a/b
r = a%b
res += (b*2)*q
if (r==0):
res -= b
a, b = b, r
print(res) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s697199411 | p04048 | Wrong Answer | n, x = map(int, input().split())
if (n%2 == 1):
print((n-1)*3)
elif (n==2):
print(3)
else:
k=n/2
if (x<k):
print(int((k*3)+(3*(k-x))))
elif(x==k):
print(int(k*3))
else:
print(int((k*3)+(3*(k-(n-x)))))
| 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s578443542 | p04048 | Wrong Answer | n, x = map(int, input().split())
if (n%2 == 1):
print((n-1)*3)
elif (n==2):
print(3)
else:
k=n//2
if (x<k):
print(int((n-x)*k))
elif(x==k):
print(int(k*3))
else:
print(int(x*k))
| 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s311364778 | p04048 | Wrong Answer | n, x = map(int, input().split())
if (n%2 ==1):
print((n-1)*3)
elif (n==2):
print(3)
else:
k=n/2
if (x<k):
print((n-x)*k)
elif(x==k):
print(k*3)
else:
print(x*k)
| 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s212457501 | p04048 | Wrong Answer | n, x = map(int, input().split())
print((n-1)*3) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s991997867 | p04048 | Wrong Answer | n, x = map(int, input().split())
ans = []
for i in range(1,n):
k=i*3
ans.append(k)
print(ans[n-2]) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s734543112 | p04048 | Wrong Answer | N, X = input().split()
print(3 * (int(N) - 1)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s475209552 | p04048 | Wrong Answer | N, X = input().split()
print(3 * int(N)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s822445461 | p04048 | Wrong Answer | N, X = input().split()
print(6 * int(X)) | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s446368918 | p04048 | Wrong Answer | import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
def sol():
N, X = map(int, input().split())
if X * 2 > N:
print(3 * X)
elif X * 2 == N:
print(3 * X)
else:
print(4 * (N - X))
sol() | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
s100697335 | p04048 | Wrong Answer | import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
def sol():
N, X = map(int, input().split())
if X * 2 > N:
print(2 * X / (N - X))
elif X * 2 == N:
print(3 * X)
else:
print(4 * (N - X))
sol() | 5 2
| 12
| <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilateral triangle.
Let the vertices of the triangle be <var>a, b</var> and <var>c</var>.</p>
<p>Inside the triangle, the rifle is placed at the point <var>p</var> on segment <var>ab</var> such that <var>ap = X</var>.
(The size of the rifle is negligible.)
Now, the rifle is about to fire a ray of Mysterious Light in the direction of <var>bc</var>.</p>
<p>The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light.
There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!
When the ray comes back to the rifle, the ray will be absorbed.</p>
<p>The following image shows the ray's trajectory where <var>N = 5</var> and <var>X = 2</var>.</p>
<div style="text-align: center;">
<img alt="btriangle.png" src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/btriangle.png">
</img></div>
<p>It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of <var>N</var> and <var>X</var>.
Find the total length of the ray's trajectory.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>2≦N≦10^{12}</var></li>
<li><var>1≦X≦N-1</var></li>
<li><var>N</var> and <var>X</var> are integers.</li>
</ul>
</section>
</div>
<div class="part">
<section>
<h3>Partial Points</h3><ul>
<li><var>300</var> points will be awarded for passing the test set satisfying <var>N≦1000</var>.</li>
<li>Another <var>200</var> points will be awarded for passing the test set without additional constraints.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>X</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the total length of the ray's trajectory.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>5 2
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>12
</pre>
<p>Refer to the image in the Problem Statement section.
The total length of the trajectory is <var>2+3+2+2+1+1+1 = 12</var>.</p></section>
</div>
</span> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.