submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s643678757
p04047
Accepted
import numpy as np n = int(raw_input()) l = map(int, raw_input().split()) l.sort() l = np.array(l).reshape(-1, 2) print l.T[0].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>
s488508931
p04047
Accepted
N = int(input()) K = input() K = "".join(K).split(" ") K = [int(s) for s in K] K.sort() ans=0 for s in range(N): if int(K[-1])> int(K[-2]): ans+=int(K[-2]) else: ans+=int(K[-1]) del K[-2:] 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>
s350270286
p04047
Accepted
from sys import stdin n = int(stdin.readline()) a = map(int,stdin.readline().split()) ans = 0 i = 0 a.sort() while i<n*2: ans += a[i] i+=2 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>
s917434957
p04047
Accepted
#AGC001A n=int(raw_input()) l=map(int,raw_input().split()) l.sort() l.reverse() res=0 for i in xrange(0,2*n,2): res+=min(l[i],l[i+1]) print res
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>
s361991427
p04047
Accepted
n = int(input()) l = [int(s) for s in input().split()] l.sort() print(sum(l[2*i] for i in range(n)))
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>
s028863495
p04047
Accepted
N = int(input()) L = list(map(int,input().split())) L.sort() ans=0 for i in range(0,2*N,2): ans +=L[i] 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>
s698406028
p04047
Accepted
n = int(input()) a = list(map(int, input().split())) a.sort() s = 0 for i in range(0, len(a), 2): s += a[i] print(s)
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>
s294592397
p04047
Accepted
input() print sum(sorted(map(int,raw_input().split()))[::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>
s855195465
p04047
Accepted
#!/usr/bin/python3 N = int(input()) L = list(map(int, input().split())) L.sort() print(sum(L[0::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>
s375388278
p04047
Accepted
n = int(raw_input()) lis = map(int,raw_input().split(" ")) lis.sort() count = 0 for var in range(0,len(lis)): if var % 2 == 1: continue count = count + lis[var] 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>
s063108436
p04047
Accepted
N = int(input()) L = [int(term) for term in input().split()] L.sort() x = 0 for i in range(N) : x += min(L[2 * i], L[2 * i + 1]) print(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>
s203154154
p04047
Accepted
n=input() k=map(int,raw_input().split()) ans=0 for i,e in enumerate(sorted(k)): if i%2==0: ans+=e 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>
s468349393
p04047
Accepted
input() print sum(sorted(map(int, raw_input().split()))[::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>
s541881000
p04047
Accepted
# -*- coding: utf-8 -*- def max_ingredients(L): work_L = L ing = 0 while work_L: ing += work_L[-1] work_L = work_L[:-2] return ing def main(): N = int(input()) L = [int(l) for l in input().split(" ")] print( max_ingredients( sorted( L, reverse=True ) ) ) if __name__ == '__main__': main()
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>
s342868220
p04047
Accepted
N = input() L = map(int,raw_input().split(' ')) count = 0 for i in xrange(N): L.sort() count += min(L.pop(0),L.pop(0)) 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>
s225322006
p04047
Accepted
n = int(input()) *l, = map(int, input().split()) l.sort() print(sum(l[::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>
s641809306
p04047
Accepted
N = int(input()) Ls = list(map(int, input().split())) Ls.sort() print(sum(Ls[0::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>
s006070399
p04047
Accepted
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time sys.setrecursionlimit(10**7) n = int(input()) a = list(map(int, input().split())) a.sort() print(sum(a[::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>
s956292853
p04047
Accepted
n=int(raw_input()) N=map(int,raw_input().split()) N.sort() count=0 for i in range(n): count+=N[2*i] 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>
s699467349
p04047
Accepted
n = int(raw_input()) a = map(int,raw_input().split()) a.sort() s_l = 0 for i in xrange(0,2*n,2) : s_l += a[i] print s_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>
s855197182
p04047
Accepted
n = int(raw_input()) har = sorted(map(int,raw_input().split())) ans = 0 for i in xrange(0,2*n,2): ans += har[i] 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>
s584376600
p04047
Accepted
n = int(input()) l = sorted(map(int, input().split())) ans = sum([l[i] for i in range(0, n*2, 2)]) 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>
s965139314
p04047
Accepted
N = int(raw_input()) L_arr = [int(x) for x in raw_input().split(' ')] L_arr = sorted(L_arr) print sum(L_arr[::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>
s277609186
p04047
Accepted
n = input() l = map(int, raw_input().split()) l.sort() m = l[::2] print sum(m)
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>
s545971762
p04047
Accepted
N = input() li = map(int,raw_input().split()) li.sort() print sum(li[0::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>
s380688610
p04047
Accepted
# encoding: utf-8 n = int(raw_input()) l = map(int, raw_input().split()) l.sort() print sum(l[::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>
s515248608
p04047
Accepted
k = raw_input() n = raw_input() a = [int(i) for i in n.split()] a.sort() sum1 = 0 for i in range(int(k)): sum1 += min(a[2*i], a[2*i+1]) print sum1
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>
s357002686
p04047
Accepted
N = input() L = sorted(map(int, raw_input().split()))[::-1] print sum(l for i, l in enumerate(L) if i % 2 != 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>
s383141645
p04047
Accepted
m=0 n=int(input()) kushi= list(map(int,input().split())) kushi.sort() if len(kushi) %2==1: del kushi[-1] for i in range(0,len(kushi)-1,2): if kushi[i]>kushi[i+1]: m+=kushi[i+1] else: m+=kushi[i] print(m)
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>
s606245144
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) BBQ = [] L.sort() for x in range(0, 2 * N - 1, 2): BBQ.append(min(L[x], L[x + 1])) print(sum(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>
s113778330
p04047
Accepted
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<len(l)): 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>
s781331111
p04047
Accepted
n = input() l = raw_input() l = sorted(map(int, l.split())) res = 0 for i in xrange(n): res += min(l[2 * i], l[2 * i + 1]) print res
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>
s193994056
p04047
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- N = int(input())*2 s_L = input() L = [] for i in s_L.split(): L.append(int(i)) L.sort() ans = 0 for i in range(0,N,2): ans += L[i] 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>
s745739761
p04047
Accepted
N = int(input()) Ls = map(int, input().split()) Ls = sorted(Ls) ans = sum(Ls[2*i] for i in range(N)) 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>
s266961717
p04047
Accepted
N = int(raw_input()) L = raw_input() L = map(int, L.split(" ")) r = 0 L.sort() L.reverse() for i in xrange(N): r += L[i * 2 + 1] print r
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>
s815029133
p04047
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- N = int(input()) Ls = list(map(int, input().split())) sorted_ = sorted(Ls) list_ = [] for i, x in enumerate(sorted_): if i % 2 == 0: list_.append(x) sum_ = sum(list_) 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>
s411350997
p04047
Accepted
n = int(raw_input()) a = map(int, raw_input().split()) a.sort() print sum(a[::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>
s498806131
p04047
Accepted
N=raw_input() up=raw_input() up=up.split() up=map(int,up) up.sort() count=0 for i in range(int(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>
s055825985
p04047
Accepted
N = int(raw_input()) length_list = sorted(map(int, raw_input().strip().split())) total = 0 for i in xrange(0, 2*N, 2): total += length_list[i] print total
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>
s201927332
p04047
Accepted
#!/usr/bin/env python # -*- coding: utf-8 -*- def main(): n = int(input()) l = [int(i) for i in input().split()] sorted_l = sorted(l) counter = 0 for i in range(n): counter += sorted_l[i * 2] print(counter) if __name__ == '__main__': main()
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>
s051180209
p04047
Accepted
# coding: utf-8 def main(): n = int(input()) l = list(map(int, input().split())) l.sort(reverse=True) m = 0 for i in range(0, len(l), 2): m += min(l[i], l[i+1]) print(m) if __name__ == '__main__': main()
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>
s864297302
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L = sorted(L) num=0 for i in range(0,len(L),2): num = num + L[i] print(num)
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>
s856734058
p04047
Accepted
n = int(raw_input()) ls = map(int, raw_input().split()) ls.sort() cnt = 0 for i in range(0, 2 * n, 2): cnt += ls[i] print cnt
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>
s414774621
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort() rst = [] for i in range(0, len(L), 2): rst.append(min(L[i], L[i+1])) print(sum(rst))
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>
s621886104
p04047
Accepted
N = int(input()) L = list(int(_) for _ in input().split()) L.sort() s = 0 for i in range(N): i = i * 2 s += L[i] print (s)
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>
s863014149
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort(reverse=True) Ans = 0 for row in range(N): Ans = Ans + L[(2*row)-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>
s158233417
p04047
Accepted
import numpy as np N = int(raw_input()) data = np.array(map(int, raw_input().split())) data = np.sort(data) idx = np.array([True, False]*N) ans = sum(data[idx]) 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>
s783789479
p04047
Accepted
n = int(input().strip()) L = map(int,input().strip().split(" ")) ret = 0 flag = 0 for i in sorted(L,reverse = True): if flag == 0: flag = 1 continue ret = ret + i flag = 0 print(ret)
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>
s530660170
p04047
Accepted
n = input() l = map(int, raw_input().split()) l.sort() s = 0 for i in range(len(l)): if i % 2 == 0: s += l[i] print s
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>
s239150113
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) sort_L = sorted(L) ans = 0 for i in range(N): ans = ans + sort_L[2*i] print('%s' % str(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>
s313903719
p04047
Accepted
N = input() l = map(int, raw_input().split()) l.sort() s = 0 for i in xrange(N): s += min(l[i*2], l[i*2+1]) print s
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>
s880235159
p04047
Accepted
num = int(raw_input()) rods = [ int(x) for x in raw_input().split() ] rods = sorted(rods) ret = 0 for index in xrange(num): n = min(rods[2 * index], rods[2 * index+1]) ret += n print ret
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>
s041837538
p04047
Accepted
if __name__ == '__main__': N = int(input()) L = list(map(int, input().split())) L = sorted(L) count = 0; for i in range(N): count += L[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>
s901030066
p04047
Accepted
import sys n = int(raw_input()) arr = map(int,raw_input().strip().split(" ")) arr.sort() arr.reverse() cnt =0 c=1 for i in range(0,n): cnt+=arr[c] c+=2 print cnt
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>
s999656734
p04047
Accepted
n = raw_input() a = map(int, raw_input().split()) a.sort() ans = 0 for x in a[::2]: ans += 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>
s165977389
p04047
Accepted
#! /usr/bin/env python3 N = int(input()) L = list(sorted(map(int, input().split()))) ans = 0 for i in range(N): ans += min(L[i*2], L[i*2+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>
s450013442
p04047
Accepted
N = int(input()) A = sorted(map(int, input().split())) ans = sum(A[i * 2] for i in range(N)) 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>
s519944818
p04047
Accepted
ans = 0 n = input() a = map(int, raw_input().split()) a.sort() for i in xrange(2 * n): if i % 2 == 0: ans += a[i] 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>
s902762937
p04047
Accepted
n = input() ls = map(int, raw_input().split()) ls.sort() print sum(ls[::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>
s510341470
p04047
Accepted
n=int(raw_input()) #n,k=map(int,raw_input().split()) l=map(int,raw_input().split()) l.sort() ans=chk=0 for i in l[::-1]: if chk%2: ans+=i chk+=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>
s981061198
p04047
Accepted
_ = int(input()) print(sum(sorted([int(x) for x in input().split()])[::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>
s730537249
p04047
Accepted
N = int(input()) Ls = list(map(int, input().split())) sLs = sorted(Ls) ans = 0 for i in range(N): ans += sLs[i*2] 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>
s290751974
p04047
Accepted
n = input() l = sorted(map(int, raw_input().split())) s = 0 for i in xrange(n): s += l[2*i] print s
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>
s390853081
p04047
Accepted
n=int(input()) a=list(sorted(map(int,input().split()))) ans=0 for i in range(n): ans += a[2*i] 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>
s742661150
p04047
Accepted
_=input();print(sum(sorted([int(i) for i in input().split()])[::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>
s318556003
p04047
Accepted
n = input() l = map(int,raw_input().split()) l.sort() ans = 0 for i in range(n): a = l.pop(0) b = l.pop(0) ans += min(a,b) 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>
s601625509
p04047
Accepted
import sys N = int(sys.stdin.readline()) L = list(map(int, sys.stdin.readline().split())) L.sort() res = 0 for i in range(N): res += L[i*2] print(res)
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>
s587612701
p04047
Accepted
n = int(input()) l = list(map(int,input().split())) l.sort() ans = 0 for i in range(n): ans += l[2 * i] 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>
s098712599
p04047
Accepted
n = int(raw_input()) values = sorted(map(int, raw_input().split())) result = 0 for i in range(0, 2 * n, 2): result += values[i] print(result)
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>
s140405747
p04047
Accepted
N = input() kushi = map(int,raw_input().split()) kushi.sort() answer = 0 for i in xrange(N): answer += kushi[2 * i] 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>
s224907606
p04047
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- N = int(input()) Ls = list(map(int,input().split())) Ls.sort() ans = 0 for i in range(N): ans += Ls[i*2] 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>
s347795515
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort() ans = 0 for k in range(N): ans += min(L[k*2],L[k*2+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>
s222472970
p04047
Accepted
n=int(input()) a=list(map(int,input().split())) b=sorted(a) ans=0 for i in range(0,n*2,2): ans += min(b[i],b[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>
s346114527
p04047
Accepted
N = int(input()) L = [int(t) for t in input().split(' ')] L.sort() print(sum([n for i, n in enumerate(L) if i & 1 == 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>
s831870477
p04047
Accepted
N = raw_input() l = [int(x) for x in raw_input().split(' ')] l.sort() ret = 0 for i in xrange(0, len(l) / 2): ret += l[i * 2] print ret
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>
s216036820
p04047
Accepted
n = int(raw_input()) l = map(int, raw_input().split()) l.sort() ans = 0 for i in range(0, 2*n, 2): ans += l[i] 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>
s886640813
p04047
Accepted
#coding :utf-8 N = int(raw_input()) L = sorted(map(int, raw_input().split())) print sum([L[i*2] for i in xrange(N)])
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>
s223459366
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L = sorted(L) ans = 0 for i in range(N): ans += L[2 * i] 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>
s165889913
p04047
Accepted
input() print sum(sorted(map(int, raw_input().split()))[::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>
s707167377
p04047
Accepted
n = int(input()) L = list(map(int, input().split())) L.sort() ans = 0 for i in range(n): now = 2 * i ans += L[now] 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>
s585199164
p04047
Accepted
#!/usr/bin/env python3 def f(xs, ys): acc = 0 for x, y in zip(xs, ys): acc += min(x, y) return acc n = int(input()) l = sorted(map(int,input().split())) ans = max(f(l[0::2], l[1::2]), f(l[1::2], l[2::2])) 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>
s633246874
p04047
Accepted
N = int(raw_input()) L = map(int,raw_input().split()) L.sort(reverse = True) ans = 0 for i in xrange(N): ans += min(L[2*i],L[2*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>
s122458078
p04047
Accepted
n = int(input())*2 l = list(map(int, input().split())) l.sort() total = 0 for i in range(1,n,2): total += l[i-1] print(total)
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>
s691098616
p04047
Accepted
raw_input() print sum(sorted(map(int, raw_input().split()))[0::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>
s681737071
p04047
Accepted
n=input() l=map(int,raw_input().split()) l.sort() cnt=0 for i in xrange(n): cnt+=l[i*2] print(cnt)
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>
s372862826
p04047
Accepted
# -*- coding: utf-8 -*- import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll N = int(raw_input()) L = map(int, raw_input().split()) L.sort() ans = 0 for i in xrange(N - 1, -1, -1): ans += min(L[2*i], L[2*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>
s997613715
p04047
Accepted
N=int(input()) A=list(map(int,input().split())) A.sort() print(sum(A[::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>
s164919270
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort() ans = 0 for l1, l2 in zip(L[::2], L[1::2]): ans += l1 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>
s497316864
p04047
Runtime Error
N = int(input()) A = list(map(int, input().split())) A.sort() ans = 0 for i in range(0, 2 * N + 1, 2): ans += A[i] 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>
s525380249
p04047
Runtime Error
n=int(input()) arr=list(map(int,input().split())) arr=arr.sort() s=0 for i in range(0,(2*n)-1,2): s+=arr[i] print(s)
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>
s604076487
p04047
Runtime Error
n = int(input()) a = sorted(map(int, input().split())) s = 0 for i in range(2n-1): s += min(a[i], a[i+1]) print(s)
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>
s981238232
p04047
Runtime Error
import math import sys cin - iter(sys.stdin.read().split()); TT - int(next(cin)); for TT in range(TT) n - int(next(cin)) p - [0] + n h - [0] + n interesting - set() for i in range(n) interesting.add(p[i]) interesting.add(p[i].h[i]) interesting.add(p[i]+h[i]) allinteresting - sorted(interesting, reverse - True) dp - dict() for thisn in allinteresting: for forbidden in [0,1]: best - 0 dp[(thisn. forbidden)] - best diff - sun[i if c == 'A' else -i for c in s] print["Case s(): [)", format(TT+i, "NY"[abs[diff]) -- i] for thisn in allinteresting: for forbiddeh in [0,1] dp[(thisn. forbidden)] - best int main(){ int N 1 < 100 }; int main(){ int L 1 < 100 }; var = (N <= * 2 * 3) console.log( L + 2 - 3 ); console.log( N + 2 * 3 ); type( - 2 ); type( + 2 ); type( - 3 ); type( + 4 ); type ( + 1 ); return = 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>
s389057621
p04047
Runtime Error
k = iinput() li= input().split() li.sort() sum=0 for k in range(len(li)): if k%2==0: sum=sum+li[k] 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>
s131254454
p04047
Runtime Error
try: k=input() except EOFError: print("wtf") try: li=input() except EOFError: print("wtf2") li.sort() sum=0 for k in range(len(li)): if k%2==0: sum=sum+li[k] 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>
s509499974
p04047
Runtime Error
k=input() li=input() li.sort() sum=0 for k in range(len(li)): if k%2==0: sum=sum+li[k] 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>
s019316700
p04047
Runtime Error
N = int(input()) list = [] for i in 2N: Li = int(input()) list.append(Li) def bbq(list): for i in range(len(list)-1): for j in range(i,len(list)):
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>
s933900905
p04047
Runtime Error
n=int(input()) a=map(int,input().split()) ans=0 for i in range(0,2*n,2): ans+=a[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>
s112597968
p04047
Runtime Error
from collections import Counter n = int(input()) arr = list(map(int, input().split())) counts = Counter(arr) res = 0 for k,v in counts.items(): if v>=2: res += v//2 counts[k] = v%2 items = sorted(counts.items()) for i in range(len(items)-1): res+=min(items[i], items[i+1]) print(res)
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>
s280396540
p04047
Runtime Error
from collections import Counter n = int(input()) arr = list(map(int, input().split())) counts = Counter(arr) res = 0 for k,v in counts.items(): if v>=2: res += v//2 counts[k] = v%2 items = sorted(counts.items()) for i in range(len(items)-1): res+=min(items[i], items[i+1]) return res
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>
s821577378
p04047
Runtime Error
N=int(input()) array=input() L=[int(val) for val in array.split()] L=sorted(L) total=0 start=0 P=[L for val in L] for _ in range(N): total+=min(P[start],P[start+1]) P.pop(start) P.pop(start+1) start+=2 print(total)
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>