problem_id
stringlengths 6
6
| user_id
stringlengths 10
10
| time_limit
float64 1k
8k
| memory_limit
float64 262k
1.05M
| problem_description
stringlengths 48
1.55k
| codes
stringlengths 35
98.9k
| status
stringlengths 28
1.7k
| submission_ids
stringlengths 28
1.41k
| memories
stringlengths 13
808
| cpu_times
stringlengths 11
610
| code_sizes
stringlengths 7
505
|
---|---|---|---|---|---|---|---|---|---|---|
p04047 | u560988566 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n = int(input())\nl = [map(int, input().split())]\n\nans = 0\nl.sort()\n\nfor i in range(n):\n ans += l[2*i]\n\nprint(ans)', 'n = int(input())\nl = list(map(int, input().split()))\n\nans = 0\nl.sort()\n\nfor i in range(n):\n ans += l[2*i]\n \nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s484281013', 's892460810'] | [2940.0, 2940.0] | [17.0, 17.0] | [116, 124] |
p04047 | u567493268 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['try:\n k=input()\nexcept EOFError:\n print("wtf")\n\ntry:\n li=input()\nexcept EOFError:\n print("wtf2")\n\n\nli.sort()\nsum=0\nfor k in range(len(li)):\n \n if k%2==0:\n \n sum=sum+li[k]\nprint(sum)', 'k = iinput()\nli= input().split()\nli.sort()\nsum=0\nfor k in range(len(li)):\n \n if k%2==0:\n \n sum=sum+li[k]\n \nprint(sum)', 'k=input()\n\nli=input()\n\nli.sort()\nsum=0\nfor k in range(len(li)):\n \n if k%2==0:\n \n sum=sum+li[k]\n \nprint(sum)\n', 'k = int(input())\nli= list(map(int, input().split()))\nli.sort()\nsum=0\nfor k in range(len(li)):\n \n if k%2==0:\n \n sum=sum+li[k]\n \nprint(sum)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s131254454', 's389057621', 's509499974', 's616077020'] | [9044.0, 8932.0, 8988.0, 8968.0] | [26.0, 27.0, 22.0, 26.0] | [192, 124, 115, 145] |
p04047 | u579875569 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['#!/usr/bin/python3\nimport sys\n\nsys.setrecursionlimit(100000)\n\nN, X = list(map(int, input().split()))\n\ndef f(a,b):\n if a > b:\n a,b = b,a\n if a==0 or b==0:\n return 0\n if b%a is 0:\n return int(a*(2*(b/a)-1))\n\n return int(2*a*int(b/a) + f(a,b%a))\n\nprint(N+f(N-X, X))\n', '#!/usr/bin/python3\nN = int(input())\nL = list(map(int, input().split()))\n\nL.sort()\n\nprint(sum(L[0::2]))\n'] | ['Runtime Error', 'Accepted'] | ['s078375409', 's855195465'] | [3064.0, 3064.0] | [39.0, 40.0] | [296, 103] |
p04047 | u588633699 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['N = int(input())\nL = list(map(int, input().split()))\n\nL.sort()\nx = 0\n\nfor i in range(0, 2*N, 2):\n print(L[i])\n x += L[i]\n\nprint(x)\n\n', 'N = int(input())\nL = list(map(int, input().split()))\n \nL.sort()\nx = 0\n \nfor i in range(0, 2*N, 2):\n x += L[i]\n \nprint(x)'] | ['Wrong Answer', 'Accepted'] | ['s955651952', 's592727929'] | [2940.0, 2940.0] | [17.0, 18.0] | [138, 123] |
p04047 | u612636296 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['N = int(input())\nL = list(map(int, input().split()))\nans = 0\nL.sort()\n\nfor i in range(0, 2 * N, 2):\n ans += L[i]\n print(i)\nelse:\n print(ans)', 'N = int(input())\nL = list(map(int, input().split()))\nans = 0\nL.sort()\n\nfor i in range(0, 2 * N, 2):\n ans += L[i]\nelse:\n print(ans)'] | ['Wrong Answer', 'Accepted'] | ['s521208011', 's226145692'] | [3060.0, 3060.0] | [17.0, 18.0] | [149, 136] |
p04047 | u636014233 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['N = int(input())\nli = list(map(int, input().split))\nli.sort()\nP = 0\nfor i in range(N):\n P += li[i*2]\nprint(P)', 'N = int(input())\nli = list(map(int, input().split()))\nli.sort()\nP = 0\nfor i in range(N):\n P += li[i*2]\nprint(P)'] | ['Runtime Error', 'Accepted'] | ['s710307205', 's972505598'] | [2940.0, 3064.0] | [17.0, 17.0] | [110, 112] |
p04047 | u651663683 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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()\nprint(sum(list(map(int,input().split()))[0:-1:2] ))', 'input()\nprint(sum(list(sorted(list(map(int,input().split()))))[0:-1:2] ))\n'] | ['Wrong Answer', 'Accepted'] | ['s584401504', 's043044695'] | [2940.0, 2940.0] | [17.0, 17.0] | [59, 74] |
p04047 | u655048024 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['N = int(input())\nc=list(map(int, input().split()))\nc.sort()\nMax = 0\nfor i in range(N):\n K = 2*N\n Max = Max + c[K]\nprint(Max)\n ', 'N = int(input())\nL = list(map(int,input().split()))\nL.sort()\nmaximum = 0\nfor i in range(N):\n maximum += L[2*i]\nprint(maximum)'] | ['Runtime Error', 'Accepted'] | ['s956852856', 's925852761'] | [2940.0, 2940.0] | [18.0, 17.0] | [129, 126] |
p04047 | u657413968 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['def main(p1,p2):\n print(p1)\n print(p2)\n L_np = np.sort(np.array(p2))\n x_total = 0\n for i in range(p1):\n x_total += L_np[2*i]\n print(x_total)\n\nif __name__ == "__main__":\n \n N = int(input())\n L = [int(item) for item in input().split()]\n main(N,L)', '# -*- coding: utf-8 -*-\n\nimport numpy as np\n\ndef main(p1,p2):\n print(p1)\n print(p2)\n L_np = np.sort(np.array(p2))\n x_total = 0\n for i in range(p1):\n x_total += L_np[2*i]\n print(x_total)\n\nif __name__ == "__main__":\n \n N = int(input())\n L = [int(item) for item in input().split()]\n main(N,L)', '# -*- coding: utf-8 -*-\n\nimport numpy as np\n\ndef main(p1,p2):\n L_np = np.sort(np.array(p2))\n x_total = 0\n for i in range(p1):\n x_total += L_np[2*i]\n print(x_total)\n\nif __name__ == "__main__":\n \n N = int(input())\n L = [int(item) for item in input().split()]\n main(N,L)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s297588072', 's439795445', 's181591179'] | [3060.0, 12516.0, 13212.0] | [18.0, 149.0, 163.0] | [318, 363, 335] |
p04047 | u671395265 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n = int(input())\nprint(sum(sorted(map(int, input()))[::2]))', 'n = int(input())\nprint(sum(sorted(list(map(int, input().split())))[::2]))'] | ['Runtime Error', 'Accepted'] | ['s830242700', 's544358960'] | [2940.0, 2940.0] | [17.0, 17.0] | [59, 73] |
p04047 | u673338219 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n = int(input())\nl = list(map(int,input().split()))\nl.sort(reverse=True)\nprint(sum(l[0::2]))', 'n = int(input())\nl = list(map(int,input().split()))\nl.sort(reverse=True)\nprint(sum(l[1::2]))'] | ['Wrong Answer', 'Accepted'] | ['s370139345', 's334766368'] | [9112.0, 9108.0] | [30.0, 32.0] | [92, 92] |
p04047 | u684695949 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['def f(a,b):\n\tif a==b:\n\t\treturn 2*a\n\telif a < b:\n\t\treturn 2*a* + f(a,b-a)\n\telse:\n\t\treturn 2*b + f(a-b,b)\n\n\nN,X = map(int,input().split(" "))\n\nprint(N+f(N-X,X))', 'import bisect\n\nN = input()\nLs = map(int,input().split(" "))\nLs = sorted(Ls)\nans = sum([L for i,L in enumerate(Ls) if i%2 == 0])\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s184275577', 's356094197'] | [2940.0, 3060.0] | [17.0, 17.0] | [158, 138] |
p04047 | u688126754 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['N = int(input())\ntmp_lst = input().split()\nlength_lst = []\nprint(2*N)\nfor i in range(2*N):\n print(tmp_lst[i])\n length_lst.append(int(tmp_lst[i]))\nlength_lst.sort()\n\noutput = 0\nfor i in range(0, 2*N, 2):\n output += length_lst[i]\n\nprint(output)\n', 'N = int(input())\ntmp_lst = input().split()\nlength_lst = []\n#print(2*N)\nfor i in range(2*N):\n# print(tmp_lst[i])\n length_lst.append(int(tmp_lst[i]))\nlength_lst.sort()\n \noutput = 0\nfor i in range(0, 2*N, 2):\n output += length_lst[i]\n \nprint(output)'] | ['Wrong Answer', 'Accepted'] | ['s263934574', 's394870315'] | [3060.0, 3060.0] | [19.0, 17.0] | [252, 255] |
p04047 | u740284863 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['from fractionsimport gcd\nn,x=map(int,input().split())\nprint(3*(n-gcd(n,x)))\n', 'N = int(input())\nL = sorted(list(map(int,input().split())))\n\nsum = 0\nfor i in range(0,2*N,2):\n sum += L[i]\nprint(sum)\n'] | ['Runtime Error', 'Accepted'] | ['s605778442', 's171679355'] | [2940.0, 2940.0] | [18.0, 18.0] | [76, 121] |
p04047 | u747873993 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['"""A - BBQ Easy"""\nimport numpy as np\nN=int(input())\nL=[int(i) for i in input().split()]\nresult=0\nfor i in range(0,N,2):\n result+=np.sort(L)[i]\nprint(result)\n\n', 'import numpy as np\nN=int(input())\nL=[int(i) for i in input().split()]\nresult=0\nfor i in range(0,len(L),2):\n result+=np.sort(L)[i]\nprint(result)'] | ['Wrong Answer', 'Accepted'] | ['s819785151', 's359409798'] | [12496.0, 12496.0] | [150.0, 149.0] | [162, 146] |
p04047 | u749416810 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n=int(input())\nl=list(map(int, input().split()))\ns=0\nfor i in range(0,2*n, 2):\n s+=min(l[i], l[i+1]) \nprint(s) ', 'n=int(input())\nl=list(map(int,input().split()))\nl.sort()\ns=0\nfor i in range(0,2*n,2):\n s+=min(l[i],l[i+1])\nprint(s)'] | ['Wrong Answer', 'Accepted'] | ['s621640463', 's785931268'] | [2940.0, 2940.0] | [17.0, 17.0] | [112, 116] |
p04047 | u753871011 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['a = int(input())\nb = input()\n\nb = b.split()\nb = [int(x) for x in b]\n\nb = sorted(b)\nb = b[::-1]\nprint(b)\n\ndef get(a,x):\n\tif a == 0:\n\t\treturn 0\n\tx.pop(0)\n\tadd = x.pop(0)\n\n\treturn add + get((a-1),x)\n\nprint(get(a,b))', 'a = int(input())\nb = input()\n\nb = b.split()\nb = [int(x) for x in b]\n\nb = sorted(b)\nb = b[::-1]\nprint(b)\n\ndef get(a,x):\n\tif a == 0:\n\t\treturn 0\n\tx.pop(0)\n\tadd = x.pop(0)\n\n\treturn add + get((a-1),x)\n\nprint(str(get(a,b)))', 'a = int(input())\nb = input()\n\nb = b.split()\nb = [int(x) for x in b]\n\nb = sorted(b)\nb = b[::-1]\n\ndef get(a,x):\n\tif a == 0:\n\t\treturn 0\n\tx.pop(0)\n\tadd = x.pop(0)\n\n\treturn add + get((a-1),x)\n\nprint(str(get(a,b)))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s040338837', 's622157013', 's351232295'] | [3064.0, 3064.0, 3188.0] | [39.0, 37.0, 41.0] | [212, 217, 208] |
p04047 | u762420987 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['N = int(input())\nLlist = sorted(list(map(int, input().split())))[::-1]\nans = 0\nfor i in range(0, 2*N):\n ans += min(Llist[i], Llist[i+1])\nprint(ans)\n', 'N = int(input())\nLlist = sorted(list(map(int, input().split())))[::-1]\nans = 0\nfor i in range(0, 2*N, 2):\n ans += min(Llist[i], Llist[i+1])\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s806014864', 's931877360'] | [2940.0, 2940.0] | [18.0, 17.0] | [151, 154] |
p04047 | u807772568 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['a = int(input())\n\nb = list(map(int,input().split()))\n\nb.sorted()\n\nsu = 0\n\nfor i in range(a-1):\n su += b[2*i]', 'a = int(input())\n\nb = list(map(int,input().split()))\n\nb.sorted()\n\nsu = 0\n\nfor i in range(a):\n su += b[2*i]', 'a = int(input())\n\nb = list(map(int,input().split()))\n\nb.sort()\n\nsu = 0\n\nfor i in range(a-1):\n su += b[2*i]\nprint(su)', 'a = int(input())\n\nb = list(map(int,input().split()))\n\nb.sort()\n\nsu = 0\n\nfor i in range(a):\n su += b[2*i]\nprint(su)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s331366516', 's571583433', 's785468595', 's081524959'] | [2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0, 19.0] | [109, 107, 117, 115] |
p04047 | u824237520 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n = int(n)\na = list(map(int, input().split()))\n\na.sort()\n\nans = 0\nfor i in range(n):\n ans += a[i*2]\n\nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\n\na.sort()\n\nans = 0\nfor i in range(n):\n ans += a[i*2]\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s635655531', 's722742810'] | [2940.0, 2940.0] | [17.0, 17.0] | [114, 120] |
p04047 | u828766688 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['N = int(input())\nL = list(map(int,input().split()))\nL.sort()\n\nans = 0\nfor i in range(N):\n if i % 2 == 0:\n ans += L[i]\nprint (ans)', 'N = int(input())\nL = list(map(int,input().split()))\nL.sort()\n\nans = 0\nfor i in range(2*N):\n if i % 2 == 0:\n ans += L[i]\nprint (ans)'] | ['Wrong Answer', 'Accepted'] | ['s304754181', 's348777016'] | [3060.0, 2940.0] | [17.0, 17.0] | [133, 135] |
p04047 | u844902298 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n = int(input())\ns = list(map(int,input().split()))\ns.sort()\nsum = 0\n\nfor i in range(0,2n,2):\n sum += s[i]\nprint(sum)', 'n = int(input())\ns = list(map(int,input().split()))\ns.sort()\nsum = 0\n\nfor i in range(0,2*n,2):\n sum += s[i]\nprint(sum)'] | ['Runtime Error', 'Accepted'] | ['s320410504', 's297358608'] | [2940.0, 3060.0] | [17.0, 17.0] | [118, 119] |
p04047 | u845333844 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n=int(input())\nl=list(map(int,input().split()))\n \nl.sort()\nk=l[::2]\nsum=0\nfor i in range(n-2):\n sum += k[i]\n \nprint(sum)', 'n=int(input())\nl=list(map(int,input().split()))\n\nl.sort()\nk=l[::2]\n\nprint(k.sum())', 'n=int(input())\nl=list(map(int,input().split()))\n \nl.sort()\nk=l[::2]\nsum=0\nfor i in range(n):\n sum += k[i]\n \nprint(sum)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s468395888', 's928614242', 's533053760'] | [2940.0, 2940.0, 2940.0] | [24.0, 19.0, 17.0] | [122, 82, 120] |
p04047 | u853900545 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n = int(input())\nl = sorted(list(map(int,input().split())))\n\nc = 0\nfor i in range(n):\n c +=l[i]\n print(c)', 'n = int(input())\nl = sorted(list(map(int,input().split())))\n\nc = 0\nfor i in range(n//2):\n c +=l[i]\n print(c)', 'n = int(input())\nl = sorted(list(map(int,input().split())))\n\nc = 0\nfor i in range(n):\n c +=l[i]\nprint(c)', 'n = int(input())\nl = sorted(list(map(int,input().split())))\n\nc = 0\nfor i in range(n):\n c += l[2*i]\nprint(c)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s257673174', 's428582721', 's871525832', 's774166090'] | [3060.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0, 17.0] | [111, 114, 107, 110] |
p04047 | u856671164 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['\nnum = int(input())\nli = int(input().split())\n\nprint(num)\nprint(li)', 'n = int(input())\nli = [int(x) for x in input().split()]\n\ndef skews(n,li):\n \n li = sorted(li)\n li = [l for i,l in enumerate(li) if i%2==0] \n return sum(li)\n\n\nprint(skews(n,li))\n'] | ['Runtime Error', 'Accepted'] | ['s838662080', 's028090472'] | [9092.0, 8880.0] | [25.0, 28.0] | [67, 188] |
p04047 | u859897687 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n=int(input())\nl=list(map(int,input().split()))\nl.sort(reverse=1)\nans=0\nfor i in range(1,n,2):\n ans+=l[i]\nprint(ans)', 'n=int(input())\nl=list(map(int,input().split()))\nl.sort(reverse=1)\nans=0\nfor i in range(n):\n ans+=l[2*i+1]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s924068200', 's251954815'] | [2940.0, 2940.0] | [17.0, 18.0] | [117, 117] |
p04047 | u860843282 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['from collections import Counter\n \nn = int(input())\n \narr = list(map(int, input().split()))\n \ncounts = Counter(arr)\n \nres = 0\n \nfor k,v in counts.items():\n if v>=2:\n res += v//2\n counts[k] = v%2\n \nitems = sorted(counts.items())\nfor i in range(len(items)-1):\n res+=min(items[i], items[i+1])\n \nprint(res)', 'from collections import Counter\n\nn = int(input())\n\narr = list(map(int, input().split()))\n\ncounts = Counter(arr)\n\nres = 0\n\nfor k,v in counts.items():\n if v>=2:\n res += v//2\n counts[k] = v%2\n \nitems = sorted(counts.items())\nfor i in range(len(items)-1):\n res+=min(items[i], items[i+1])\n \nreturn res', 'n = int(input())\n \narr = list(map(int, input().split()))\n\narr.sort()\n\nres = 0\ni=0\n\nwhile i<n:\n res+=min(arr[i], arr[i+1])\n i+=2\n \nprint(res)\n', 'n = int(input())\n \narr = list(map(int, input().split()))\n\narr.sort()\n\nres = 0\n\nfor i in range(len(arr)-1):\n res+=min(arr[i], arr[i+1])\n \nprint(res)', 'n = int(input())\n \narr = list(map(int, input().split()))\n\narr.sort()\n\nres = 0\ni=0\nl = len(arr)\nwhile i<l:\n res+=min(arr[i], arr[i+1])\n i+=2\n \nprint(res)\n'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s112597968', 's280396540', 's654705910', 's784455302', 's888016571'] | [9388.0, 9112.0, 9156.0, 9176.0, 8968.0] | [24.0, 26.0, 28.0, 28.0, 25.0] | [313, 308, 144, 149, 156] |
p04047 | u864276028 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['N = int(input())\nL = list(map(int, input().split()))\nL.sort()\nS = 0\nfor i in range (0, 2*N+1, 2):\n S += L[i]\nprint(S)', 'N = int(input())\nL = list(map(int, input().split()))\nL.sort()\nS = 0\nfor i in range (1, 2*N+1, 2):\n S += L[i-1]\nprint(S)'] | ['Runtime Error', 'Accepted'] | ['s420396881', 's036877571'] | [9140.0, 9036.0] | [24.0, 29.0] | [118, 120] |
p04047 | u867736259 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['a = int(input())\nb = list(map(int,input().split()))\nb = sorted(b)\nc = 0\nfor i in range(0,a,2):\n c += b[i]\nprint(c)', 'a = int(input())\nb = list(map(int,input().split()))\nb = sorted(b)\nc = 0\nfor i in range(0,2*a,2):\n c += b[i]\nprint(c)'] | ['Wrong Answer', 'Accepted'] | ['s391633563', 's427633441'] | [2940.0, 2940.0] | [17.0, 17.0] | [117, 119] |
p04047 | u891482208 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['a = sorted(list(map(int, input().split())))\nans = 0\nfor i in range(0, len(a), 2):\n ans += a[i]\nprint(ans)', 'n = input()\na = sorted(list(map(int, input().split())))\nans = 0\nfor i in range(0, len(a), 2):\n ans += a[i]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s555645132', 's004636450'] | [2940.0, 2940.0] | [17.0, 17.0] | [106, 118] |
p04047 | u904804404 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['def tri_len(x,y):\n if x== y:\n return x\n elif x < y:\n return tri_len(y-x,x)+2*x\n else:\n return tri_len(x-y,y)+2*y\nimport sys\nsys.setrecursionlimit(10000)\n\nn,x= list(map(int,input().split(" ")))\n\nprint( n+tri_len(x,n-x))', 'a = input()\nlst = input().split(" ")\nlst.sort()\nans=0\nfor i in range(int(len(lst))):\n ans += lst[len(lst)-2*i-2]\n\nprint(ans)', 'def tri_len(x,y):\n if x== y:\n return x\n elif x < y:\n return tri_len(y-x,x)+2*x\n else:\n return tri_len(x-y,y)+2*y\nimport sys\nsys.setrecursionlimit(100000)\n\nn,x= list(map(int,input().split(" ")))\n\nprint( n+tri_len(x,n-x))', 'a = input()\nlst = list(map(int,input().split(" ")))\nlst.sort()\nans=0\nfor i in range(int(len(lst)/2)):\n ans += lst[len(lst)-2*i-2]\n \nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s396854922', 's559310751', 's631135163', 's642493992'] | [3064.0, 2940.0, 3060.0, 2940.0] | [17.0, 17.0, 18.0, 18.0] | [230, 125, 231, 143] |
p04047 | u906129425 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n = int(input())\na = list(map(int, input().split()))\na.sort()\nprint(a[::2])', 'n = int(input())\na = list(map(int, input().split()))\na.sort()\nprint(sum(a[::2]))'] | ['Wrong Answer', 'Accepted'] | ['s182284261', 's921951726'] | [2940.0, 2940.0] | [17.0, 17.0] | [75, 80] |
p04047 | u914627967 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['ans=0\nN=int(input())\nkushi=[]\nfor s in range(N):\n\tkushi.append(input())\nfor s in range(N):\n\tkushi1="".join(kushi[s]).rstrip("\\n").split(" ")\n\tfor j in range(N-s):\n\n\t\tif j==0:\tcontinue\n\t\tkushi2="".join(kushi[s+j]).rstrip("\\n").split(" ")\n\t\tn=int(kushi1[0])+int(kushi2[0])+int(kushi1[1])+int(kushi2[1])\n\t\tk=int(kushi1[1])+int(kushi2[1])\n\t\tfor m in range(k-1):\n\t\t\tn=n*(n-1)\n\t\t\tk=k*(k-1)\n\t\tans+=n/k\n\t\tprint(ans)', 'NX = input()\nNX = "".join(NX).split(" ")\nNX = [int(s) for s in NX]\nD = NX[0]-NX[1]\nif NX[0] ==0 or NX[1]==0:\n\tprint(str(0))\nif NX[1]<D:\n\tMod = D%NX[1]\n\tif Mod!=0:\n\t\tprint(int(2*NX[1]+NX[1]+(D-NX[1]/2)*3))\n\telse:\n\t\tprint(int(NX[1]*4+D))\nelif NX[1]==D:\n\tprint(int(3*NX[1]))\nelif NX[1]>D:\t\n\tMod = NX[1]%D\n\tif Mod!=0:\n\t\tprint(int(NX[1]+(Mod*3)+D+(D*2*int(NX[1]/D))))\n\telse:\n\t\tprint(int(NX[1]+int((NX[1]/D))*2*D))', 'N = int(input())\nK = input()\nK = "".join(K).split(" ")\nK = [int(s) for s in K]\nK.sort()\nans=0\nfor s in range(N):\n\tif int(K[-1])> int(K[-2]):\n\t\tans+=int(K[-2])\n\telse:\n\t\tans+=int(K[-1])\n\tdel K[-2:]\n\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s080016681', 's457272852', 's488508931'] | [3316.0, 3064.0, 3188.0] | [39.0, 39.0, 39.0] | [407, 408, 207] |
p04047 | u933750963 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['x,y=map(int,input().split())\nz=3.5*y+x\nprint(z)', 'x,y=map(int,input().split())\nz=3.5*y+x\nprint(z)', 'x=input()\ny = sorted(list(map(int, input().split())))\ni=1\nz=0\nfor i in range(int(len(y)/2)):\n z+=y[-2*i]\n i+=1\n\nprint(z)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s569317134', 's679727884', 's378750090'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0] | [47, 47, 129] |
p04047 | u936985471 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n=int(input())\nL=sorted(list(map(int,input().split())))\nans=0\nfor i in range(0,n,2):\n ans+=L[i]\nprint(ans)\n', 'n=int(input())\nL=sorted(list(map(int,input().split())))\nans=0\nfor i in range(0,n*2,2):\n ans+=L[i]\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s222302546', 's731496909'] | [2940.0, 2940.0] | [17.0, 17.0] | [108, 110] |
p04047 | u966695411 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['#! /usr/bin/env python3\n\nN, X = map(int, input().split())\nif X*2 == N:\n print(X*3)\nelse:\n print(X*3*((N-X)//X + (1 if (N-X)%X>0 else 0)))', '#! /usr/bin/env python3\n\nN = int(input())\nL = list(sorted(map(int, input().split())))\nans = 0\nfor i in range(N):\n ans += min(L[i*2], L[i*2+1])\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s948258491', 's165977389'] | [3064.0, 7524.0] | [46.0, 1434.0] | [143, 156] |
p04047 | u971161994 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['import random\n\nN = int(input())\nL =[]\nfor i in range(N*2):\n guzai=random.randint(1,100)\n L.append(guzai)\n\nL.sort()\n\nprint(L)\n#print(L)\nL_even=L[0::2]\n\ngoukei=sum(L_even)\nprint(str(goukei))\n', 'import random\n\nN = int(input())\nL =[]\nfor i in range(N*2):\n guzai=random.randint(1,100)\n L.append(guzai)\n\nL.sort()\nL_even=L[0::2]\ngoukei=sum(L_even)\nprint(str(goukei))', 'N = int(input())\nL =[]\n\nguzai=int(input())\nL.append(guzai)\n\nL.sort()\nL_even=L[0::2]\ngoukei=sum(L_even)\nprint(str(goukei))\n', 'import random\n\nN = int(input())\nL =[]\nfor i in range(N*2):\n guzai=random.randint(1,100)\n L.append(guzai)\n\nL.sort()\n\nprint(L)\nL_even=L[0::2]\n\ngoukei=sum(L_even)\nprint(str(goukei))\n', 'N = int(input())\nL =[]\nfor i in range(N*2):\n guzai=int(input())\n L.append(guzai)\n\nL.sort()\nL_even=L[0::2]\ngoukei=sum(L_even)\nprint(str(goukei))', "import random\n\nN = int(input('Nの値を決めてください(1<=N<=100)'))\nL =[]\nfor i in range(N*2):\n guzai=random.randint(1,100)\n L.append(guzai)\n\nL.sort()\nprint(L)\nL_even=L[0::2]\n\ngoukei=sum(L_even)\nprint(str(goukei))\n", 'N = [int(v) for v in input().split()]\nL = [int(v) for v in input().split()]\nL.sort()\nL_even=L[0::2]\ngoukei=sum(L_even)\nprint(str(goukei))\n'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s166759911', 's177554736', 's221093562', 's408768866', 's564078703', 's887228719', 's813502878'] | [4336.0, 3316.0, 2940.0, 4208.0, 2940.0, 3824.0, 2940.0] | [36.0, 21.0, 17.0, 33.0, 17.0, 28.0, 17.0] | [195, 173, 122, 185, 149, 228, 138] |
p04047 | u993493158 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n = int(input())\nL = list(map(int, input().split())\nL.sort()\narray_L = []\nfor m in [i * 2 for i in range(n)]:\n array_L.append(L[m])\nprint(sum(array_L))\n ', 'n = int(input())\nL = list(map(int, input().split()))\nL.sort()\narray_L = []\nfor m in [i * 2 for i in range(n)]:\n array_L.append(L[m])\nprint(sum(array_L))\n \n'] | ['Runtime Error', 'Accepted'] | ['s220467221', 's081595892'] | [2940.0, 2940.0] | [19.0, 24.0] | [159, 161] |
p04047 | u994988729 | 2,000 | 262,144 | Snuke is having a barbeque party. At the party, he will make N servings of _Skewer Meal_. 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? | ['n=int(input())\nl=list(map(int,input().split()))\nl.sort()\nans=sum(l[1::2])\nprint(ans)', 'n = int(input())\nl = list(map(int, input().split()))\nl.sort()\nans = sum(l[0::2])\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s180739735', 's945202053'] | [2940.0, 2940.0] | [17.0, 17.0] | [84, 92] |
p04048 | u077337864 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['def gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\nn, x = map(int, input().split())\nprint(3*gcd(n, x))', 'def gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\nn, x = map(int, input().split())\nprint(3*(n - gcd(n, x)))\n'] | ['Wrong Answer', 'Accepted'] | ['s136913283', 's338757392'] | [3060.0, 3060.0] | [18.0, 17.0] | [124, 131] |
p04048 | u098968285 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ["N, X = map(int, input().split())\nY = N - X\n\nif 2 * X == N:\n\tprint(X*3)\nelif 2 * X < N:\n\tans = Y + 3 * X\n\ta = N-2*X\n\tb = X\n\t\n\tif a < b:\n\t\tans += ((X // a) * 2 - 1) * a\n\telse:\n\t\tans += ((X // b) * 2 - 1) * b\n\traise NameError('NG!')\n\tprint(ans)\nelse: # 2 * X < N\n\tans = X\n\tans += ((X // Y) * 2) * Y\n\tprint(ans)\n", 'N, X = map(int, input().split())\nY = N - X\n\nans = N\n\nwhile True:\n\tif X == Y:\n\t\tans += X\n\t\tbreak\n\telse:\n\t\tif X > Y:\n\t\t\ttmp = X\n\t\t\tX = Y\n\t\t\tY = tmp\n\t\ta = Y % X\n\t\tb = Y // X\n\t\tif a == 0:\n\t\t\tans += (b*2 - 1) * X\n\t\t\tbreak\n\t\telse:\n\t\t\tans += b*2*X\n\t\tY = X\n\t\tX = a\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s461206336', 's457453370'] | [3064.0, 3064.0] | [38.0, 39.0] | [332, 268] |
p04048 | u211706121 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['n,x = [int(i) for i in input().split()]\nlength = n\nn=n-x\nwhile True:\n if x==0:\n break\n t=n//x\n length+=2*t*x\n a=n\n n=x\n x=a-t*x\nprint(length)', 'n,x = [int(i) for i in input().split()]\n\nlength = n\nn=n-x\nwhile True:\n if x==0:\n length-=x\n break\n t=n//x\n length+=2*t*x\n a=n\n n=x\n x=a-t*x\nprint(length)', 'n,x = [int(i) for i in input().split()]\n\nlength = n\nn=n-x\nwhile True:\n t=n//x\n length+=2*t*x\n a=n\n n=x\n x=a-t*x\n if x==0:\n length-=n\n break\nprint(length)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s506811118', 's715345696', 's584383797'] | [3060.0, 3060.0, 3060.0] | [17.0, 18.0, 17.0] | [166, 185, 185] |
p04048 | u305052967 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['N,X = map(int, input().split())\nprint(N)\nprint(X)\n\ndef para(a,b):\n if a > b:\n return 2*b + para(b,a-b)\n if a < b:\n return 2*a + para(b-a,a)\n if a == b:\n return a\nprint(N+para(X,N-X))', 'N,X = map(int, input().split())\nprint(N)\nprint(X)\n\ndef para(a,b):\n if a > b:\n return a+b + para(b,a-b)\n if a < b:\n return 2*a + para(a,b-a)\n if a == b:\n return 3*a\nprint(X+para(X,N-X))', 'N,X = map(int, input().split())\n \n \ndef para(a,b):\n if a == b:\n return a\n else:\n if a%b == 0:\n return (2*(a//b) -1)*b\n if a%b != 0:\n return (2*(a//b) -1)*b + para(b,a%b)\nif X >= N-X:\n print(N+para(X,N-X))\nelse:\n print(N+para(N-X,X))\n', 'N,X = map(int, input().split())\n\n\ndef para(a,b):\n if a == b:\n return a\n else:\n if a%b == 0:\n return (2*(a//b) -1)*b\n if a%b != 0:\n return (2*(a//b) -1)*b + para(b,a%b)\nif X >= N-X:\n print(N+para(X,N-X))\nif X <= N-X:\n print(N+para(N-X,X))', 'N,X = map(int,input().split(" "))\n \nY,X = sorted([N - X,X])\n \ns = 0\nwhile Y:\n s += (X//Y)*Y*3\n Y,X = [X%Y,Y]\n \nprint(s)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s248720864', 's296000499', 's388156638', 's803960281', 's362373879'] | [3980.0, 3988.0, 3060.0, 3064.0, 3316.0] | [74.0, 75.0, 17.0, 18.0, 21.0] | [212, 214, 291, 295, 125] |
p04048 | u332049206 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['N,X = map(int,input().split())\nx = X\ny = N-X\nif x<y:\n x,y = y,x\nres = N\nwhile y>0:\n x,y = y,x\n print(x,y)\n m = x*(y//x)\n res += m*2\n y -= m\nres -= x\nprint(res)', 'N,X = map(int,input().split())\nx = X\ny = N-X\nif x<y:\n x,y = y,x\nres = N\nwhile y>0:\n x,y = y,x\n m = x*(y//x)\n res += m*2\n y -= m\nres -= x\nprint(res)'] | ['Wrong Answer', 'Accepted'] | ['s733403426', 's805954247'] | [3064.0, 3188.0] | [17.0, 18.0] | [177, 162] |
p04048 | u334712262 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ["# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\nfrom operator import add, mul, sub\n\nsys.setrecursionlimit(10000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input().strip()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n\n error_print(e - s, 'sec')\n return ret\n\n return wrap\n\n\n@mt\ndef slv(N, X):\n if X == N//2:\n return 3*X\n ans = 0\n if X > N//2:\n X = N-X\n\n ans = X\n\n def f(n, x):\n ans = 0\n ans += n\n n_x = n // x\n ans += 2*n_x*x - x\n if n_x % x != 0:\n ans += f(x, n - n_x*x)\n\n # print(n, x, n_x, 2*n_x*x - x, ans)\n return ans\n\n return ans + f(N-X, X)\n\n\ndef main():\n N, X = read_int_n()\n print(slv(N, X))\n\n\nif __name__ == '__main__':\n main()\n", "# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\nfrom operator import add, mul, sub\n\nsys.setrecursionlimit(10000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input().strip()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n\n error_print(e - s, 'sec')\n return ret\n\n return wrap\n\n\n@mt\ndef slv(N, X):\n if N % 2 == 0 and X == N//2:\n return 3*X\n ans = 0\n if X > N//2:\n X = N-X\n\n ans = X\n\n def f(n, x):\n # print(n, x)\n ans = 0\n ans += n\n n_x = n // x\n ans += 2*n_x*x - x\n if n % x != 0:\n ans += f(x, n - n_x*x)\n\n # print(n, x, n_x, 2*n_x*x - x, ans)\n return ans\n\n return ans + f(N-X, X)\n\n\ndef main():\n N, X = read_int_n()\n print(slv(N, X))\n\n \n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s048338925', 's010118889'] | [5688.0, 5448.0] | [42.0, 38.0] | [1458, 1496] |
p04048 | u477320129 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['import sys\nsys.setrecursionlimit(1500)\n\ndef f(x, y):\n if y == 0:\n return 0\n if x == y:\n return x\n x, y = min(x, y), max(x, y)\n return 2 * (y // x) * x + f(x, y % x)\n\nN, X = list(map(int, input().split()))\nprint(f(X, N-X) + N)\n', 'import sys\nsys.setrecursionlimit(1500)\n\ndef f(x, y):\n if x == y:\n return x\n x, y = min(x, y), max(x, y)\n return 2 * (y // x) * x + f(x, y % x)\n\nN, X = list(map(int, input().split()))\nprint(f(X, N-X) + N)\n', 'import sys\nsys.setrecursionlimit(1500)\n\ndef f(x, y):\n if x == 0:\n return 0\n if x == y:\n return x\n return 2 * (y // x) * x + f(y % x, x)\n\nN, X = list(map(int, input().split()))\nprint(f(X, N-X) + N)\n', 'import sys\nsys.setrecursionlimit(1500)\n\ndef f(x, y):\n if x == 0:\n return 0\n if y % x == 0:\n return 2 * (y // x) * x - x\n return 2 * (y // x) * x + f(y % x, x)\n\nN, X = list(map(int, input().split()))\nprint(f(X, N-X) + N)\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s152411645', 's191680008', 's604465468', 's976467494'] | [3064.0, 3116.0, 3064.0, 3064.0] | [42.0, 46.0, 42.0, 39.0] | [252, 220, 220, 243] |
p04048 | u525796732 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ["def main():\n n,x=map(int,input().split())\n a,b=n-x,x\n if(a<b):\n a,b=b,a\n path_length = calc_path(a,b,n)\n print(path_length)\n\ndef calc_path(a1,b1,c1):\n q , mod=divmod(a1,b1)\n count=0\n if mod==0:\n print(c1)\n c2=c1+2*b1*q-b1\n print(c2)\n return c2\n else:\n count=count+1\n c2=c1+2*b1*q\n a2=a1-b1*q\n b2=b1\n if(a2<b2):\n a2,b2=b2,a2\n return calc_path(a2,b2,c2)\nif __name__=='__main__':\n main()\n", "def main():\n n,x=map(int,input().split())\n a,b=n-x,x\n if(a<b):\n a,b=b,a\n path_length = calc_path(a,b,n)\n print(path_length)\n\ndef calc_path(a1,b1,c1):\n q , mod=divmod(a1,b1)\n count=0\n if mod==0:\n c2=c1+2*b1*q-b1\n return c2\n else:\n count=count+1\n c2=c1+2*b1*q\n a2=a1-b1*q\n b2=b1\n if(a2<b2):\n a2,b2=b2,a2\n return calc_path(a2,b2,c2)\nif __name__=='__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s573674066', 's037011222'] | [3064.0, 3064.0] | [18.0, 20.0] | [504, 466] |
p04048 | u562016607 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['def gcd(a,b):\n if a%b==0:\n return b\n else:\n return gcd(b,a%b)\nN,X=map(int,input().split())\nprint(3*(N-gcd(N,X))\n', 'def gcd(a,b):\n if a%b==0:\n return b\n else:\n return gcd(b,a%b):\nN,X=map(int,input().split())\nprint(3*(N-gcd(N,X))', 'def gcd(a,b):\n if a%b==0:\n return b\n else:\n return gcd(b,a%b)\nN,X=map(int,input().split())\nprint(3*(N-gcd(N,X)))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s002545282', 's352506225', 's230428310'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [120, 120, 121] |
p04048 | u631277801 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['import sys\nstdin = sys.stdin\n \nsys.setrecursionlimit(10**8) \n \ndef li(): return map(int, stdin.readline().split())\ndef li_(): return map(lambda x: int(x)-1, stdin.readline().split())\ndef lf(): return map(float, stdin.readline().split())\ndef ls(): return stdin.readline().split()\ndef ns(): return stdin.readline().rstrip()\ndef lc(): return list(ns())\ndef ni(): return int(stdin.readline())\ndef nf(): return float(stdin.readline())\n\ndef gcd(a,b):\n if a%b == 0:\n return b\n else:\n return gcd(b, a%b)\n\ndef rec(a: int, b: int) -> int:\n mx = max(a,b)\n mn = min(a,b)\n if gcd(a,b) == mn:\n return (2 * (mx // mn) - 1) * mn\n \n else:\n return (2 * (mx // mn) * mn) + rec(mn, mn * (mx // mn))\n \nn,x = li()\nprint(n + rec(x, n-x))', 'import sys\nstdin = sys.stdin\n \nsys.setrecursionlimit(10**8) \n \ndef li(): return map(int, stdin.readline().split())\ndef li_(): return map(lambda x: int(x)-1, stdin.readline().split())\ndef lf(): return map(float, stdin.readline().split())\ndef ls(): return stdin.readline().split()\ndef ns(): return stdin.readline().rstrip()\ndef lc(): return list(ns())\ndef ni(): return int(stdin.readline())\ndef nf(): return float(stdin.readline())\n\ndef gcd(a,b):\n if a%b == 0:\n return b\n else:\n return gcd(b, a%b)\n\ndef rec(a: int, b: int) -> int:\n mx = max(a,b)\n mn = min(a,b)\n if gcd(a,b) == mn:\n return (2 * (mx // mn) - 1) * mn\n \n else:\n return (2 * (mx // mn) * mn) + rec(mn, mx - mn * (mx // mn))\n \nn,x = li()\nprint(n + rec(x, n-x))\n '] | ['Wrong Answer', 'Accepted'] | ['s036340270', 's194143299'] | [3064.0, 3064.0] | [18.0, 18.0] | [767, 777] |
p04048 | u638357064 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['from math import floor\nN, X = [int(x) for x in input().split()]\n\nprint(N, X)\n\nx0 = N\nx1 = X\nx2 = x0-x1\nL = 2*X\nc = 1\nwhile x2 > 0:\n\tk = floor(x0/(x1/2))-1\n\tL += x1*k\n\tx0, x1, x2 = (x1, x2, x0-x1)\n\nprint(L)', '# your code goes here\nfrom math import floor\nN, X = [int(x) for x in input().split()]\n\ny = N-X\nx = X\nL = X\nwhile x > 0:\n#\tk = 2*floor(y/x)\n\tk, z = divmod(y, x)\n\tdL = x*(2*k-1)+y\n\tL += x*(2*k-1)+y\n\tprint(x, y, k, dL)\n\ty, x = (x, z)\n\n#L += y\nprint(L)', '# your code goes here\nfrom math import floor\nN, X = [int(x) for x in input().split()]\n\ny = N-X\nx = X\nL = X\nwhile x > 0:\n#\tk = 2*floor(y/x)\n\tk, z = divmod(y, x)\n#\tdL = x*(2*k-1)+y\n\tL += x*(2*k-1)+y\n#\tprint(x, y, k, dL)\n\ty, x = (x, z)\n\n#L += y\nprint(L)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s178776627', 's779272697', 's038072391'] | [3060.0, 3060.0, 3060.0] | [19.0, 17.0, 17.0] | [205, 248, 250] |
p04048 | u684695949 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['def f(a,b):\n\treturn 2*a + f_fast(a,b-a)\n\n\n\ndef f_fast(a,b):\n\tif a==b:\n\t\treturn a+b\n\telif a < b:\n\t\tif b%a == 0:\n\t\t\treturn f(a,b)\n\t\telse:\n\t\t\td = b//a\n\t\t\treturn 2*a*d + f_fast(a,b%a)\n\telse:\n\t\treturn f_fast(b,a)\n\n\nN,X = map(int,input().split(" "))\n\nprint(N+f_fast(N-X,X))', 'def f(a,b):\n\tif a==b:\n\t\treturn 2*a\n\telif a < b:\n\t\treturn 2*a + f(a,b-a)\n\telse:\n\t\treturn 2*b + f(a-b,b)\n\n\nN,X = map(int,input().split(" "))\n\nprint(N+f(N-X,X))', 'def f(a,b):\n\tprint(a,b)\n\tif a==b:\n\t\treturn 2*a\n\telif a < b:\n\t\treturn 2*a + f(a,b-a)\n\telse:\n\t\treturn 2*b + f(a-b,b)\n\n\nN,X = map(int,input().split(" "))\n\nprint(N+f(N-X,X))', 'def f(a,b):\n\tif a==b:\n\t\td=0\n\t\tret = a\n\telif a < b:\n\t\td = b//a\n\t\tif b%a == 0:\n\t\t\tret = a*(2*d -1)\n\t\telse:\n\t\t\tret = 2*a*d + f(a,b%a)\n\telse:\n\t\td = a//b\n\t\tif a%b == 0:\n\t\t\tret = b*(2*d -1)\n\t\telse:\n\t\t\tret = 2*b*d + f(a%b,b)\n\t#print(a,b,d,ret)\n\treturn ret\n\n\nN,X = map(int,input().split(" "))\n\nprint(N+f(N-X,X))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s527203596', 's744545686', 's861657137', 's217425975'] | [3940.0, 3976.0, 4212.0, 3064.0] | [78.0, 72.0, 74.0, 17.0] | [267, 157, 169, 303] |
p04048 | u690536347 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['import sys\nsys.setrecursionlimit(10**15)\n\ndef f(a,b):\n if a==b:return a\n if not a<b:a,b=b,a\n return f(a,b-a)+2*a\n\nN,X=map(int,input().split())\nprint(f(X,N-X)+N)\n', 'import sys\nsys.setrecursionlimit(10**7)\n\ndef f(a,b):\n if a==b:return a\n if not a<b:a,b=b,a\n return 2*(b//a)*a+f(a,b%a) if b%a else 2*(b//a)*a-a\n\nN,X=map(int,input().split())\nprint(f(X,N-X)+N)'] | ['Runtime Error', 'Accepted'] | ['s891845339', 's825981109'] | [2940.0, 3060.0] | [18.0, 18.0] | [170, 200] |
p04048 | u697658632 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['import math\nn, x = map(int, input().split())\nprint(3 * (n - gcd(n, x)))\n', 'import math\nn, x = map(int, input().split())\nprint(3 * (n - math.gcd(n, x)))\n'] | ['Runtime Error', 'Accepted'] | ['s297220978', 's109261748'] | [9116.0, 9064.0] | [23.0, 27.0] | [72, 77] |
p04048 | u745087332 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['n, x = map(int, input().split())\n\ndef func(a, b):\n if a < b:\n if b%a == 0:\n return b/a*2 - 1\n else:\n return 2*a + func(a, b-a)\n else:\n if a%b == 0:\n return a/b*2 - 1\n else:\n return 2*b + func(a-b, b)\n \nif x == n/2:\n print(3*x)\nelse:\n print(x+(n-x)+func(x,n-x))', "# coding:utf-8\n\nimport sys\n\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef II(): return int(sys.stdin.readline())\ndef SI(): return input()\n\n\ndef main():\n n, x = LI()\n\n b, a = sorted([x, n - x])\n ans = a + b\n while b:\n q, mod = divmod(a, b)\n ans += (2 * q - (not mod)) * b\n a, b = b, mod\n\n return ans\n\n\nprint(main())\n"] | ['Runtime Error', 'Accepted'] | ['s836690284', 's994394061'] | [3952.0, 3188.0] | [74.0, 20.0] | [355, 592] |
p04048 | u787059958 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['n, x = map(int, input().split())\na, b = max(n-x,x),min(n-x,x)\nres = a+b\nwhile b!=0:\n q = a/b\n r = a%b\n res += (b*2)*q\n if (r==0):\n res -= b\n a, b = b, r\n\nprint(res)', 'n, x = map(int, input().split())\nans = 0\na, b = max(n-x,x),min(n-x,x)\nres = a+b\nwhile b:\n q = a/b\n r = a%b\n res += (b*2)*q\n if (r==0):\n res -= b\n a, b = b, r\n\nprint(res)', 'n, x = map(int, input().split())\na, b = max(n-x,x),min(n-x,x)\nres = a+b\nwhile b!=0:\n q = a//b\n r = a%b\n res += (b*2)*q\n if (r==0):\n res -= b\n a, b = b, r\n\nprint(res)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s097379139', 's548884385', 's504779492'] | [3060.0, 3188.0, 3188.0] | [18.0, 21.0, 19.0] | [186, 191, 187] |
p04048 | u820560680 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['N, X = map(int, input().split())\npath = N\na, b = X, N - X\nif a < b:\n a, b = b, a\nwhile b > 0:\n print(a, b)\n path += b * (a // b) * 2\n a, b = b, a % b\npath -= a\nprint(path)', 'N, X = map(int, input().split())\npath = N\na, b = X, N - X\nif a < b:\n a, b = b, a\nwhile b > 0:\n path += b * (a // b) * 2\n a, b = b, a % b\npath -= a\nprint(path)'] | ['Wrong Answer', 'Accepted'] | ['s908573544', 's106788899'] | [3060.0, 3060.0] | [17.0, 17.0] | [183, 167] |
p04048 | u856671164 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['N,X = input().split()\nN,X = int(N), int(X)\nanswer = X+ (N-X)\n\n\ndef rhombus(N,X):\n \tif N<X:\n temp = N\n N = X\n X = temp \n \n if X==1: \n return N+1\n if X==0:\n return 0\n\n if N%X == 0:\n return X*(N//X)*2-X\n \n else: \n k = N//X\n return k*2*X + rhombus(X,N-(k*X))\n\n \n\nanswer = answer + rhombus(N-X,X)\nprint(answer)', 'N,X = input().split()\nN,X = int(N), int(X)\nanswer = X+ (N-X)\n\n\ndef rhombus(N,X):\n \t\n if X==1: \n return N*2-1\n if X==0:\n return 0\n\n if N%X == 0:\n return X*(N//X)*2-X\n \n else: \n k = N//X\n return k*2*X + rhombus(X,N-(k*X))\n\n \n\nanswer = answer + rhombus(N-X,X)\nprint(answer)'] | ['Runtime Error', 'Accepted'] | ['s311100241', 's323769427'] | [8880.0, 9140.0] | [25.0, 28.0] | [391, 328] |
p04048 | u874303957 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['N, X = input().split()\n\nprint(3 * int(N))', 'N, X = map(int, input().split())\nq, p = sorted((N - X, X))\n\nr = 1\nwhile r:\n p, r = divmod(p, q)\n N += (2 * p - (r == 0)) * q\n p, q = q, r\n\nprint(N)'] | ['Wrong Answer', 'Accepted'] | ['s475209552', 's860314589'] | [2940.0, 2940.0] | [17.0, 17.0] | [41, 156] |
p04048 | u879870653 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['import sys\nsys.setrecursionlimit(10**12+1)\n\nN,X = map(int,input().split())\n\ndef f(a,b) :\n if a < b :\n return 2*a + f(a,b-a)\n elif a > b :\n a,b = b,a\n return 2*a + f(a,b-a)\n else :\n return a\n\nans = N + f(X,N-X)\n\nprint(ans)\n', 'N,X = map(int,input().split())\n\ndef f(a,b) :\n if a > b :\n a,b = b,a\n if b % a == 0 :\n return 2*(b//a-1)*a + a\n else :\n return 2*(b//a)*a + f(a,b%a)\n \nans = N + f(X,N-X)\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s883872348', 's783693060'] | [2940.0, 3060.0] | [18.0, 18.0] | [259, 218] |
p04048 | u902468164 | 2,000 | 262,144 | Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of _Mysterious Light_. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap = X. (The size of the rifle is negligible.) Now, the rifle is about to fire a ray of Mysterious Light in the direction of bc. The ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as "ordinary" light. There is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror! When the ray comes back to the rifle, the ray will be absorbed. The following image shows the ray's trajectory where N = 5 and X = 2. It can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X. Find the total length of the ray's trajectory. | ['import fraction\n\nli = [int(i) for i in input().split(" ")]\nres = (li[0] // fraction.gcd(li[0], li[1]) -1) * 3 * fraction.gcd(li[0], li[1])\nprint(res)', 'def gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\nli = [int(i) for i in input().split(" ")]\nres = (li[0] // gcd(li[0], li[1]) -1) * 3 * gcd(li[0], li[1])\nprint(res)'] | ['Runtime Error', 'Accepted'] | ['s936674618', 's156822289'] | [2940.0, 3060.0] | [18.0, 19.0] | [149, 168] |
p04050 | u227082700 | 2,000 | 262,144 | Snuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties: * The sum of all elements of a is N. * The sum of all elements of b is N. * Any string of length N that satisfies the following two conditions (1) and (2) will also satisfy the condition (3). * **(1)** Any of the following forms a palindrome: the first a_1 letters, the following a_2 letters, the following a_3 letters and so on. * **(2)** Any of the following forms a palindrome: the first b_1 letters, the following b_2 letters, the following b_3 letters and so on. * **(3)** All N letters are the same. He was happy, until one day he lost both of the sequences. Now, he only remembers that the sequence a was a permutation of another sequence A of length M. To bring him happiness again, his mother has decided to give him another pair of sequences a and b that satisfies his favorite properties and is consistent with his memory. | ['n,m=map(int,input().split())\na=list(map(int,input().split()))\nb=[]\no=[]\nfor i in a:\n if i%2:o.append(i)\n else:b.append(i)\nif len(o)>2:print("Impossible");exit()\nif len(o)==1:b=o+b\nelif len(o)==2:b=[o[0]]+b+[o[1]]\nans=[]\nfor i in range(len(b)):\n if i==0:ans.append(b[i]-1)\n elif i==len(b)-1:ans.append(b[i]+1)\n else:ans.append(b[i])\nanss=[]\nfor i in ans:\n if i!=0:anss.append(i)\nif sum(anss)!=n:anss.append(n-sum(anss))\nprint(*a)\nprint(len(anss))\nprint(*anss)', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\nb=[]\no=[]\nfor i in a:\n if i%2:o.append(i)\n else:b.append(i)\nif len(o)>2:print("Impossible");exit()\nif len(o)==1:b=o+b\nelif len(o)==2:b=[o[0]]+b+[o[1]]\nans=[]\nfor i in range(len(b)):\n if i==0:ans.append(b[i]-1)\n elif i==len(b)-1:ans.append(b[i]+1)\n else:ans.append(b[i])\nanss=[]\nfor i in ans:\n if i!=0:anss.append(i)\nif sum(anss)!=n:anss.append(n-sum(anss))\nprint(*b)\nprint(len(anss))\nprint(*anss)'] | ['Wrong Answer', 'Accepted'] | ['s498481701', 's571339864'] | [3064.0, 3064.0] | [18.0, 18.0] | [464, 464] |
p04051 | u102461423 | 2,000 | 262,144 | Snuke is having another barbeque party. This time, he will make one serving of _Skewer Meal_. He has a stock of N _Skewer Meal Packs_. The i-th Skewer Meal Pack contains one skewer, A_i pieces of beef and B_i pieces of green pepper. All skewers in these packs are different and distinguishable, while all pieces of beef and all pieces of green pepper are, respectively, indistinguishable. To make a Skewer Meal, he chooses two of his Skewer Meal Packs, and takes out all of the contents from the chosen packs, that is, two skewers and some pieces of beef or green pepper. (Remaining Skewer Meal Packs will not be used.) Then, all those pieces of food are threaded onto both skewers, one by one, in any order. (See the image in the Sample section for better understanding.) In how many different ways can he make a Skewer Meal? Two ways of making a Skewer Meal is different if and only if the sets of the used skewers are different, or the orders of the pieces of food are different. Since this number can be extremely large, find it modulo 10^9+7. | ['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nimport numpy as np\n\nMOD = 10 ** 9 + 7\n\nN = int(readline())\nm = map(int,read().split())\nAB = zip(m,m)\n\nD = 2000\n\ndef cumprod(arr,MOD):\n L = len(arr); Lsq = int(L**.5+1)\n arr = np.resize(arr,Lsq**2).reshape(Lsq,Lsq)\n for n in range(1,Lsq):\n arr[:,n] *= arr[:,n-1]; arr[:,n] %= MOD\n for n in range(1,Lsq):\n arr[n] *= arr[n-1,-1]; arr[n] %= MOD\n return arr.ravel()[:L]\n\ndef make_fact(U,MOD):\n x = np.arange(U,dtype=np.int64); x[0] = 1\n fact = cumprod(x,MOD)\n x = np.arange(U,0,-1,dtype=np.int64); x[0] = pow(int(fact[-1]),MOD-2,MOD)\n fact_inv = cumprod(x,MOD)[::-1]\n return fact,fact_inv\n\nfact,fact_inv = make_fact(10 ** 4,MOD)\nfact = fact.tolist()\nfact_inv = fact_inv.tolist()\n\nC_to_A = [[] for _ in range(D+D+1)]\nremove = 0\nfor a,b in AB:\n c = a+b\n C_to_A[c].append(D-a)\n remove += fact[c+c] * fact_inv[a+a] * fact_inv[b+b]\nremove %= MOD\n\ndp = np.zeros(D+D+1,np.int64)\nfor A in C_to_A[::-1]:\n dp[:0:-1] += dp[-1::-1]\n np.add.at(dp,A,1)\n dp %= MOD\n\nx = (dp * dp[::-1] % MOD).sum() % MOD\nx -= remove\nif x&1:\n x += MOD\nx //= 2\nx %= MOD\n\nprint(x)\n', 'import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nimport numpy as np\n\nMOD = 10 ** 9 + 7\n\nN = int(readline())\nm = map(int,read().split())\nAB = zip(m,m)\n\nD = 2000\n\nU = 10 ** 4\nfact = [1] * U\nfor n in range(1,U):\n fact[n] = fact[n-1] * n % MOD\nfact_inv = [1] * U\nfact_inv[-1] = pow(fact[-1],MOD-2,MOD)\nfor n in range(U-1,0,-1):\n fact_inv[n-1] = fact_inv[n] * n % MOD\n\nC_to_A = [[] for _ in range(D+D+1)]\nY = 0\nfor a,b in AB:\n c = a+b\n C_to_A[c].append(D-a)\n Y += fact[c+c] * fact_inv[a+a] * fact_inv[b+b]\nY %= MOD\n\nf = np.zeros(D+D+1,np.int64)\nfor A in C_to_A[::-1]:\n f[1:] += f[:-1].copy()\n np.add.at(f,A,1)\n f %= MOD\nX = (f * f[::-1] % MOD).sum() % MOD\n\nanswer = (X - Y) * fact_inv[2] % MOD\nprint(answer)'] | ['Runtime Error', 'Accepted'] | ['s389585547', 's283438001'] | [40124.0, 40384.0] | [451.0, 761.0] | [1223, 794] |