output_description
stringlengths
15
956
submission_id
stringlengths
10
10
status
stringclasses
3 values
problem_id
stringlengths
6
6
input_description
stringlengths
9
2.55k
attempt
stringlengths
1
13.7k
problem_description
stringlengths
7
5.24k
samples
stringlengths
2
2.72k
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s349630714
Wrong Answer
p03852
The input is given from Standard Input in the following format: c
print(["consonant", "vowel"][96 < ord(input()) < 102])
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s528845628
Runtime Error
p03852
The input is given from Standard Input in the following format: c
N = input() if N in "aiueo" print("vowel") else print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s048224501
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() print("vowel"if c=='a','i','u','e','o' else "constant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s000524336
Runtime Error
p03852
The input is given from Standard Input in the following format: c
N = input() if a,e,i,o,u in N print("vowel") else print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s360355887
Runtime Error
p03852
The input is given from Standard Input in the following format: c
H, W = list(map(int, input().split())) for i in range(H): C = input() print(C) print(C)
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s366785224
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() if c="a" or c= 'e' or c="o" or c="i" or c="u": print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s851280803
Runtime Error
p03852
The input is given from Standard Input in the following format: c
s = input() vowels=['a','i','u','e','o'] if s[0]\invowels: print('vowel') else: print('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s063998382
Runtime Error
p03852
The input is given from Standard Input in the following format: c
s = input() if s == 'a' or s == 'i' s == 'u' s == 'e' s == 'o' : print('vowel') else: print('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s976377811
Runtime Error
p03852
The input is given from Standard Input in the following format: c
i = input() if i = a : print("vowel") elif i = i: print("vowel") elif i = u: print("vowel") elif i = e: print("vowel") elif i = o: print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s359969116
Runtime Error
p03852
The input is given from Standard Input in the following format: c
i = int(input()) if i = a : print("vowel") elif i = i: print("vowel") elif i = u: print("vowel") elif i = e: print("vowel") elif i = o: print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s948506503
Runtime Error
p03852
The input is given from Standard Input in the following format: c
a=["eraser","erase","dreamer","dream"] s=input() for i in range(4): s=s.replace(a[i],"") if s="": print("YES") else: print("NO")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s868599476
Accepted
p03852
The input is given from Standard Input in the following format: c
print("vowel" if input() in ("a", "i", "u", "e", "o") else "consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s184472662
Wrong Answer
p03852
The input is given from Standard Input in the following format: c
print("vowel" if (input() == ("a" or "e" or "i" or "o" or "u")) else "consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s161101764
Runtime Error
p03852
The input is given from Standard Input in the following format: c
s = input() if s == ("a" or "i" or "u" or "e" or "o"): print("vowel"): else: print("constant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s654131443
Runtime Error
p03852
The input is given from Standard Input in the following format: c
N, K, L = map(int, input().split()) D = [list(map(int, input().split())) for _ in range(K)] T = [list(map(int, input().split())) for _ in range(L)] # print(N,K,L,D,T) list_D = [set([i]) for i in range(N)] list_T = [set([i]) for i in range(N)] root_D = [i for i in range(N)] root_T = [i for i in range(N)] # print(list_D) for d in D: d0 = d[0] - 1 d1 = d[1] - 1 r0 = root_D[d0] r1 = root_D[d1] a = list_D[r0] b = list_D[r1] c = a | b list_D[r0] = c root_D[r1] = r0 root_D[d1] = r0 # print(list_D, root_D) for t in T: t0 = t[0] - 1 t1 = t[1] - 1 r0 = root_T[t0] r1 = root_T[t1] a = list_T[r0] b = list_T[r1] c = a | b list_T[r0] = c root_T[r1] = r0 root_T[t1] = r0 # print(list_T, root_T) # 和集合 res = [0] * N for i in range(N): rd = root_D[i] rt = root_T[i] d = list_D[rd] t = list_T[rt] res[i] = len(d & t) # print(*(res[i] for i in range(N))) print(" ".join([str(i) for i in res]))
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s462058267
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c = input() if c in ['a', 'i', 'u', 'e', 'o']: print('vowel') else print('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s113036873
Runtime Error
p03852
The input is given from Standard Input in the following format: c
N, K, L = map(int, input().split()) par = list(range(N + 1)) rank = [0] * (N + 1) cnt = [1] * (N + 1) def root(x): if par[x] == x: return x else: par[x] = root(par[x]) return par[x] def same(x, y): return root(x) == root(y) def unite(x, y): xr = root(x) yr = root(y) if xr == yr: return if rank[xr] < rank[yr]: par[xr] = yr else: par[yr] = xr if rank[xr] == rank[yr]: rank[xr] += 1 for _ in range(K): x, y = map(int, input().split()) unite(x, y) par_r = par[:] par = list(range(N + 1)) for _ in range(L): x, y = map(int, input().split()) unite(x, y) ans = [1] * (N) r_dict = {} for i in range(1, N + 1): if (par_r[i], par[i]) in r_dict: r_dict[(par_r[i], par[i])] += 1 else: r_dict[(par_r[i], par[i])] = 1 ans = [] for i in range(1, N + 1): ans.append(r_dict[(par_r[i], par[i])]) print(" ".join(map(str, ans)))
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s028542913
Runtime Error
p03852
The input is given from Standard Input in the following format: c
s= input() u= s[::-1] k=["resare","esare","remaerd","maerd"] l=u.replace("resare","") d=l.replace("esare","") h=d.replace("remaerd","") w=h.replace("maerd","") print(w) if w="": print("Yes") else: print("No")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s969064190
Accepted
p03852
The input is given from Standard Input in the following format: c
print("vowel" if str(input()) in ["a", "e", "i", "o", "u"] else "consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s966417209
Accepted
p03852
The input is given from Standard Input in the following format: c
print("vowel") if list("aiueo").count(input()) != 0 else print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s165555176
Accepted
p03852
The input is given from Standard Input in the following format: c
print(["consonant", "vowel"][input() in ["a", "e", "i", "o", "u"]])
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s177512478
Accepted
p03852
The input is given from Standard Input in the following format: c
print("cvoonwseoln a n t"[len(set(["a", "i", "u", "e", "o", input()])) == 5 :: 2])
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s655671404
Accepted
p03852
The input is given from Standard Input in the following format: c
s, c = "aiueo", input() print("vowel") if s.count(c) else print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s617018137
Accepted
p03852
The input is given from Standard Input in the following format: c
print("vowel" if input() in list("aeiou") else "consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s684947967
Runtime Error
p03852
The input is given from Standard Input in the following format: c
グリコ森永事件【完全永久保存版】
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s436544326
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() print(vowel) if "a","i","u","e","o" in c else print(consonant)
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s418385699
Runtime Error
p03852
The input is given from Standard Input in the following format: c
a = input() if a=='a' || a=='e' || a=='i' || a == 'o' || a == 'u': print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s057727252
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c = input('') if c = a: print('vowel') elif c = e: print('vowel') elif c = i: print('vowel') elif c = o: print('vowel') elif c = u: print('vowel') else: print('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s861674865
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c = input() msg = 'vowel' if ((c == 'a') or (c == 'i') or (c == 'u') or (c == 'e') or (c == 'o')) else 'consonant': print(msg)
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s013913914
Runtime Error
p03852
The input is given from Standard Input in the following format: c
a = input() if ((a == "a") or (a == "i") or (a == "u") or (a == "o") or (a == "e")) print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s170088932
Wrong Answer
p03852
The input is given from Standard Input in the following format: c
S = input() n = 0 # print(S) while S[:] != S[:n]: if S[n : n + 7] == "dreamer" and S[n : n + 8] != "dreamera": n += 7 # dreamer elif S[n : n + 5] == "dream": n += 5 # dream elif S[n : n + 5] == "erase" and S[n + 6] != "eraser": n += 5 # erase elif S[n : n + 6] == "eraser": n += 6 # eraser # elif S[:]==S[:n-1]: # print("YES") # exit() else: print("NO") exit() else: print("YES")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s386857616
Runtime Error
p03852
The input is given from Standard Input in the following format: c
h, w = map(int, input().split()) c = [input() for i in range(h)] for i in c: print(i) print(i)
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s403504844
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c = input() if c == "a", "i", "u", "e", "o": print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s348879700
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() if c='a' or c='i' or c='u' or c='e' or c='o': print(vowel) else: print(consonant)
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s073297900
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c = input() if c == ('a','i','u','e','o') print('vowel') else : print('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s600214336
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c = input() print("vowel" if c = "a" or c = "i" or c = "u" or c = "e" or c = "o" else "consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s578869876
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() if c=a or c=e or c=i or c=o or c=u print("vowel") else print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s442638902
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c = input() if c = "a" or "i" or "u" or "e" or "o": print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s782757517
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() if c='a' or c='i' or c='u' or c='e' or c='o': print('vowel') else: print('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s786777157
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() if c == "a" = "i" = "u" = "e" = "o": print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s112903440
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() if c=a or c=e or c=i or c=o or c=u : print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s936004456
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=int(input()) if c in "a","i","u","e","o" print("vowel") else : print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s013567572
Accepted
p03852
The input is given from Standard Input in the following format: c
print(["consonant", "vowel"][input() in "aiueo"])
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s396371946
Accepted
p03852
The input is given from Standard Input in the following format: c
print("vowel") if input() in ["a", "i", "u", "e", "o"] else print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s196157118
Accepted
p03852
The input is given from Standard Input in the following format: c
print(["consonant", "vowel"][input() in ["a", "i", "u", "e", "o"]])
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s092047611
Wrong Answer
p03852
The input is given from Standard Input in the following format: c
print("vowel" if "aiueo".find(input()) > 0 else "consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s132081166
Wrong Answer
p03852
The input is given from Standard Input in the following format: c
print("vowel" if input() in ["a", "e", "i", "o", "u"] else "constant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s834659641
Wrong Answer
p03852
The input is given from Standard Input in the following format: c
print(["vowel", "consonant"][not input("c") in ["a", "e", "i", "o", "u"]])
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s528917968
Wrong Answer
p03852
The input is given from Standard Input in the following format: c
print(["onsonant", "vowelc"][input() in ["a", "i", "u", "e", "o"]])
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s589058176
Wrong Answer
p03852
The input is given from Standard Input in the following format: c
print("vowel" if input() in "auiou" else "consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s815225079
Wrong Answer
p03852
The input is given from Standard Input in the following format: c
print("vowel" if input in ["aeiou"] else "consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s834616673
Runtime Error
p03852
The input is given from Standard Input in the following format: c
print("vowel" if c in "aeiou" else "consonant"))
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s443777586
Runtime Error
p03852
The input is given from Standard Input in the following format: c
rint("vowel") if input() in "aeiouAEIOU" else print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s411941032
Wrong Answer
p03852
The input is given from Standard Input in the following format: c
print(["vowel", "consonant"][not input("c") in "aeiou"])
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s984404176
Runtime Error
p03852
The input is given from Standard Input in the following format: c
if input() in ['a','e','i','o','u'] print('vowel') else print('constant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s874701736
Runtime Error
p03852
The input is given from Standard Input in the following format: c
print("vowel" if input() in 'a','e','i','o','u' else ""consonant)
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s503034009
Wrong Answer
p03852
The input is given from Standard Input in the following format: c
# coding: utf-8 print(["vowel", "consonant"][input() in "aiueo"])
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s076346697
Runtime Error
p03852
The input is given from Standard Input in the following format: c
n = input() if 'n' in 'aiueo' print('vowel') else: print('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s759822145
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c = input() if c==a,i,u,e,o print(vowel) else print(consonant)
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s875980838
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() if c="a" or c="i" or c="u" or c="e" or c="o": print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s422585026
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() if c==a or c==i or c==u or c==e c==o: print('vowel') else: print('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s648472904
Runtime Error
p03852
The input is given from Standard Input in the following format: c
a=input() if a=='a' or a=='i' or a=='u' or a=='e' a=='o': print('vowel') else: print('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s025742355
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c = input() if c == 'a' ot c == 'i' or c == 'u' or c == 'e' or c == 'o': print('voel') else: print('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s579053412
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() if c="a" or c="i" or c="u" or c="e" or c="o": print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s036526435
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() if c=="a" or c=="e" or c=="i" or c=="o" or c=="u" : print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s644667944
Runtime Error
p03852
The input is given from Standard Input in the following format: c
s =input() v = ['a','e','i','o','u'] for i in v: if s = i: print(vowel) else: print(consonant
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s850415046
Runtime Error
p03852
The input is given from Standard Input in the following format: c
x = input() if x == 'a' or x == 'i' or x == 'u' or x=='e' or x=='o': print ('vowel') else print ('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s053905251
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c=input() if c=='a' of c=='i' or c=='u' or c=='e' or c=='o': print('vowel') else: print('consonant')
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
If c is a vowel, print `vowel`. Otherwise, print `consonant`. * * *
s238481291
Runtime Error
p03852
The input is given from Standard Input in the following format: c
c = input() if c = "a" or c = "e" or c = "i" or c = "o" or c ="u": print("vowel") else: print("consonant")
Statement Given a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.
[{"input": "a", "output": "vowel\n \n\nSince `a` is a vowel, print `vowel`.\n\n* * *"}, {"input": "z", "output": "consonant\n \n\n* * *"}, {"input": "s", "output": "consonant"}]
Print N integers. The t-th (1 \le t \le N) of them should be the answer for the case K=t. * * *
s603423162
Accepted
p02890
Input is given from Standard Input in the following format: N A_1 A_2 \ldots A_N
import sys input = sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) """ とりあえず,数字ではなく,数字の出現回数C[i]を持つ. Kが変化すると色々と変わるので,Kごとに見ようとすると割と大変そう,1つのkごとにO(N)すらかけられない,というか計算大変そう. (カードがT種類あるとして,k>Tは全部0だったりする.Kの区間に対して一気に答えを出す方法はありそう.) 食べる回数をmとして,mごとに最大のKを求める. m回食べるということは,各数字につき最大m回までしか食べられないということ 食べられる枚数の総数はΣ(min(m,C[i])).このときの最大のKは,総数//m C[i]を昇順に並べておけば二分探索で min(m,C[i])=C[i]の範囲がわかり,累積和をとっておればこの区間の合計がO(1)で求まる """ def main(): import bisect N = I() A = LI() from collections import defaultdict dd = defaultdict(int) for i in range(N): dd[A[i]] += 1 L = [] for k, v in dd.items(): L.append(v) L.sort() nl = len(L) S = [0] * (nl + 1) for i in range(nl): S[i + 1] = S[i] + L[i] ans = [0] * (N + 1) for m in range(1, N + 1): temp = 0 num = bisect.bisect_left(L, m) temp += S[num] temp += (nl - num) * m maxk = temp // m ans[maxk] = max(ans[maxk], m) # print(m,temp,maxk) # print(ans) M = 0 for i in range(N, -1, -1): M = max(M, ans[i]) ans[i] = M for i in range(1, N + 1): print(ans[i]) main()
Statement Takahashi has N cards. The i-th of these cards has an integer A_i written on it. Takahashi will choose an integer K, and then repeat the following operation some number of times: * Choose exactly K cards such that the integers written on them are all different, and eat those cards. (The eaten cards disappear.) For each K = 1,2, \ldots, N, find the maximum number of times Takahashi can do the operation.
[{"input": "3\n 2 1 2", "output": "3\n 1\n 0\n \n\nFor K = 1, we can do the operation as follows:\n\n * Choose the first card to eat.\n * Choose the second card to eat.\n * Choose the third card to eat.\n\nFor K = 2, we can do the operation as follows:\n\n * Choose the first and second cards to eat.\n\nFor K = 3, we cannot do the operation at all. Note that we cannot choose the\nfirst and third cards at the same time.\n\n* * *"}, {"input": "5\n 1 2 3 4 5", "output": "5\n 2\n 1\n 1\n 1\n \n\n* * *"}, {"input": "4\n 1 3 3 3", "output": "4\n 1\n 0\n 0"}]
Print N integers. The t-th (1 \le t \le N) of them should be the answer for the case K=t. * * *
s306717902
Wrong Answer
p02890
Input is given from Standard Input in the following format: N A_1 A_2 \ldots A_N
import numpy as np np.count_nonzero
Statement Takahashi has N cards. The i-th of these cards has an integer A_i written on it. Takahashi will choose an integer K, and then repeat the following operation some number of times: * Choose exactly K cards such that the integers written on them are all different, and eat those cards. (The eaten cards disappear.) For each K = 1,2, \ldots, N, find the maximum number of times Takahashi can do the operation.
[{"input": "3\n 2 1 2", "output": "3\n 1\n 0\n \n\nFor K = 1, we can do the operation as follows:\n\n * Choose the first card to eat.\n * Choose the second card to eat.\n * Choose the third card to eat.\n\nFor K = 2, we can do the operation as follows:\n\n * Choose the first and second cards to eat.\n\nFor K = 3, we cannot do the operation at all. Note that we cannot choose the\nfirst and third cards at the same time.\n\n* * *"}, {"input": "5\n 1 2 3 4 5", "output": "5\n 2\n 1\n 1\n 1\n \n\n* * *"}, {"input": "4\n 1 3 3 3", "output": "4\n 1\n 0\n 0"}]
Print N integers. The t-th (1 \le t \le N) of them should be the answer for the case K=t. * * *
s758986671
Accepted
p02890
Input is given from Standard Input in the following format: N A_1 A_2 \ldots A_N
import collections import numpy as np # リストarrからx個の同じ長さの列を取り出す時の最大の長さ # 発想: x個取り出す時、ある文字をx個より多く取り出して列に含むことはない # 一方ある文字をその文字がある数よりも取り出して使うこともできない # つまり、min(arr.count(a), x)で、x個の同じ長さの列に使えるaの数がわかる # さらに、sum(min(arr.count(a),x))で、x個の同じ長さの列に使える文字の数がわかる # よって、sum(min(arr.count(a),x))//xで、x個の同じ長さの列の長さがわかる # 発展的に、longest(arr,x)までの計算状況からlongest(arr,x+1)が計算できる # def longest(arr, x): # legacy # return sum(min(arr.count(a), x) for a in arr) // x n = int(input()) a = list(map(int, input().split())) counter = collections.Counter(a) # O(n) nums = list(counter.values()) # O(n) num_counter = collections.Counter(nums) # O(n) lastest_add = np.count_nonzero(nums) # O(n) building, longests = [0], [0] for i in range(1, n + 1): # O(n) appended = building[-1] + lastest_add # O(1) building.append(appended) # O(1) longests.append(appended // i) # O(1) lastest_add -= num_counter[i] # O(1) lastest_longest = 0 k_most = [] for i, x in enumerate(reversed(longests)): while x > lastest_longest: lastest_longest += 1 k_most.append(n - i) k_most.extend([0] * (n - len(k_most))) # zero padding for longests_num in k_most: print(longests_num) # print('----------------') # for k in range(1, n+1): # maxindexes = list(i for i, x in enumerate(longests) if x >= k) # if maxindexes: # print(maxindexes[-1]) # else: # print(0)
Statement Takahashi has N cards. The i-th of these cards has an integer A_i written on it. Takahashi will choose an integer K, and then repeat the following operation some number of times: * Choose exactly K cards such that the integers written on them are all different, and eat those cards. (The eaten cards disappear.) For each K = 1,2, \ldots, N, find the maximum number of times Takahashi can do the operation.
[{"input": "3\n 2 1 2", "output": "3\n 1\n 0\n \n\nFor K = 1, we can do the operation as follows:\n\n * Choose the first card to eat.\n * Choose the second card to eat.\n * Choose the third card to eat.\n\nFor K = 2, we can do the operation as follows:\n\n * Choose the first and second cards to eat.\n\nFor K = 3, we cannot do the operation at all. Note that we cannot choose the\nfirst and third cards at the same time.\n\n* * *"}, {"input": "5\n 1 2 3 4 5", "output": "5\n 2\n 1\n 1\n 1\n \n\n* * *"}, {"input": "4\n 1 3 3 3", "output": "4\n 1\n 0\n 0"}]
Print N integers. The t-th (1 \le t \le N) of them should be the answer for the case K=t. * * *
s272223524
Accepted
p02890
Input is given from Standard Input in the following format: N A_1 A_2 \ldots A_N
from collections import Counter n = int(input()) a = list(map(int, input().split())) c = Counter(a) d = Counter(c.values()) dx = [0 for _ in range(n + 1)] for i in range(1, n + 1): dx[i] = dx[i - 1] + i * d[i] xdx = [0 for _ in range(n + 2)] xdx[n] = d[n] for i in range(n - 1, 0, -1): xdx[i] = xdx[i + 1] + d[i] res = [0] + [(dx[i] + i * xdx[i + 1]) // i for i in range(1, n + 1)] ans = [0 for _ in range(n)] cur = n for i in range(n): while cur > 0 and res[cur] < i + 1: cur -= 1 if cur > 0: ans[i] = cur print(*ans, sep="\n")
Statement Takahashi has N cards. The i-th of these cards has an integer A_i written on it. Takahashi will choose an integer K, and then repeat the following operation some number of times: * Choose exactly K cards such that the integers written on them are all different, and eat those cards. (The eaten cards disappear.) For each K = 1,2, \ldots, N, find the maximum number of times Takahashi can do the operation.
[{"input": "3\n 2 1 2", "output": "3\n 1\n 0\n \n\nFor K = 1, we can do the operation as follows:\n\n * Choose the first card to eat.\n * Choose the second card to eat.\n * Choose the third card to eat.\n\nFor K = 2, we can do the operation as follows:\n\n * Choose the first and second cards to eat.\n\nFor K = 3, we cannot do the operation at all. Note that we cannot choose the\nfirst and third cards at the same time.\n\n* * *"}, {"input": "5\n 1 2 3 4 5", "output": "5\n 2\n 1\n 1\n 1\n \n\n* * *"}, {"input": "4\n 1 3 3 3", "output": "4\n 1\n 0\n 0"}]
Print N integers. The t-th (1 \le t \le N) of them should be the answer for the case K=t. * * *
s270066161
Accepted
p02890
Input is given from Standard Input in the following format: N A_1 A_2 \ldots A_N
import bisect n = int(input()) k = sorted(map(int, input().split())) hist = [] count = 0 for i in range(n): count += 1 if i == n - 1 or k[i] != k[i + 1]: hist.append(count) count = 0 hist.sort() sumh = [0] for i in range(len(hist)): sumh.append(sumh[-1] + hist[i]) def ok(h, d): i = bisect.bisect_left(hist, h) s = sumh[i] + h * (len(hist) - i) return s >= h * d def binary_search(d): lo, hi = 0, n // d + 1 while hi - lo > 1: mid = (lo + hi) // 2 if ok(mid, d): lo = mid else: hi = mid return lo for d in range(1, n + 1): print(binary_search(d))
Statement Takahashi has N cards. The i-th of these cards has an integer A_i written on it. Takahashi will choose an integer K, and then repeat the following operation some number of times: * Choose exactly K cards such that the integers written on them are all different, and eat those cards. (The eaten cards disappear.) For each K = 1,2, \ldots, N, find the maximum number of times Takahashi can do the operation.
[{"input": "3\n 2 1 2", "output": "3\n 1\n 0\n \n\nFor K = 1, we can do the operation as follows:\n\n * Choose the first card to eat.\n * Choose the second card to eat.\n * Choose the third card to eat.\n\nFor K = 2, we can do the operation as follows:\n\n * Choose the first and second cards to eat.\n\nFor K = 3, we cannot do the operation at all. Note that we cannot choose the\nfirst and third cards at the same time.\n\n* * *"}, {"input": "5\n 1 2 3 4 5", "output": "5\n 2\n 1\n 1\n 1\n \n\n* * *"}, {"input": "4\n 1 3 3 3", "output": "4\n 1\n 0\n 0"}]
Print N integers. The t-th (1 \le t \le N) of them should be the answer for the case K=t. * * *
s384428079
Runtime Error
p02890
Input is given from Standard Input in the following format: N A_1 A_2 \ldots A_N
n = int(input()) l = list(map(int, input().split())) l.sort() while (l[-1] > l[-2] + l[-3]) and (len(l) > 3): del l[-1] n = len(l) ans = 0 i = 0 while i < n - 2: j = i + 1 while j < n - 1: k = j + 1 while k < n: if l[k] < l[i] + l[j]: ans = ans + 1 else: k = n k = k + 1 j = j + 1 i = i + 1 print(ans)
Statement Takahashi has N cards. The i-th of these cards has an integer A_i written on it. Takahashi will choose an integer K, and then repeat the following operation some number of times: * Choose exactly K cards such that the integers written on them are all different, and eat those cards. (The eaten cards disappear.) For each K = 1,2, \ldots, N, find the maximum number of times Takahashi can do the operation.
[{"input": "3\n 2 1 2", "output": "3\n 1\n 0\n \n\nFor K = 1, we can do the operation as follows:\n\n * Choose the first card to eat.\n * Choose the second card to eat.\n * Choose the third card to eat.\n\nFor K = 2, we can do the operation as follows:\n\n * Choose the first and second cards to eat.\n\nFor K = 3, we cannot do the operation at all. Note that we cannot choose the\nfirst and third cards at the same time.\n\n* * *"}, {"input": "5\n 1 2 3 4 5", "output": "5\n 2\n 1\n 1\n 1\n \n\n* * *"}, {"input": "4\n 1 3 3 3", "output": "4\n 1\n 0\n 0"}]
Print N integers. The t-th (1 \le t \le N) of them should be the answer for the case K=t. * * *
s322920763
Wrong Answer
p02890
Input is given from Standard Input in the following format: N A_1 A_2 \ldots A_N
import math import os import sys import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10**18 MOD = 10**9 + 7 def get_primes(max=None, count=None): """ 素数列挙 昇順にソートされています https://qiita.com/Ishotihadus/items/73e107271275611f05f2 :param int max: :param int count: :return: """ assert max or count if count: raise NotImplementedError() if max <= 1: return [] primes = [2] sieve = [False for _ in range(max + 1)] p = 3 while p <= max: primes.append(p) sieve[p] = True if p <= math.sqrt(max): for i in range(p * (p | 1), max + 1, p * 2): sieve[i] = True while p <= max and sieve[p]: p += 2 return primes N = int(sys.stdin.readline()) A = list(map(int, sys.stdin.readline().split())) primes = get_primes(max=N) def count(k): if memo[k]: bc, ret = memo[k] else: bc = np.bincount(A) bc.sort() bc = bc[np.searchsorted(bc, 1) :] bc = bc[::-1] ret = 0 while len(bc) >= k: bc[:k] -= 1 bc.sort() bc = bc[np.searchsorted(bc, 1) :] bc = bc[::-1] ret += 1 for p in primes: if p >= k: break if k % p == 0: memo[k // p] = bc, ret * (k // p) break return ret ans = [0] * N memo = [None for _ in range(N + 1)] for k in reversed(range(1, N + 1)): ans[k - 1] = count(k) print(*ans, sep="\n")
Statement Takahashi has N cards. The i-th of these cards has an integer A_i written on it. Takahashi will choose an integer K, and then repeat the following operation some number of times: * Choose exactly K cards such that the integers written on them are all different, and eat those cards. (The eaten cards disappear.) For each K = 1,2, \ldots, N, find the maximum number of times Takahashi can do the operation.
[{"input": "3\n 2 1 2", "output": "3\n 1\n 0\n \n\nFor K = 1, we can do the operation as follows:\n\n * Choose the first card to eat.\n * Choose the second card to eat.\n * Choose the third card to eat.\n\nFor K = 2, we can do the operation as follows:\n\n * Choose the first and second cards to eat.\n\nFor K = 3, we cannot do the operation at all. Note that we cannot choose the\nfirst and third cards at the same time.\n\n* * *"}, {"input": "5\n 1 2 3 4 5", "output": "5\n 2\n 1\n 1\n 1\n \n\n* * *"}, {"input": "4\n 1 3 3 3", "output": "4\n 1\n 0\n 0"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s004103608
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
N=int(input()) L=list(map(int,input().split())) L.sort() s=0 for i in range(N): s+=min(L[2i],L[2i+1]) print(s)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s386994291
Accepted
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math # from math import gcd import bisect from collections import defaultdict from collections import deque from collections import Counter from functools import lru_cache ############# # Constants # ############# MOD = 10**9 + 7 INF = float("inf") ############# # Functions # ############# ######INPUT###### def I(): return int(input().strip()) def S(): return input().strip() def IL(): return list(map(int, input().split())) def SL(): return list(map(str, input().split())) def ILs(n): return list(int(input()) for _ in range(n)) def SLs(n): return list(input().strip() for _ in range(n)) def ILL(n): return [list(map(int, input().split())) for _ in range(n)] def SLL(n): return [list(map(str, input().split())) for _ in range(n)] ######OUTPUT###### def P(arg): print(arg) return def Y(): print("Yes") return def N(): print("No") return def E(): exit() def PE(arg): print(arg) exit() def YE(): print("Yes") exit() def NE(): print("No") exit() #####Shorten##### def DD(arg): return defaultdict(arg) #####Inverse##### def inv(n): return pow(n, MOD - 2, MOD) ######Combination###### kaijo_memo = [] def kaijo(n): if len(kaijo_memo) > n: return kaijo_memo[n] if len(kaijo_memo) == 0: kaijo_memo.append(1) while len(kaijo_memo) <= n: kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD) return kaijo_memo[n] gyaku_kaijo_memo = [] def gyaku_kaijo(n): if len(gyaku_kaijo_memo) > n: return gyaku_kaijo_memo[n] if len(gyaku_kaijo_memo) == 0: gyaku_kaijo_memo.append(1) while len(gyaku_kaijo_memo) <= n: gyaku_kaijo_memo.append( gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo), MOD - 2, MOD) % MOD ) return gyaku_kaijo_memo[n] def nCr(n, r): if n == r: return 1 if n < r or r < 0: return 0 ret = 1 ret = ret * kaijo(n) % MOD ret = ret * gyaku_kaijo(r) % MOD ret = ret * gyaku_kaijo(n - r) % MOD return ret ######Factorization###### def factorization(n): arr = [] temp = n for i in range(2, int(-(-(n**0.5) // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.append([i, cnt]) if temp != 1: arr.append([temp, 1]) if arr == []: arr.append([n, 1]) return arr #####MakeDivisors###### def make_divisors(n): divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) return divisors #####MakePrimes###### def make_primes(N): max = int(math.sqrt(N)) seachList = [i for i in range(2, N + 1)] primeNum = [] while seachList[0] <= max: primeNum.append(seachList[0]) tmp = seachList[0] seachList = [i for i in seachList if i % tmp != 0] primeNum.extend(seachList) return primeNum #####GCD##### def gcd(a, b): while b: a, b = b, a % b return a #####LCM##### def lcm(a, b): return a * b // gcd(a, b) #####BitCount##### def count_bit(n): count = 0 while n: n &= n - 1 count += 1 return count #####ChangeBase##### def base_10_to_n(X, n): if X // n: return base_10_to_n(X // n, n) + [X % n] return [X % n] def base_n_to_10(X, n): return sum(int(str(X)[-i - 1]) * n**i for i in range(len(str(X)))) #####IntLog##### def int_log(n, a): count = 0 while n >= a: n //= a count += 1 return count ############# # Main Code # ############# N = I() L = IL() L.sort() print(sum(L[::2]))
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s902533382
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
def bbq(): n = int(input()) a = input() tmp = a.split() l = [int(x) for x in tmp] l.sort() n = 0 i = 0 while(i<n: n += l[i] i += 2 print (n) if __name__ == "__main__": bbq()
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s040814645
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
# 座標平面に落とし込んで再帰関数で無理やり計算 # import numpy as np import sys sys.setrecursionlimit(10**5) N, X = map(int, input().split()) if 2 * X > N: # 対称性 X = N - X # 座標の作成 dp = [[-1] * (N + 3)] for i in range(N + 1): tmp = [-1] for j in range(N + 1): if i <= j: tmp.append(0) # 到達していないマス else: tmp.append(-1) # 壁(範囲外) tmp.append(-1) tmp.reverse() dp.append(tmp) dp.append([-1] * (N + 3)) # print (np.array(dp)) # m: 0:右へ, 1:左下へ, 2:左上へ def moving(x, y, total, m): if x == X and y == 1 and dp[x][y] == 1: # 一周回ってもとの座標に戻ってきた時 # print ('D') return total if m == 0: # 右に動く時 tmp = 0 while dp[x - 1][y + 1] == 0: # 右に進める時 dp[x - 1][y + 1] = 1 # 右進んだマスを到達したことにする tmp += 1 x -= 1 y += 1 if dp[x - 1][y + 1] == -1: # 右側が壁の時-->左下に進む # print ('1-B') return moving(x, y, total + tmp, 1) if dp[x - 1][y + 1] == 1: # 右側が光の線の時-->左上へ進む tmp += 1 # print ('1-C') return moving(x - 1, y + 1, total + tmp, 2) if m == 1: # 左下へ動く時 tmp = 0 while dp[x + 1][y] == 0: # 左下に進める時 dp[x + 1][y] = 1 tmp += 1 x += 1 if dp[x + 1][y] == -1: # 左下が壁の時-->左上に進む # print ('2-C') return moving(x, y, total + tmp, 2) if dp[x + 1][y] == 1: # 左下が光の線の時-->左上に進む tmp += 1 # print ('2-C') return moving(x + 1, y, total + tmp, 2) if m == 2: # 左上に動く時 tmp = 0 while dp[x][y - 1] == 0: # 左上に進める時 dp[x][y - 1] = 1 tmp += 1 y -= 1 if dp[x][y - 1] == -1: # 左上が壁の時-->右に進む # print ('3-A') return moving(x, y, total + tmp, 0) if dp[x][y - 1] == 1: # 左上が光の線の時-->左下に進む tmp += 1 # print ('3-B') return moving(x, y - 1, total + tmp, 1) X += 1 print(moving(X, 1, 0, 0)) # print (np.array(dp))
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s590942362
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
import numpy as np N, K = map(int, input().split()) E = np.zeros((N, N), dtype=int) exit(0) Elist = [] for e in range(N - 1): i, o = map(int, input().split()) Elist.append((i - 1, o - 1)) E[i - 1][o - 1] = 1 E[o - 1][i - 1] = 1 # print("N, K=", N, K) # for e in Elist: # print(e[0], e[1]) I = np.eye(N, dtype=int) # print("I=", I) ie = I for k in range(K): ie = ie + np.matmul(I, E) # print("I + IE =", ie) # withinK = np.count_nonzero(ie, axis=0) withinK = np.zeros(N, dtype=int) for i in range(N): for j in range(N): if ie[i][j] > 0: withinK[i] += 1 # print("withinK=", withinK) maxBall = np.amax(withinK) # print("maxBall=", maxBall) solution = N - maxBall print(solution)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s457272852
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
NX = input() NX = "".join(NX).split(" ") NX = [int(s) for s in NX] D = NX[0] - NX[1] if NX[0] == 0 or NX[1] == 0: print(str(0)) if NX[1] < D: Mod = D % NX[1] if Mod != 0: print(int(2 * NX[1] + NX[1] + (D - NX[1] / 2) * 3)) else: print(int(NX[1] * 4 + D)) elif NX[1] == D: print(int(3 * NX[1])) elif NX[1] > D: Mod = NX[1] % D if Mod != 0: print(int(NX[1] + (Mod * 3) + D + (D * 2 * int(NX[1] / D)))) else: print(int(NX[1] + int((NX[1] / D)) * 2 * D))
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s705752314
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
from collections import defaultdict def computeDist(tree, nk, i): visited = [0] * (nk[0] + 1) queue = [] visited[i] = 1 queue.append(i) dist = [0] * (nk[0] + 1) dist[i] = 0 while queue: s = queue.pop(0) for u in tree[s]: if not visited[u]: queue.append(u) visited[u] = 1 dist[u] = dist[s] + 1 return len([i for i in dist if i > nk[1] // 2]) def minimumNodesToBeRemoved(tree, nk): noOfNodesAtDistKBy2 = [0] * (nk[0] + 1) for i in range(1, nk[0] + 1): noOfNodesAtDistKBy2[i] = computeDist(tree, nk, i) return min(noOfNodesAtDistKBy2[1:]) def start(): nk = [int(i) for i in input().split()] tree = defaultdict(list) for i in range(nk[0] - 1): uv = [int(i) for i in input().split()] tree[uv[0]].append(uv[1]) tree[uv[1]].append(uv[0]) return minimumNodesToBeRemoved(tree, nk) print(start())
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s019316700
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
N = int(input()) list = [] for i in 2N: Li = int(input()) list.append(Li) def bbq(list): for i in range(len(list)-1): for j in range(i,len(list)):
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s439685767
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
from collections import deque N, K = map(int, input().split()) T = [[] for i in range(N)] E = [] for i in range(N - 1): a, b = map(int, input().split()) a, b = a - 1, b - 1 T[a].append(b) T[b].append(a) E.append((a, b)) def bfs(n): visited = [False] * N dist = [0] * N queue = deque([n]) while queue: node = queue.pop() if visited[node]: continue visited[node] = True for n in T[node]: if not visited[n]: dist[n] = dist[node] + 1 queue.appendleft(n) return dist dist = [] for i in range(N): dist.append(bfs(i)) ans = float("inf") if K % 2 == 0: # 全ての頂点について全探索 for i in range(N): ans = min(ans, len([d for d in dist[i] if d > K / 2])) else: # 全ての辺について全探索 for a, b in E: adist = [ (1 if min(d1, d2) > (K - 1) / 2 else 0) for d1, d2 in zip(dist[a], dist[b]) ] ans = min(ans, sum(adist)) print(ans)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s981238232
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
import math import sys cin - iter(sys.stdin.read().split()); TT - int(next(cin)); for TT in range(TT) n - int(next(cin)) p - [0] + n h - [0] + n interesting - set() for i in range(n) interesting.add(p[i]) interesting.add(p[i].h[i]) interesting.add(p[i]+h[i]) allinteresting - sorted(interesting, reverse - True) dp - dict() for thisn in allinteresting: for forbidden in [0,1]: best - 0 dp[(thisn. forbidden)] - best diff - sun[i if c == 'A' else -i for c in s] print["Case s(): [)", format(TT+i, "NY"[abs[diff]) -- i] for thisn in allinteresting: for forbiddeh in [0,1] dp[(thisn. forbidden)] - best int main(){ int N 1 < 100 }; int main(){ int L 1 < 100 }; var = (N <= * 2 * 3) console.log( L + 2 - 3 ); console.log( N + 2 * 3 ); type( - 2 ); type( + 2 ); type( - 3 ); type( + 4 ); type ( + 1 ); return = 0
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s280527496
Accepted
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
n, *l = map(int, open(0).read().split()) print(sum(min(sorted(l)[i * 2 : i * 2 + 2]) for i in range(n)))
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s529235642
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
n=int(input()) x=list(map(int,input().split())) x.sort() ans=0 for i range(n): ans+=x[i*2] print(ans)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s725018604
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
n = int(input()) x = list(map(int, input().split())) x.sort() ans = 0 for i range(n): ans = ans + x[i*2] print(ans)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s712750022
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
n=int(input()) x=list(map(int, input().split())) x.sort() ans=0 for i range(n): ans = ans + x[i*2] print(ans)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s950638019
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
n = int(input()) x = list(map(int, input().split())) x.sort() ans = 0 for i range(n): ans = ans + x[i*2] print(ans)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s373380643
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
n=int(input()) x=list(map(int, input().split())) x.sort() ans = 0 for i range(n): ans = ans + x[i*2] print(ans)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s316320577
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
# -*- coding: utf-8 -*- N = int(input()) a = [int(input()) for i in range(2N)] L = sort(a) b = [] for i in range(2N) b.append(a[2*i]) print(sum(b))
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s357077322
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
# -*- coding: utf-8 -*- N = int(input()) a = [int(input()) for i in range(2N)] L = sort(a) b = [] for i in range(2N): b.append(a[2*i]) print(sum(b))
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s967486377
Accepted
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
#!/usr/bin/python # -*- Coding: utf-8 -*- import sys L = [input()] L = sorted(list(map(int, input().split())), key=lambda x: -x) test = lambda L, S=0, f=lambda f, L, S: f(f, L[2:], S + L[1]) if L else print(S): f( f, L, S ) test(L)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s836937692
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
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)n=int(input()) l=list(map(int,input().split())) l.sort() ans=0 for i in range([0,]n[,2]): ans+=l[i] print(ans)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s142733593
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
n = int(input()) table = list(map(int,input().split())) table.sort() count = 0 for i in range(1,n+1): if i%2 = 1: count += table[i] else: pass print(count)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s789681963
Accepted
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
n, l = open(0) print(sum(sorted(map(int, l.split()))[::2]))
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s342524873
Accepted
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
input(), print(sum(sorted(list(map(int, input().split())))[::2]))
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]
Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold. * * *
s786927693
Runtime Error
p04047
The input is given from Standard Input in the following format: N L_1 L_2 ... L_{2N}
N = input() kushi = sorted(list(map(int, input().split()))) even = kushi[0::2] print(sum(even)
Statement Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png) Example of a serving of Skewer Meal He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i. Also, he has an infinite supply of ingredients. To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients. What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?
[{"input": "2\n 1 3 1 2", "output": "3\n \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n 100 1 2 3 14 15 58 58 58 29", "output": "135"}]