submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s119540488
p04047
Accepted
n = int(input()) L = sorted(map(int,input().split())) ans = L[0::2] ans = sum(ans) 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>
s761800137
p04047
Accepted
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n = int(input()) L = sorted(list(map(int, input().split()))) res = 0 for i in range(n * 2): if i % 2 == 0: res += L[i] print(res) if __name__ == '__main__': resolve()
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>
s655390757
p04047
Accepted
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush import math #from math import gcd #inf = 10**17 #mod = 10**9 + 7 n = int(input()) l = list(map(int, input().split())) res = 0 l.sort() for i in range(0, 2*n, 2): res += l[i] print(res) 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>
s992978763
p04047
Accepted
n = int(input()) l = list(map(int,input().split())) l.sort() ans = 0 for i in range(n*2): if i%2 != 0: continue 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>
s588274797
p04047
Accepted
N = input() Ls = map(int,raw_input().split(" ")) Ls.sort() print sum(Ls[i] for i in range(0,N*2,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>
s049289701
p04047
Accepted
n = int(input()) l = list(map(int, input().split(' '))) l.sort() ans = 0 for i in range(len(l)): if i % 2 == 0: 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>
s289769466
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort(reverse=True) ans = 0 for i in range(1, 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>
s273569829
p04047
Accepted
n = int(input()) lll = list(map(int, input().split())) lll.sort() print(sum(lll[::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>
s530557780
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>
s397474254
p04047
Accepted
import sys input=sys.stdin.readline def main(): n=int(input()) L=list(map(int,input().split())) L.sort() ans=0 for i in range(n): ans+=L[i*2] else: print(ans) 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>
s208121704
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>
s100149678
p04047
Accepted
A = int(input()) B = list(map(int,input().split())) B.sort(reverse=True) ans =0 for i in range(A): ans += min(B[0+i*2],B[1+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>
s735986434
p04047
Accepted
n = int(input()) L = list(map(int, input().split())) L = sorted(L, reverse=True) cnt = 0 i = 0 while True: if i == 2*n: break cnt += min(L[i], L[i + 1]) 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>
s325588175
p04047
Accepted
from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] - k[j] # if kk[bisect.bisect_right(kk,d) - 1] == d: # # # # pythonで無理なときは、pypyでやると正解するかも!! # # import sys sys.setrecursionlimit(10000000) mod = 10**9 + 7 def readInts(): return list(map(int,input().split())) def main(): n = int(input()) L = sorted(readInts()) ans = 0 for i in range(0,n*2,2): ans += L[i] print(ans) 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>
s522360698
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort(reverse=True) print(sum(L[1::2]))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s229072004
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>
s802494819
p04047
Accepted
from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations # (string,3) 3回 from collections import deque from collections import defaultdict import bisect # # d = m - k[i] - k[j] # if kk[bisect.bisect_right(kk,d) - 1] == d: # # # # pythonで無理なときは、pypyでやると正解するかも!! # # import sys sys.setrecursionlimit(10000000) mod = 10**9 + 7 def readInts(): return list(map(int,input().split())) def main(): n = int(input()) * 2 L = readInts() L = sorted(L) res = 0 for i in range(0,n,2): res += L[i] print(res) 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>
s021781431
p04047
Accepted
n = int(input()) l = list(map(int,input().split())) l.sort() ans = 0 for i in range(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>
s344439494
p04047
Accepted
n=int(input()) a=[int(x) for x in input().split()] a.sort(reverse=True) print(sum(a[1::2]))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s261856906
p04047
Accepted
N = int(input()) L = [int(x) for x in input().split()] L.sort(reverse=True) print(sum(L[1::2]))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s459711244
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L = sorted(L, reverse=True) mL = L[1::2] print(sum(mL))
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>
s906415586
p04047
Accepted
# AGC 001: A – BBQ Easy N = int(input()) L = [int(s) for s in 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>
s264660548
p04047
Accepted
N=int(input()) L=list(map(int,input().split())) L.sort() ans=int(0) for i in range(0,N*2,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>
s431546496
p04047
Accepted
N=int(input()) L=sorted(list(map(int,input().split()))) 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>
s043044695
p04047
Accepted
input() print(sum(list(sorted(list(map(int,input().split()))))[0:-1:2] ))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s449974021
p04047
Accepted
n=int(input()) l=list(map(int,input().split())) l.sort() ans=0 for i in range(0,n*2,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>
s915696042
p04047
Accepted
n = int(input()) l = [int(i) for i in input().split()] l.sort() ans = 0 for i in range(1, len(l), 2): ans += min(l[i-1], 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>
s753276217
p04047
Accepted
import sys kushiYaki = int(input()) kushi = list(map(int, input().split())) kushi.sort() max_ingredients = 0 for available_ingredient in kushi[0::2]: max_ingredients += available_ingredient print(max_ingredients)
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>
s039622319
p04047
Accepted
N = int(input()) L = sorted(map(int, input().split())) ans = sum(L[::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>
s280527496
p04047
Accepted
n, *l = map(int, open(0).read().split()) print(sum(min(sorted(l)[i*2:i*2+2]) 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>
s843903545
p04047
Accepted
def main(): n = int(input()) l = [int(x) for x in input().split()] l.sort() print(sum(l[0::2])) 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>
s417268005
p04047
Accepted
n = int(input()) a = list(map(int,input().split())) asrt = sorted(a,reverse=True) ans = 0 for v in range(1,2*n,2): ans += asrt[v] print(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>
s947850950
p04047
Accepted
n = int(input()) l = list(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>
s560693459
p04047
Accepted
n=int(input()) L=sorted(list(map(int,input().split()))) 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>
s920910068
p04047
Accepted
# 2n = n * 2 pairs optimal greedy contradiction 1 is paired with k 2 is with j if we move 1 to 2 and k to j def main(): n = int(input()) arr = [int(x) for x in input().split(" ")] arr.sort() ans = 0 for i in range(2*n): if (i % 2) == 0: ans += arr[i] print(ans) 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>
s984567236
p04047
Accepted
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left from fractions import gcd from heapq import heappush, heappop from functools import reduce def input(): return sys.stdin.readline().strip() def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) def ZIP(n): return zip(*(MAP() for _ in range(n))) sys.setrecursionlimit(10 ** 9) INF = float('inf') mod = 10 ** 9 + 7 N = INT() L = LIST() 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>
s699698770
p04047
Accepted
n = int(input()) l = list(map(int,input().split())) l.sort() skewers = 0 for i in range(0,2*n,2) : skewers += l[i] print(skewers)
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>
s281429030
p04047
Accepted
N = int(input()) A = sorted(map(int,input().split()),reverse=True) C = [] for i in range(N): C.append(A[2*i + 1]) print(sum(C))
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>
s946424248
p04047
Accepted
N=int(input()) L=list(map(int,input().split())) L.sort() ans=sum(L[0:2*N: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>
s497284451
p04047
Accepted
n = int(input()) l = sorted(list(map(int, input().split()))) 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>
s785931268
p04047
Accepted
n=int(input()) l=list(map(int,input().split())) l.sort() s=0 for i in range(0,2*n,2): s+=min(l[i],l[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>
s109379933
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>
s145788163
p04047
Accepted
n=int(input()) l=list(map(int, input().split())) l.sort() s=0 for i in range(0,2*n, 2): s+=min(l[i], l[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>
s959675793
p04047
Accepted
N = int(input()) kushi = list(map(int,input().split())) kushi.sort() ans = 0 for i in range(0,2*N,2): ans += min(kushi[i],kushi[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>
s087617403
p04047
Accepted
n = int(input()) l = list(map(int, input().split() )) l.sort() count = 0 i = 0 while i<len(l): count+=l[i] 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>
s726009540
p04047
Accepted
import math import fractions import bisect import collections import itertools import heapq import string import sys import copy from decimal import * from collections import deque sys.setrecursionlimit(10**7) MOD = 10**9+7 INF = float('inf') #無限大 def gcd(a,b):return fractions.gcd(a,b) #最大公約数 def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数 def iin(): return int(sys.stdin.readline()) #整数読み込み def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み def isn(): return sys.stdin.readline().split() #文字列読み込み def imn(): return map(int, sys.stdin.readline().split()) #整数map取得 def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得 def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得 def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得 def iln_s(): return sorted(iln()) # 昇順の整数リスト取得 def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得 def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得 def join(l, s=''): return s.join(l) #リストを文字列に変換 def perm(l, n): return itertools.permutations(l, n) # 順列取得 def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数 def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得 def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数 def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離 def m_add(a,b): return (a+b) % MOD def print_list(l): print(*l, sep='\n') def Yes(): print('Yes') def No(): print('No') def YES(): print('YES') def No(): print('No') def sieves_of_e(n): is_prime = [True] * (n+1) is_prime[0] = False is_prime[1] = False for i in range(2, int(n**0.5)+1): if not is_prime[i]: continue for j in range(i * 2, n+1, i): is_prime[j] = False return is_prime N = iin() L = sorted(iln()) ans = 0 for i in range(0, 2*N, 2): ans += min(L[i], L[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>
s076645282
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort() ans = 0 for i in range(N*2): if i % 2 == 0: 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>
s847759453
p04047
Accepted
n = int(input()) l = list(map(int,input().split())) l.sort() res = 0 for i in range(n*2): if i%2==0: res += l[i] 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>
s070685611
p04047
Accepted
n = int(input()) L = list(map(int, input().split())) L = sorted(L) 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>
s538165927
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort(reverse=True) ans = 0 for i in range(0, 2 * N, 2): ans += min(L[i], L[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>
s140624259
p04047
Accepted
def main(): n = int(input()) l = list(map(int, input().split())) l.sort() ans = sum(l[::2]) print(ans) 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>
s181455774
p04047
Accepted
N = int(input()) X = sorted(list(map(int, input().split()))) s = 0 for i in range(N): s += X[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>
s371466402
p04047
Accepted
n = int(input()) l = sorted(list(map(int, input().split()))) ans = 0 for i in range(n): ans += l[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>
s431033138
p04047
Accepted
N=input() print(sum(sorted(list(map(int,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>
s899024839
p04047
Accepted
n=int(input()) l=list(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>
s054575371
p04047
Accepted
n = int(input()) li = [int(x) for x in input().split()] li.sort() ans = 0 for i in range(0,2*n,2): ans += min(li[i],li[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>
s232346502
p04047
Accepted
N = int(input()) l = [0] * 2 * N l = list(map(int, input().split())) l.sort() total = 0 for i in range(N): total += l[i * 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>
s788475024
p04047
Accepted
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,sqrt,factorial,hypot,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter,defaultdict,deque from itertools import accumulate,permutations,combinations,product,combinations_with_replacement from bisect import bisect_left,bisect_right from copy import deepcopy from fractions import gcd from random import randint def ceil(a,b): return (a+b-1)//b inf=float('inf') mod = 10**9+7 def pprint(*A): for a in A: print(*a,sep='\n') def INT_(n): return int(n)-1 def MI(): return map(int,input().split()) def MF(): return map(float, input().split()) def MI_(): return map(INT_,input().split()) def LI(): return list(MI()) def LI_(): return [int(x) - 1 for x in input().split()] def LF(): return list(MF()) def LIN(n:int): return [I() for _ in range(n)] def LLIN(n: int): return [LI() for _ in range(n)] def LLIN_(n: int): return [LI_() for _ in range(n)] def LLI(): return [list(map(int, l.split() )) for l in input()] def I(): return int(input()) def F(): return float(input()) def ST(): return input().replace('\n', '') def main(): N=I() L=LI() L.sort() ans = 0 for i in range(N): ans += L[2*i] print(ans) 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>
s137593252
p04047
Accepted
def examA(): N = I() L = LI() L.sort() ans = sum(L[::2]) print(ans) return def examB(): ans = 0 print(ans) return def examC(): ans = 0 print(ans) return def examD(): ans = 0 print(ans) return def examE(): ans = 0 print(ans) return def examF(): ans = 0 print(ans) return import sys,bisect,itertools,heapq,math,random from copy import deepcopy from heapq import heappop,heappush,heapify from collections import Counter,defaultdict,deque def I(): return int(sys.stdin.readline()) def LI(): return list(map(int,sys.stdin.readline().split())) def LSI(): return list(map(str,sys.stdin.readline().split())) def LS(): return sys.stdin.readline().split() def SI(): return sys.stdin.readline().strip() global mod,mod2,inf,alphabet,_ep mod = 10**9 + 7 mod2 = 998244353 inf = 10**18 _ep = 10**(-12) alphabet = [chr(ord('a') + i) for i in range(26)] sys.setrecursionlimit(10**6) if __name__ == '__main__': examA() """ """
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>
s241241334
p04047
Accepted
def main(): N = int(input()) L = [int(i) for i in input().split()] L.sort() print(sum(L[::2])) 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>
s631137672
p04047
Accepted
N = int(input()) L = list(map(int,input().split())) L.sort() ans = 0 for i in range(N): ans += L[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>
s087741032
p04047
Accepted
N = int(input()) L = [int(i) for i in 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>
s549856207
p04047
Accepted
#!/usr/bin/env python3 import sys # input = sys.stdin.readline def INT(): return int(input()) def MAP(): return map(int,input().split()) def LI(): return list(map(int,input().split())) def main(): N = INT() L = LI() L.sort() answer = 0 for i in range(N): answer += min(L[2*i],L[2*i+1]) print(answer) return 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>
s935782470
p04047
Accepted
n = int(input()) l = list(map(int, input().split())) l.sort() ans = sum(l[::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>
s744705043
p04047
Accepted
# -*- coding: utf-8 -*- import math import itertools import sys import copy #import numpy as np # 入力 #A, B, C, D = map(int, input().split()) #L = list(map(int, input().split())) #S = list(str(input())) #N = int(input()) #S = str(input()) N = int(input()) L = list(map(int, input().split())) L.sort() ans = 0 for i in range(0, N*2, 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>
s701014442
p04047
Accepted
N = int(input()) L_li = list(map(int, input().split())) L_li.sort() ans = 0 for i in range(0, 2 * N, 2): ans += L_li[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>
s096096910
p04047
Accepted
def main(): n = int(input()) l = list(map(int, input().split())) l.sort(reverse=True) ans = 0 for i in range(1, 2*n, 2): ans += l[i] print(ans) 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>
s744518769
p04047
Accepted
N,*L=map(int, open(0).read().split()) L=sorted(L) print(sum(map(min, L[::2], L[1::2])))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s687763758
p04047
Accepted
N = int(input()) L = input().split(" ") for i in range(0, len(L)): L[i] = int(L[i]) L.sort() ans = 0 for i in range(0, len(L), 2): tmp = L[i] if tmp > L[i+1]: tmp = L[i+1] ans += tmp print(ans)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s920278660
p04047
Accepted
n = int(input()) l = sorted(map(int,input().split())) 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>
s365570193
p04047
Accepted
n = int(input()) l = [int(i) for i in 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>
s268428801
p04047
Accepted
n = int(input()) l = sorted(list(map(int, input().split()))) ans = 0 for i in range(0,n*2,2): ans += min(l[i],l[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>
s523183659
p04047
Accepted
N = int(input()) L = list(map(int,input().split())) ans = 0 L.sort() L.reverse() for i in range(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>
s451005184
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort() ans = 0 for i in range(2*N): if i % 2 == 0: # print(i) 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>
s892517527
p04047
Accepted
from sys import stdin point = 0 n = int(stdin.readline().rstrip()) li = list(map(int,stdin.readline().rstrip().split())) li.sort() for i in range(n): point += min(li[2*i],li[2*i+1]) print(point)
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>
s316774191
p04047
Accepted
n = int(input()) li_l = list(map(int, input().split())) print(sum(sorted(li_l, reverse=True)[1::2]))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s931877360
p04047
Accepted
N = int(input()) Llist = sorted(list(map(int, input().split())))[::-1] ans = 0 for i in range(0, 2*N, 2): ans += min(Llist[i], Llist[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>
s854903812
p04047
Accepted
N=int(input()) L=list(map(int,input().split())) L.sort() c=0 for i in range(N): c=c+min(L[2*i],L[2*i+1]) print(c)
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>
s383270144
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>
s000612049
p04047
Accepted
N = int(input()) L = sorted(list(map(int,input().split()))) print(sum(i for i in 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>
s112795655
p04047
Accepted
# --*-coding:utf-8-*-- N = int(input()) L = sorted(map(int, input().split())) print(sum(min(L[2*i], L[2*i+1]) 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>
s469450987
p04047
Accepted
n = int(input()) ls = list(map(int, input().split())) ls.sort(reverse=True) ans = 0 for i in range(n): ans += ls[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>
s543151878
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>
s932976667
p04047
Accepted
def main(): N = int(input()) L = sorted(list(map(int,input().split()))) LL = [L[i] for i in range(2*N) if i%2 == 0] print(sum(LL)) 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>
s298881981
p04047
Accepted
n=int(input()) x=input().split() l=[] for k in range(2*n): l.append(int(x[k])) l.sort() s=0 for k in range(2*n): if k%2==0: s+=l[k] 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>
s154691539
p04047
Accepted
n = int(input()) a = list(map(int, input().split())) a.sort() res = 0 for i in range(0, 2*n, 2): res += min(a[i], a[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>
s863917164
p04047
Accepted
try: N = int(input()) a = map(int, input().split()) a_ = sorted(a, reverse=True) b = [] for i in range(len(a_)): if i%2!=0: b.append(a_[i]) print(sum(b)) except EOFError: pass
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>
s350528845
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L = sorted(L) sum_L = 0 for i in range(0, 2*N, 2): sum_L += L[i] print(sum_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>
s599952088
p04047
Accepted
n = int(input()) l = [int(_) for _ in input().split()] l.sort() ans = 0 for i in range(0, 2*n-1, 2): ans += min(l[i], l[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>
s948540662
p04047
Accepted
def solve(n, L): L.sort() return sum(min(L[2 * i], L[2 * i + 1]) for i in range(n)) _n = int(input()) _L = list(map(int, input().split())) print(solve(_n, _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>
s341577882
p04047
Accepted
import sys input = sys.stdin.buffer.readline def main(): N = int(input()) A = list(map(int,input().split())) A.sort() ans = 0 for i in range(N): ans += A[2*i] print(ans) 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>
s972505598
p04047
Accepted
N = int(input()) li = list(map(int, input().split())) li.sort() P = 0 for i in range(N): P += li[i*2] print(P)
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>
s433415845
p04047
Accepted
input() print(sum(sorted(map(int, 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>
s683801773
p04047
Accepted
n = int(input()) l = list(map(int,input().split())) l.sort() a = [] for i in range(2*n): if i % 2 == 0: a.append(l[i]) #print(a) print(sum(a))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s700935546
p04047
Accepted
n = int(input()) ll = list(map(int,input().split())) ll = sorted(ll) ans = 0 for i in range(n): ans += ll[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>
s785934790
p04047
Accepted
n = int(input()) x = sorted(list(map(int, input().split()))) ans = 0 for i in range(0, 2*n, 2): ans += x[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>
s284056549
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>
s014097005
p04047
Accepted
n=int(input()) a=list(map(int,input().split())) a.sort() ans = 0 for i in range(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>
s137074558
p04047
Accepted
def main(n: int, l: list): ans = 0 l.sort(reverse=True) for _ in range(n): a, b = l.pop(), l.pop() ans += a print(ans) if __name__ == "__main__": n = int(input()) l = list(map(int, input().split())) main(n, 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>
s823735941
p04047
Accepted
n=int(input()) a=[int(x) for x in input().split()] a.sort() ss=0 for i in range(0,len(a),2): ss+=min(a[i:i+2]) print(ss)
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>