submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s359082201
p04047
Accepted
import sys input = sys.stdin.readline def main(): N = int(input()) l = sorted(list(map(int, input().split())), reverse=True) ans = 0 for i in range(0, N*2, 2): ans += min(l[i], l[i+1]) 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>
s437877465
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>
s649871940
p04047
Accepted
n = 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>
s185878365
p04047
Accepted
n=int(input()) print(sum(sorted(list(map(int,input().split())))[0::2]))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s611017991
p04047
Accepted
n = int(input()) l = list(map(int,input().split(" "))) l.sort() ans = int(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>
s967749220
p04047
Accepted
n=int(input()) L=sorted(list(map(int, input().split()))) all_sum=0 for i in range(0,2*n,2): all_sum+=L[i] print(all_sum)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s214212918
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>
s480172327
p04047
Accepted
N=input() L=list(map(int,input().split())) items=0 while(L): if L[0]<L[1] : s_lg=L[0] lg=L[1] else: s_lg=L[1] lg=L[0] if len(L)>2: for i in range(2,len(L)) : if L[i]>=lg: s_lg=lg lg=L[i] elif L[i]>=s_lg : s_lg=L[i] items=items+s_lg L.remove(s_lg) L.remove(lg) print(items)
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>
s405474082
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort() s = 0 for i in range(len(L) // 2): s += L[i * 2] 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>
s295743412
p04047
Accepted
n = int(input()) l = list(map(int, input().split())) l.sort(reverse=True) ans = 0 for i in range(0, n*2, 2): ans += min(l[i:i+2]) print(ans)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s278943383
p04047
Accepted
def main(): N = int(input()) L = list(map(int, input().split())) L.sort(reverse = True) ans = 0 for i in range(N): ans += L[2*i+1] return ans if __name__ == '__main__': print(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>
s753477457
p04047
Accepted
n = int(input()) l = list(map(int, input().split())) l = sorted(l) lSum = 0 for i in range(n): lSum += min(l[2 * i], l[2 * i + 1]) print(lSum)
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>
s002498236
p04047
Accepted
import numpy as np n = int(input()) l = sorted([int(i) for i in input().split()]) l = np.array(l) print(np.sum(l[np.arange(0,2*n,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>
s920935769
p04047
Accepted
n = int(input()) l = sorted(list(map(int, input().split())), reverse=True) t = 0 for i in range(1, n * 2, 2): t += min(l[i], l[i-1]) print(t)
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>
s536262722
p04047
Accepted
import numpy as np a = input() c = input().split() d = [int(i) for i in c] d.sort() print(sum(d[0::2]))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s574810947
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>
s454520092
p04047
Accepted
N = int(input()) L = sorted(list(map(int,input().split()))) ans = 0 for i in range(2*N): if i % 2 == 1: continue else: 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>
s990053014
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): 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>
s467278053
p04047
Accepted
n = int(input()) a = list(map(int, input().split())) a.sort() ans = 0 for i in range(2*n): if not i&1: 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>
s714719754
p04047
Accepted
N = int(input()) L = list(map(int,input().split())) L.sort() #print(L) 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>
s977326568
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>
s019655695
p04047
Accepted
import sys input=sys.stdin.readline N = int(input()) L = list(map(int, input().split())) L.sort() 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>
s008885008
p04047
Accepted
n = int(input()) L = list(map(int, input().split())) L = sorted(L) 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>
s323642640
p04047
Accepted
n = int(input()) l = sorted(list(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>
s105052539
p04047
Accepted
_,a=open(0);print(sum(sorted(map(int,a.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>
s970290919
p04047
Accepted
n = int( input() ) l = list( map( int, input().split() ) ) l.sort() sum = 0 for i in range( 0, 2*n, 2 ) : sum += l[i] print( sum )
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s321365190
p04047
Accepted
# 2019/08/15 n=2*int(input()) l=sorted(list(map(int,input().split()))) cnt=0 for i in range(0,n,2): cnt+=min(l[i],l[i+1]) 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>
s378750090
p04047
Accepted
x=input() y = sorted(list(map(int, input().split()))) i=1 z=0 for i in range(int(len(y)/2)): z+=y[-2*i] i+=1 print(z)
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>
s203597616
p04047
Accepted
#!/usr/bin/env python3 import sys, math, fractions, itertools def solve(N: int, L: "List[int]"): L = sorted(L) res = 0 for i in range(N): res += min(L[2*i], L[2*i+1]) print(res) return # Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() N = int(next(tokens)) # type: int L = [ int(next(tokens)) for _ in range(2*N) ] # type: "List[int]" solve(N, L) 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>
s081595892
p04047
Accepted
n = int(input()) L = list(map(int, input().split())) L.sort() array_L = [] for m in [i * 2 for i in range(n)]: array_L.append(L[m]) print(sum(array_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>
s565344467
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>
s370094681
p04047
Accepted
n = int(input()) l = list(map(int, input().split())) l = sorted(l, reverse=True) t = 0 for i in range(1, n * 2, 2): t += min(l[i], l[i-1]) print(t)
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>
s094761049
p04047
Accepted
n = int(input()) a = list(map(int, input().split())) ans = 0 a.sort(reverse=True) for i in range(1,n+1): ans += a[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>
s271970493
p04047
Accepted
n = int(input()) lst = list(map(int,input().split())) lst.sort() s = sum(lst[0::2]) 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>
s468046015
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) ans = 0 L.sort(reverse=True) for i in range(N): ans += min(L[2*i], L[2*i+1]) 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>
s682940463
p04047
Accepted
input();print(sum(sorted(list(map(int,input().split())))[0::2]))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s286041689
p04047
Accepted
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>
s511886497
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort() ans = [] for i in range(0, 2*N, 2): ans.append(L[i]) 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>
s728769738
p04047
Accepted
n = int(input()) l = list(map(int,input().split())) l = sorted(l) 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>
s977640829
p04047
Accepted
n=int(input()) l=list(map(int,input().split())) l.sort() l.reverse() 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>
s093996612
p04047
Accepted
n = int(input()) l = list(map(int, input().split())) l.sort() print(sum([l[i] for i in range(2*n) if i % 2 == 0]))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s834184018
p04047
Accepted
# coding: utf-8 # Your code here! n = int(input()) l = list(map(int, input().split())) l.sort() ans = 0 for i in range(2 * n): 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>
s422542835
p04047
Accepted
n=int(input()) l=[int(i) for i in input().split()] l.sort() a=0 for i in range(n): a+=l[i*2] print(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>
s017090555
p04047
Accepted
a = int(input()) b = list(map(int, input().split())) b = sorted(b, reverse=True) c = 0 for i in range(1, len(b), 2): c += min(b[i], b[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>
s808121460
p04047
Accepted
n = int(input()) ls = sorted(list(map(int, input().split()))) total = 0 for i in range(n): total += min(ls[2*i], ls[2*i+1]) print(total)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s491200409
p04047
Accepted
# AGC001A - BBQ Easy def main(): n = int(input()) L = sorted(map(int, input().rstrip().split())) 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>
s065183137
p04047
Accepted
n=int(input()) l=sorted(list(map(int, input().split()))) ll=l[::2] print(sum(ll))
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>
s335888062
p04047
Accepted
a = int(input()) b = list(map(int, input().split())) b = sorted(b, reverse=True) c = 0 d = 0 for i in range(1, len(b), 2): c += min(b[i], b[i-1]) d += 1 if d == a: break 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>
s190065356
p04047
Accepted
n = int(input()) l = list(map(int,input().split())) l.sort() x = 0 for i in range(0,n): x += min(l[2*i],l[2*i+1]) print(x)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s366913334
p04047
Accepted
import logging logging.basicConfig(level=logging.INFO, format="%(message)s") #logging.disable(logging.CRITICAL) def main(): N = int(input()) L_1 = list(map(int, input().split())) L_1.sort() logging.info(L_1) print(sum(L_1[::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>
s514489106
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>
s043616475
p04047
Accepted
def main(): num = int(input()) data = list(map(int, input().split())) data.sort() ans = sum(data[::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>
s238898361
p04047
Accepted
def MI(): return map(int,input().split()) def I(): return int(input()) def LI(): return [int(i) for i in input().split()] n=I() a=LI() a.sort() ans=0 for i in range(n): ans+=min(a[2*i],a[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>
s267813189
p04047
Accepted
n=int(input()) l=list(map(int,input().split())) l=sorted(l,reverse=True) 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>
s149968540
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>
s080639587
p04047
Accepted
n = int(input())*2 arr = list(map(int, input().split())) arr = sorted(arr) sum = 0 for i in range(0,n,2): sum += arr[i] print(sum)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s683141531
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort() ans = 0 for i in range(0, len(L), 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>
s261039339
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>
s378557202
p04047
Accepted
def main(): N = int(input()) L = list(map(int, input().split())) L = sorted(L) 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>
s674375561
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) vlist = [] ans = 0 for i in range(N): a = max(L) L.remove(a) b = max(L) L.remove(b) if a < b: vlist.append(a) else: vlist.append(b) for i in range(N): ans += vlist[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>
s622968492
p04047
Accepted
n = int(input()) l = [int(x) for x in input().split()] l.sort() print(sum(l[0::2]))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s579025556
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>
s889800320
p04047
Accepted
X = int(input()) L = list(map(int,input().split())) L.sort() ans = 0 for i in range(X): 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>
s526809242
p04047
Accepted
n = input() l = list(map(int, input().split())) def bubble_sort(arr): change = True while change: change = False for i in range(len(arr) - 1): if arr[i] > arr[i + 1]: arr[i], arr[i + 1] = arr[i + 1], arr[i] change = True return arr ans=[] L= bubble_sort(l) k=0 for i in range(0,len(l),2): k=k+L[i] print(k)
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>
s220489988
p04047
Accepted
# coding: utf-8 # Your code here! N = int(input()) a = sorted(list(map(int, input().split()))) ctr = 0 for i in range(N * 2): if i % 2 == 0: ctr += a[i] print(ctr)
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>
s490199843
p04047
Accepted
import numpy as np N =int(input()) input_line2 =(input()) kushisashi_number = list(map(int,np.zeros(N))) no_kushi = int(N)*2 kushi_length = list(map(int,input_line2.split())) kushisashi=sorted(kushi_length,reverse=True) for n in range(N): kushisashi_number[n] = kushisashi[2*n+1] print(sum(kushisashi_number))
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>
s406281240
p04047
Accepted
n=int(input()) x=sorted(list(map(int,input().split()))) s=0 for i in range(n): s+=x[i*2] 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>
s118992891
p04047
Accepted
n = int(input()) l = sorted(list(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>
s990239894
p04047
Accepted
N = int(input()) L = sorted([int(i) for i in 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>
s827146552
p04047
Accepted
import sys input = sys.stdin.readline n = int(input()) l = list(map(int, input().split())) sum = 0 l.sort() for i in range(n): sum += l[2*i] print(sum)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s527071169
p04047
Accepted
n = int(input()) l = list(map(int,input().split())) l.sort() ans = 0 for i in l[::2]: ans +=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>
s761578572
p04047
Accepted
N = int(input()) L = list(map(int,input().split())) L.sort() ans = 0 i = 0 while(i<2*N): ans += L[i] i += 2 print(ans)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s062267832
p04047
Accepted
n=int(input()) l=list(map(int,input().split())) l=sorted(l) s=0 for i in range(len(l)): if i%2==0:s+=l[i] print(s)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s004636450
p04047
Accepted
n = input() a = sorted(list(map(int, input().split()))) ans = 0 for i in range(0, len(a), 2): ans += a[i] print(ans)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s236445083
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>
s060534058
p04047
Accepted
a = int(input()) b = list(map(int, input().split())) b.sort() c = 0 for i in range(len(b)-1, 0, -2): c += min(b[i], b[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>
s083671591
p04047
Accepted
N = int(input()) * 2 Ls= list(map(int,input().split(" "))) Ls.sort() ans = 0 for i in range(0,N,2): ans+= Ls[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>
s530761163
p04047
Accepted
wood = input() lis_1 = list(map(int,input().split())) lis_1.sort() guzai = 0 for i in range(int(wood)): max_gu = min(lis_1[2*i],lis_1[2*i+1]) guzai += int(max_gu) print(guzai)
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>
s313656070
p04047
Accepted
N = input() Inp = list(input().split()) Inp = [int(i) for i in Inp] Inp.sort() ans = 0 for i in range(0,len(Inp),2) : kushi = [int(Inp[i]),int(Inp[i+1])] ans += min(kushi) 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>
s924701019
p04047
Accepted
n=int(input()) k=list(map(int,input().split())) k.sort() print(sum(k[::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>
s564692175
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>
s452761165
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort() print(sum(L[0::2]))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s024767573
p04047
Accepted
N = int(input()) length = sorted(list(map(int, input().split()))) ans = 0 for i in range(N): ans += length[(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>
s780116805
p04047
Accepted
n = int(input()) num_list = [ int(v) for v in input().split() ] print(sum(sorted(num_list)[::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>
s343719767
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>
s194982686
p04047
Accepted
N = int(input()) *L, = map(int, input().split()) L = sorted(L) 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>
s517054406
p04047
Accepted
n = int(input()) l = [int(i) for i in input().split()] l.sort() print(sum([l[i] for i in range(len(l)) if i%2 == 0]))
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s574027848
p04047
Accepted
N = int(input()) L = sorted(list(map(int,input().split()))) 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>
s526971280
p04047
Accepted
N = int(input()) L = sorted(list(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>
s211349886
p04047
Accepted
N = int(input()) L = [int(x) for x in 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>
s813502878
p04047
Accepted
N = [int(v) for v in input().split()] L = [int(v) for v in input().split()] L.sort() L_even=L[0::2] goukei=sum(L_even) print(str(goukei))
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>
s678532256
p04047
Accepted
N = int(input()) L = list(map(int, input().split())) L.sort(reverse = True) sum = 0 for i in range(0, N): sum += L[2*i+1] print(sum)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s731818535
p04047
Accepted
def BBQ_easy(N: int, L: list)->int: L.sort() return sum(L[0::2]) if __name__ == "__main__": N = int(input()) L = [int(s) for s in input().split()] ans = BBQ_easy(N, L) 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>
s968220157
p04047
Accepted
N = int(input()) L = [int(x) for x in input().split()] L.sort() answer = sum(L[::2]) print(answer)
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>
s632559656
p04047
Accepted
n = int(input()) l = list(map(int,input().split())) l = sorted(l) 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>
s550097702
p04047
Accepted
###template### import sys def input(): return sys.stdin.readline().rstrip() def mi(): return map(int, input().split()) ###template### N = int(input()) Ks = sorted(list(mi()), reverse=True) i = 0 ans = 0 while i < (2*N): ans += min(Ks[i],Ks[i+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>
s149817137
p04047
Accepted
N=int(input()) L=list(map(int,input().split())) L.sort() S=0 for i in L[::2]: S=S+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>
s892460810
p04047
Accepted
n = int(input()) l = list(map(int, input().split())) ans = 0 l.sort() 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>
s427633441
p04047
Accepted
a = int(input()) b = list(map(int,input().split())) b = sorted(b) c = 0 for i in range(0,2*a,2): c += b[i] 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>
s499486351
p04047
Accepted
# -*- coding: utf-8 -*- """ A - BBQ Easy https://atcoder.jp/contests/agc001/tasks/agc001_a """ import sys def solve(N, L): ans = 0 while L: a = L.pop() b = L.pop() ans += min(a, b) return ans def main(args): N = int(input()) L = sorted(map(int, input().split())) ans = solve(N, L) print(ans) if __name__ == '__main__': main(sys.argv[1:])
2 1 3 1 2
3
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke is having a barbeque party.</p> <p>At the party, he will make <var>N</var> servings of <em>Skewer Meal</em>.</p> <div style="text-align: center;"> <img src="https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png"> <p>Example of a serving of Skewer Meal</p> </img></div> <p>He has a stock of <var>2N</var> skewers, all of which will be used in Skewer Meal. The length of the <var>i</var>-th skewer is <var>L_i</var>. Also, he has an infinite supply of ingredients.</p> <p>To make a serving of Skewer Meal, he picks <var>2</var> skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be <var>x</var>, then the serving can hold the maximum of <var>x</var> ingredients.</p> <p>What is the maximum total number of ingredients that his <var>N</var> servings of Skewer Meal can hold, if he uses the skewers optimally?</p> </section> </div> <div class="part"> <section> <h3>Constraints</h3><ul> <li><var>1≦N≦100</var></li> <li><var>1≦L_i≦100</var></li> <li>For each <var>i</var>, <var>L_i</var> is an integer.</li> </ul> </section> </div> <hr/> <div class="io-style"> <div class="part"> <section> <h3>Input</h3><p>The input is given from Standard Input in the following format:</p> <pre><var>N</var> <var>L_1</var> <var>L_2</var> <var>...</var> <var>L_{2N}</var> </pre> </section> </div> <div class="part"> <section> <h3>Output</h3><p>Print the maximum total number of ingredients that Snuke's <var>N</var> servings of Skewer Meal can hold.</p> </section> </div> </div> <hr/> <div class="part"> <section> <h3>Sample Input 1</h3><pre>2 1 3 1 2 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 1</h3><pre>3 </pre> <p>If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold <var>1</var> and <var>2</var> ingredients, for the total of <var>3</var>.</p> </section> </div> <hr/> <div class="part"> <section> <h3>Sample Input 2</h3><pre>5 100 1 2 3 14 15 58 58 58 29 </pre> </section> </div> <div class="part"> <section> <h3>Sample Output 2</h3><pre>135 </pre></section> </div> </span>