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
|
---|---|---|---|---|---|---|---|---|---|---|
p03747 | u146346223 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ["n, l, t = map(int, input().split())\n\narr = []\nfor i in range(n):\n x, w = map(int, input().split())\n\n if w == 1:\n arr.append((x+t) % l)\n s += (x+t) // l\n else: # W == 2:\n arr.append((x-t) % l)\n s += (x-t) // l\n\narr.sort()\ns %= n\narr = arr[s:] + arr[:s]\nprint(*[i for i in arr], sep='\\n')", "n, l, t = map(int,input().split())\n\nc = []\ns = 0\n\nfor i in range(n):\n x, w = map(int,input().split())\n if w == 1:\n c.append((x+t)%l)\n s += (x+t)//l\n else: # w == 2:\n c.append((x-t)%l)\n s += (x-t)//l\n\nc.sort()\ns %= n\nc = c[s:] + c[:s]\nprint(c)\n\nprint([i for i in c], sep='\\n')", "n, l, t = map(int,input().split())\n\nc = []\ns = 0\n\nfor i in range(n):\n x, w = map(int,input().split())\n if w == 1:\n c.append((x+t)%l)\n s += (x+t)//l\n else: # w == 2\n c.append((x-t)%l)\n s += (x-t)//l\n\nc.sort()\ns %= n\nc = c[s:] + c[:s]\nprint(*[i for i in c], sep='\\n')"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s406678594', 's453481246', 's360805666'] | [3064.0, 12940.0, 9688.0] | [17.0, 409.0, 417.0] | [323, 312, 302] |
p03747 | u193264896 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ["import sys\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\ndef main():\n N, L, T = map(int, readline().split())\n position = []\n \n \n count = 0\n for i in range(N):\n x,w = map(int, readline().split())\n if w==1:\n count += (x+T)//L\n position.append((x+T)%L)\n else:\n if x-T<0:\n count += (x-T+1)//L\n position.append((x-T)%L)\n position.sort()\n if count>=0:\n ans = position[count:] + position[:count]\n print(ans)\n\n\nif __name__ == '__main__':\n main()", "import sys\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\ndef main():\n N, L, T = map(int, readline().split())\n position = []\n \n \n count = 0\n for i in range(N):\n x,w = map(int, readline().split())\n if w==1:\n count += (x+T)//L\n position.append((x+T)%L)\n else:\n if x-T<0:\n count += (x-T+1)//L\n position.append((x-T)%L)\n position.sort()\n count %= N\n ans = position[count:] + position[:count]\n for i in range(N):\n print(ans[i])\n\n\nif __name__ == '__main__':\n main()"] | ['Runtime Error', 'Accepted'] | ['s723042914', 's947586238'] | [11756.0, 8944.0] | [186.0, 236.0] | [721, 745] |
p03747 | u214434454 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ['n,l,T = map(int,input().split())\ns = [0 for i in range(n)]\nfor i in range(n):\n s[i] = list(map(int, input().split()))\n\ndef f(w):\n if w == 1:\n return 1\n elif w == 2:\n return -1\n \nt = 0\nd = l\ni_d = []\n\nwhile t < T:\n for i in range(n):\n if i < n-1 :\n if s[i][0] < s[i+1][0] and s[i][1] == 1 and s[i+1][1] == 2:\n if s[i+1][0] - s[i][0] < d:\n d = s[i+1][0] - s[i][0]\n \n elif s[i][0] > s[i+1][0] and s[i][1] == 1 and s[i+1][1] == 2:\n if s[i+1][0] + l - s[i][0] < d:\n d = s[i+1][0] + l - s[i][0]\n \n elif i == n-1:\n if s[i][0] < s[0][0] and s[i][1] == 1 and s[0][1] == 2:\n if s[0][0] - s[i][0] < d:\n d = s[0][0] - s[i][0]\n \n elif s[i][0] > s[0][0] and s[i][1] == 1 and s[0][1] == 2:\n if s[0][0] + l - s[i][0] < d:\n d = s[0][0] + l - s[i][0]\n \n for i in range(n):\n if i < n-1 :\n if s[i][0] < s[i+1][0] and s[i][1] == 1 and s[i+1][1] == 2:\n if s[i+1][0] - s[i][0] == d:\n i_d.append(i)\n elif s[i][0] > s[i+1][0] and s[i][1] == 1 and s[i+1][1] == 2:\n if s[i+1][0] + l - s[i][0] == d:\n i_d.append(i)\n \n elif i == n-1:\n if s[i][0] < s[0][0] and s[i][1] == 1 and s[0][1] == 2:\n if s[0][0] - s[i][0] == d:\n i_d.append(i)\n \n elif s[i][0] > s[0][0] and s[i][1] == 1 and s[0][1] == 2:\n if s[0][0] + l - s[i][0] == d:\n i_d.append(i)\n \n for j in range(n):\n if t + d/2 <= T:\n s[j][0] += f(s[j][1]) * (d/2)\n if s[j][0] >= l:\n s[j][0] -= l\n elif s[j][0] < 0:\n s[j][0] += l\n \n else:\n s[j][0] += f(s[j][1]) * (T-t)\n if s[j][0] >= l:\n s[j][0] -= l\n elif s[j][0] < 0:\n s[j][0] += l\n for j in i_d:\n if j < n-1:\n s[j][1], s[j+1][1] = s[j+1][1], s[j][1]\n else:\n s[j][1], s[0][1] = s[0][1], s[j][1]\n t = t + d/2\n i_d.clear()\n d = l\n \nimport maht\n\nfor i in range(n):\n print(math.floor(s[i][0]))\n\n\n ', 'n,l,T = map(int,input().split())\ns = [0 for i in range(n)]\nfor i in range(n):\n s[i] = list(map(int, input().split()))\n\ndef f(w):\n if w == 1:\n return 1\n elif w == 2:\n return -1\n \n\nd=[0 for i in range(n)]\nfor i in range(n-1):\n d[i] = s[i+1][0] - s[i][0]\nd[n-1] = s[0][0] + l - s[n-1][0]\n\nt = 0\ndt = 0.5\nwhile t < T:\n t+= dt\n s[0][0] = s[0][0] + f(s[0][1])*dt\n if s[0][0] >= l:\n s[0][0] -= l\n elif s[0][0] < 0:\n s[0][0] += l\n \n for i in range(n):\n if i < n-1:\n d[i] = d[i] + f(s[i+1][1])*dt - f(s[i][1])*dt\n s[i+1][0] = s[i][0] + d[i]\n if s[i+1][0] >= l:\n s[i+1][0] -= l\n else:\n d[n-1] = d[n-1] + f(s[0][1])*dt - f(s[n-1][1])*dt\n \n for i in range(n):\n if d[i] == 0 and i < n-1:\n s[i+1][1], s[i][1] = s[i][1], s[i+1][1]\n elif i == n-1 and d[i] == 0 :\n s[0][1], s[n-1][1] = s[n-1][1], s[0][1]\n \nfor i in range(n):\n print(s[i][0])\n ', 'n,l,T = map(int,input().split())\ns = [0 for i in range(n)]\nfor i in range(n):\n s[i] = list(map(int, input().split()))\n\ndef f(w):\n if w == 1:\n return 1\n elif w == 2:\n return -1\n \nt = 0\nd = l\n\nwhile t < T:\n for i in range(n):\n if i < n-1 :\n if s[i][0] < s[i+1][0] and s[i][1] == 1 and s[i+1][1] == 2:\n if s[i+1][0] - s[i][0] < d:\n d = s[i+1][0] - s[i][0]\n \n elif s[i][0] > s[i+1][0] and s[i][1] == 1 and s[i+1][1] == 2:\n if s[i+1][0] + l - s[i][0] < d:\n d = s[i+1][0] + l - s[i][0]\n \n elif i == n-1:\n if s[i][0] < s[0][0] and s[i][1] == 1 and s[0][1] == 2:\n if s[0][0] - s[i][0] < d:\n d = s[0][0] - s[i][0]\n \n elif s[i][0] > s[0][0] and s[i][1] == 1 and s[0][1] == 2:\n if s[0][0] + l - s[i][0] < d:\n d = s[0][0] + l - s[i][0]\n \n \n for j in range(n):\n if t + d/2 <= T:\n s[j][0] += f(s[j][1]) * (d/2)\n if s[j][0] >= l:\n s[j][0] -= l\n elif s[j][0] < 0:\n s[j][0] += l\n \n else:\n s[j][0] += f(s[j][1]) * (T-t)\n if s[j][0] >= l:\n s[j][0] -= l\n elif s[j][0] < 0:\n s[j][0] += l\n if j > 0 and s[j][0] == s[j-1][0]:\n s[j][1], s[j-1][1] = s[j-1][1], s[j][1]\n if j == n-1 and s[j][0] == s[0][0] :\n s[j][1], s[0][1] = s[0][1], s[j][1]\n \n t = t + d/2\n i_d.clear()\n d = l\n \nimport math\n\nfor i in range(n):\n print(math.floor(s[i][0]))', 'n,l,T = map(int,input().split())\ns = [0 for i in range(n)]\nfor i in range(n):\n s[i] = list(map(int, input().split()))\n\ndef f(w):\n if w == 1:\n return 1\n elif w == 2:\n return -1\n \nt = 0\nd = l\ni_d = []\n\nwhile t < T:\n for i in range(n):\n if i < n-1 :\n if s[i][0] < s[i+1][0] and s[i][1] == 1 and s[i+1][1] == 2:\n if s[i+1][0] - s[i][0] < d:\n d = s[i+1][0] - s[i][0]\n \n elif s[i][0] > s[i+1][0] and s[i][1] == 1 and s[i+1][1] == 2:\n if s[i+1][0] + l - s[i][0] < d:\n d = s[i+1][0] + l - s[i][0]\n \n elif i == n-1:\n if s[i][0] < s[0][0] and s[i][1] == 1 and s[0][1] == 2:\n if s[0][0] - s[i][0] < d:\n d = s[0][0] - s[i][0]\n \n elif s[i][0] > s[0][0] and s[i][1] == 1 and s[0][1] == 2:\n if s[0][0] + l - s[i][0] < d:\n d = s[0][0] + l - s[i][0]\n \n for i in range(n):\n if i < n-1 :\n if s[i][0] < s[i+1][0] and s[i][1] == 1 and s[i+1][1] == 2:\n if s[i+1][0] - s[i][0] == d:\n i_d.append(i)\n elif s[i][0] > s[i+1][0] and s[i][1] == 1 and s[i+1][1] == 2:\n if s[i+1][0] + l - s[i][0] == d:\n i_d.append(i)\n \n elif i == n-1:\n if s[i][0] < s[0][0] and s[i][1] == 1 and s[0][1] == 2:\n if s[0][0] - s[i][0] == d:\n i_d.append(i)\n \n elif s[i][0] > s[0][0] and s[i][1] == 1 and s[0][1] == 2:\n if s[0][0] + l - s[i][0] == d:\n i_d.append(i)\n \n for j in range(n):\n if t + d/2 <= T:\n s[j][0] += f(s[j][1]) * (d/2)\n if s[j][0] >= l:\n s[j][0] -= l\n elif s[j][0] < 0:\n s[j][0] += l\n \n else:\n s[j][0] += f(s[j][1]) * (T-t)\n if s[j][0] >= l:\n s[j][0] -= l\n elif s[j][0] < 0:\n s[j][0] += l\n for j in i_d:\n if j < n-1:\n s[j][1], s[j+1][1] = s[j+1][1], s[j][1]\n else:\n s[j][1], s[0][1] = s[0][1], s[j][1]\n t = t + d/2\n i_d.clear()\n d = l\n \nfor i in range(n):\n print(s[i][0])\n\n\n ', 'from math import floor\nn,l,t = map(int,input().split())\nants = []\ntouch = 0\n\nfor i in range(n):\n x, w = map(int,input().split())\n if w == 1:\n touch += (x + t) // l\n x1 = (x + t) % l\n else:\n touch += (x - t) // l\n x1 = (x - t) % l\n ants.append(x1)\ntouch = touch % n\nants.sort()\nants = ants[touch:]+ants[:touch]\n\nfor i in range(n):\n print(ants[i])\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s035453455', 's585026803', 's725151298', 's783961366', 's168923431'] | [25112.0, 28144.0, 24248.0, 25108.0, 8648.0] | [2105.0, 2109.0, 576.0, 2105.0, 443.0] | [2413, 1031, 1733, 2388, 389] |
p03747 | u218843509 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ['from bisect import bisect_left\nn, l, t = map(int, input().split())\nants = [list(map(int, input().split())) for _ in range(n)]\nbnts = []\ndiff = []\n\nfor i in range(n):\n\tx, w = ants[i][0], 3 - 2*ants[i][1]\n\tbnts.append((x + t*w) % l)\n\tif i == 0:\n\t\tzero = bnts[-1]\n\tif ants[i][1] != ants[0][1]:\n\t\tif ants[0][1] == 1:\n\t\t\tdiff.append(x - ants[0][0])\n\t\telse:\n\t\t\tdiff.append(l - (x - ants[0][0]))\n\nbnts.sort()\nnum = 0\nquo, mod = t//l, t%l\nnum += quo * len(diff) * 2\ndiff.sort()\ndiff += [d+l for d in diff]\nnum += bisect_left(diff, mod*2)\nnum %= n\nfor i in range(n):\n\tif bnts[i] == zero:\n\t\tif ants[0][0] == 1:\n\t\t\ttrue_zero = (i-num) % n\n\t\telse:\n\t\t\ttrue_zero = (i+num) % n\n\nans = bnts[true_zero:] + bnts[:true_zero]\nprint(*ans, sep="\\n")', 'from bisect import bisect_left, bisect\nn, l, t = map(int, input().split())\nants = [list(map(int, input().split())) for _ in range(n)]\nbnts = []\ndiff = []\n\nfor i in range(n):\n\tx, w = ants[i][0], 3 - 2*ants[i][1]\n\tbnts.append((x + t*w) % l)\n\tif i == 0:\n\t\tzero = bnts[-1]\n\tif ants[i][1] != ants[0][1]:\n\t\tif ants[0][1] == 1:\n\t\t\tdiff.append(x - ants[0][0])\n\t\telse:\n\t\t\tdiff.append(l - (x - ants[0][0]))\n\nbnts.sort()\nnum = 0\nquo, mod = t//l, t%l\nnum += quo * len(diff) * 2\ndiff.sort()\ndiff += [d+l for d in diff]\n\nnum += bisect(diff, mod*2)\nnum %= n\nfor i in range(n):\n\tif bnts[i] == zero:\n\t\tif ants[0][1] == 1:\n\t\t\ttrue_zero = (i-num) % n\n\t\telse:\n\t\t\tif i < n-1:\n\t\t\t\tif bnts[i+1] == zero:\n\t\t\t\t\t#pass\n\t\t\t\t\tnum -= 1\n\t\t\ttrue_zero = (i+num) % n\n\nans = bnts[true_zero:] + bnts[:true_zero]\nprint(*ans, sep="\\n")'] | ['Wrong Answer', 'Accepted'] | ['s895043525', 's998286865'] | [35992.0, 35692.0] | [468.0, 470.0] | [727, 829] |
p03747 | u450288159 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ["# -*- coding: utf-8 -*-\ndef new_place(ant, l, t):\n x = ant[0]\n w = ant[1]\n a = t%l\n if w == 1:\n new = x + a\n if new >= l:\n new -= l\n else:\n new = x - a\n if new < 0:\n new += l\n return new\n\ndef num_cross(ant1, ant2, l, t):\n if ant1[1] == ant2[1]:\n return 0\n else:\n if ant1[1] == 1:\n if t <= (ant2[0] - ant1[0])/2:\n return 0\n else:\n return(t - (ant2[0] - ant1[0])/2)//l + 1\n else:\n if t - (ant1[0] + l -ant2[0])/2 <= 0:\n return 0\n else:\n return(t - (ant1[0] + l -ant2[0])/2)//l + 1\ndef main():\n N, L, T = map(int, input().split())\n ants = []\n for i in range(N):\n ants.append(list(map(int, input().split())))\n new = []\n output = []\n # answer = []\n \n # output.append(int(input()))\n for ant in ants:\n new.append(new_place(ant, L, T))\n print(new)\n sum = 0\n for i in range(1, N):\n # print(int(num_cross(ants[0], ants[i], L, T)))\n sum += int(num_cross(ants[0], ants[i], L, T))\n if ants[0][1] == 1:\n ant_num = (1+sum)%N\n else:\n ant_num = N*(1+(-1)*(1-sum)//N) - (-1)*(1-sum)\n print(ant_num)\n for i in range(ant_num, N):\n # answer.append(new[i])\n print(new[i])\n for i in range(ant_num):\n # answer.append(new[i])\n print(new[i])\n # if answer == output:\n # print('OK')\n # else:\n # print('No')\n \n \n \n \n \n # print(ii)\n # # print(new[ii])\n\n \nif __name__ == '__main__':\n main()", "import sys\nimport numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN, L, T = map(int, readline().split())\nXW = np.array(read().split(), np.int64)\nX = XW[::2]\nW = XW[1::2]\n\nspeed = np.where(W == 1, 1, -1)\n\nY = X + speed * T\n\nn = (Y // L - X // L).sum()\nn %= N\n\nY %= L\nY.sort()\nY = np.concatenate((Y[n:], Y[:n]))\n\nprint('\\n'.join(map(str, Y.tolist())))\n"] | ['Wrong Answer', 'Accepted'] | ['s136667342', 's541598399'] | [29984.0, 41468.0] | [305.0, 170.0] | [1778, 591] |
p03747 | u499381410 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ["normal_ant = [i for i, direction in ants if direction==1]\ncounter_ant = [i for i, direction in ants if direction==2]\ncnt = (t // l) * len(normal_ant) + sum([1 for i in normal_ant if i + t%l >= l])\ncounter_cnt = (t // l) * len(counter_ant) + sum([1 for i in counter_ant if i - t%l < 0])\nfinal_pos = sorted([(i-t)%l for i in counter_ant] + [(i+t)%l for i in normal_ant])\nprint(*final_pos[(cnt-counter_cnt)%n:] + final_pos[:(cnt-counter_cnt)%n], sep='\\n')", "n, l, t = list(map(int, input().split()))\nants = []\nfor i in range(n):\n ants.append(list(map(int, input().split())))\nnormal_ant = [i for i, direction in ants if direction==1]\ncounter_ant = [i for i, direction in ants if direction==2]\ncnt = (t // l) * len(normal_ant) + sum([1 for i in normal_ant if i + t%l >= l])\ncounter_cnt = (t // l) * len(counter_ant) + sum([1 for i in counter_ant if i - t%l < 0])\nfinal_pos = sorted([(i-t)%l for i in counter_ant] + [(i+t)%l for i in normal_ant])\nprint(*final_pos[(cnt-counter_cnt)%n:] + final_pos[:(cnt-counter_cnt)%n], sep='\\n')"] | ['Runtime Error', 'Accepted'] | ['s231295638', 's530515909'] | [3064.0, 32312.0] | [17.0, 413.0] | [452, 572] |
p03747 | u524039871 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ['from math import floor\nn,l,t=map(int,input().split())\nli=[]\ns=0\nfirst=1\nxmin=l\nxminind=0\nfor _ in range(n):\n x,w=map(int,input().split())\n if first==1:\n xf=x\n wf=w\n first=0\n if w==1:\n x1=(x+t)%l\n else:\n x1=(x-t)%l\n if x1<xmin:\n xmin=x1\n xminind=_\n if wf!=w:\n tf=(x-xf)/2\n if t>tf:\n s+=1\n s+=floor((t-tf)/(l/2))\n li.append(x1)\n\nli.sort()\nfor _ in range(n):\n print(li[(_+s+xminind)%n])', 'from math import floor\nn,l,t=map(int,input().split())\nli=[]\nzero=0\nfor _ in range(n):\n x,w=map(int,input().split())\n \n if w==1:\n zero+=(x+t)//l\n x1=(x+t)%l\n else:\n zero+=(x-t)//l\n x1=(x-t)%l\n li.append(x1)\nzero%=n\nli.sort()\nli=li[zero:]+li[:zero]\nfor _ in range(n):\n print(li[_])'] | ['Wrong Answer', 'Accepted'] | ['s842223139', 's467733181'] | [8184.0, 8648.0] | [515.0, 455.0] | [428, 310] |
p03747 | u532966492 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ['def input():return next(input_sample)\ninput_sample=iter("""\n4 20 9\n7 2\n9 1\n12 1\n18 1\n""".split("\\n")[1:-1])\n\n\nn,l,t=map(int,input().split())\nxw=[list(map(int,input().split())) for _ in [0]*n]\n\nfirst_x=xw[0][0]\nfirst_w=xw[0][1]\n\nright=[]\nleft=[]\n\nfor x,w in xw:\n if w==1:\n right.append(x)\n else:\n left.append(x)\n\nif first_w==1:\n left=[(i-first_x)/2 for i in left]\n right.reverse()\n right=[(l+first_x-i)/2 for i in right]\nelse:\n right=[(l+first_x-i)/2 for i in right]\n right.reverse()\n left=[(i-first_x)/2 for i in left[1:]]+[l/2]\n \nll=len(left)\nlr=len(right)\n\ndef search(cnt):\n w=first_w\n if ll==0 or lr==0:\n return None\n elif cnt==0:\n return [0,0,0]\n elif w==1:\n right_temp=((cnt//2+cnt%2-1)//ll)*(l/2)+left[(cnt//2+cnt%2-1)%ll]\n left_temp=max((((cnt-2)//2)//lr),0)*(l/2)+right[((cnt-2)//2)%lr]*(cnt!=1)\n else:\n left_temp=((cnt//2+cnt%2-1)//lr)*(l/2)+right[(cnt//2+cnt%2-1)%lr]\n right_temp=max((((cnt-1)//2)//ll),0)*(l/2)+left[((cnt-2)//2)%ll]*(cnt!=1)\n return [left_temp+right_temp,right_temp,left_temp]\n\ndef b_search(a,b,p,value):\n med=(a+b)//2\n if a==b:return a\n if a+1==b:\n if value(b)[0]<=p:return b\n else:return a\n elif value(med)[0]<=p:return b_search(med,b,p,value)\n else:return b_search(a,med-1,p,value)\n\na=b_search(0,10**9,t,search)\n\nif a==False:\n last=((first_x+t*int((-first_w+1.5)*2))%l+l)%l\nelse:\n b=search(a)\n if (a+first_w)%2==1:\n b[1]+=t-b[0]\n else:\n b[2]+=t-b[0]\n last=int(((first_x+b[1]-b[2])%l+l)%l)\n \nans=sorted([((x+t*int((-w+1.5)*2))%l+l)%l for x,w in xw])\n \nfor i in range(n):\n if last==ans[i]:\n if i==n-1:\n break\n elif ans[i+1]!=last:\n break\n else:\n if (a+first_w)%2==1:\n break\n else:\n i+=1\n break\nfor j in ans[i:]+ans[:i]:\n print(j)', 'n,l,t=map(int,input().split())\nxw=[list(map(int,input().split())) for _ in [0]*n]\n\nfirst_x=xw[0][0]\nfirst_w=xw[0][1]\n\nright=[]\nleft=[]\n\nfor x,w in xw:\n if w==1:\n right.append(x)\n else:\n left.append(x)\n\nif first_w==1:\n left=[(i-first_x)/2 for i in left]\n right.reverse()\n right=[(l+first_x-i)/2 for i in right]\nelse:\n right=[(l+first_x-i)/2 for i in right]\n right.reverse()\n left=[(i-first_x)/2 for i in left[1:]]+[l/2]\n \nll=len(left)\nlr=len(right)\n\ndef search(cnt):\n w=first_w\n if ll==0 or lr==0:\n return None\n elif cnt==0:\n return [0,0,0]\n elif w==1:\n right_temp=((cnt//2+cnt%2-1)//ll)*(l/2)+left[(cnt//2+cnt%2-1)%ll]\n left_temp=max((((cnt-2)//2)//lr),0)*(l/2)+right[((cnt-2)//2)%lr]*(cnt!=1)\n else:\n left_temp=((cnt//2+cnt%2-1)//lr)*(l/2)+right[(cnt//2+cnt%2-1)%lr]\n right_temp=max((((cnt-1)//2)//ll),0)*(l/2)+left[((cnt-2)//2)%ll]*(cnt!=1)\n return [left_temp+right_temp,right_temp,left_temp]\n\ndef b_search(a,b,p,value):\n med=(a+b)//2\n if a==b:return a\n if a+1==b:\n if value(b)[0]<=p:return b\n else:return a\n elif value(med)[0]<=p:return b_search(med,b,p,value)\n else:return b_search(a,med-1,p,value)\n\nif ll==0 or lr==0:\n last=((first_x+t*int((-first_w+1.5)*2))%l+l)%l\nelse:\n a=b_search(0,10**9,t,search)\n b=search(a)\n if (a+first_w)%2==1:\n b[1]+=t-b[0]\n else:\n b[2]+=t-b[0]\n last=int(((first_x+b[1]-b[2])%l+l)%l)\n \nans=sorted([((x+t*int((-w+1.5)*2))%l+l)%l for x,w in xw])\n \nfor i in range(n):\n if last==ans[i]:\n if i==n-1:\n break\n elif ans[i+1]!=last:\n break\n else:\n if (a+first_w)%2==1:\n i+=1\n break\n else:\n break\nfor j in ans[i:]+ans[:i]:\n print(j)'] | ['Wrong Answer', 'Accepted'] | ['s928412921', 's590143660'] | [3192.0, 34692.0] | [18.0, 504.0] | [1955, 1838] |
p03747 | u562016607 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ['N,L,T=map(int,input().split())\nX=[0 for i in range(N)]\nW=[0 for i in range(N)]\nfor i in range(N):\n X[i],W[i]=map(int,input().split())\n W[i]=-2*W[i]+3\nY0=((T*W[0])+X[0])%L\nY=sorted([((T*W[i])+X[i])%L for i in range(N)])\nR=[0 for i in range(N)]\nZ=0\nfor i in range(1,N):\n if W[i]==W[0]:\n R[i]=0\n else:\n if T*2<abs(X[i]-X[0]):\n R[i]=0\n else:\n R[i]=1+(T*2-abs(X[i]-X[0]))//L\n Z+=W[0]*R[i]\nZ%=N\nQ=[]\nA=0\nfor i in range(Z,N):\n if Y[i]==Y0:\n A=i\n break\nfor i in range(A,N):\n Q.append(Y[i])\nfor i in range(A):\n Q.append(Y[i])\nfor i in range(N):\n print(Q[i])\n', 'N,L,T=map(int,input().split())\nX=[0 for i in range(N)]\nW=[0 for i in range(N)]\nD=0\nfor i in range(N):\n X[i],W[i]=map(int,input().split())\n W[i]=-2*W[i]+3\n D+=(X[i]+T*W[i])//L\nD%=N\nY=sorted([((T*W[i])+X[i])%L for i in range(N)])\nfor i in range(N):\n print(Y[(D+i)%N])'] | ['Wrong Answer', 'Accepted'] | ['s064501120', 's426678095'] | [15796.0, 12968.0] | [513.0, 496.0] | [633, 277] |
p03747 | u602860891 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ['\nant_list = [] \n\nN, L, T = list(map(int, input().split()))\nfor i in range(N):\n pos, direction = list(map(int, input().split()))\n ant_list.append(Ant(pos, direction))\n\nfor t in range(T):\n clide_ant_list = get_colide_ants(ant_list)\n for ant in colide_ant_list:\n ant.change_direction()\n\n for ant in ant_list:\n ant.move()\n\n clide_ant_list = get_colide_ants(ant_list)\n for ant in colide_ant_list:\n ant.change_direction()\n ant.move()\n\ndef get_colide_ants(ant_list):\n colide_ant_list = []\n sorted(ant_list, key=lambda ant: ant.pos)\n len_ant_list = len(ant_list)\n for i in range(len_ant_list-1):\n if ant_list[index].pos == ant_list[index+1].pos:\n colide_ant_list.append((ant_list[i], ant_list[i+1]))\n \n return colide_ant_list\n \n\nclass Ant:\n def __init__(self, pos, direction):\n self.pos = pos\n self.direction = direction\n\n def move():\n if direction == 1:\n self.pos += 1\n else:\n self.pos -= 1\n\n if self.pos >= L:\n self.pos = self.pos - L\n if self.pos < 0:\n self.pos += L + self.pos\n\n def change_direction():\n if direction == 1:\n direction = 2\n else:\n direction = 1\n \n', 'N, L, T = list(map(int, input().split()))\n\nX = []\nW = []\nX_after = []\nfor _ in range(N):\n x, w = list(map(int, input().split()))\n if w == 1:\n x_after = (x + T) % L\n else:\n x_after = (x - T) % L\n\n if x_after < 0:\n x_after = L + x_after\n\n X.append(x)\n W.append(w)\n X_after.append(x_after)\n\nn_colide = 0\nfor i in range(1, N):\n if W[0] == 1 and W[i] == 2:\n dist = X[i] - X[0]\n n_colide += 2 * (T - (dist / 2)) // L + 1\n elif W[0] == 2 and W[i] == 1:\n dist = (L + X[0]) - X[i]\n n_colide += 2 * (T - (dist / 2)) // L + 1\n\nif W[0] == 1:\n num_after = W[0] + (n_colide % N)\nelse:\n num_after = W[0] - (n_colide % N)\n num_after = num_after if num_after >= 0 else L + num_after\n\nnum_after = int(num_after)\n\nlast_info = [\n {"X": X_after[0], "num": num_after}\n]\nx_after_first = X_after[0]\nX_after = sorted(X_after)\ni = X_after.index(x_after_first)\nX_after = X_after[i:] + X_after[:i]\n\nfor i in range(1, N):\n num = num_after + i\n if num >= N:\n num = N - num\n last_info.append({\n "X": X_after[i],\n "num": num,\n })\n\nsorted_info = sorted(last_info, key=lambda info: info["num"])\n\nfor info in sorted_info:\n print(info["X"])\n', 'N, L, T = list(map(int, input().split()))\n\nX = []\nW = []\nX_after = []\nfor _ in range(N):\n x, w = list(map(int, input().split()))\n if w == 1:\n x_a = (x + T) % L\n else:\n x_a = (x - T) % L\n x_a = x_a if x_a >= 0 else L + x_a\n X.append(x)\n W.append(w)\n X_after.append(x_a)\n\nn_colide = 0\nfor i in range(1, N):\n if W[0] == 1 and W[i] == 2:\n dist = X[i] - X[0]\n n_colide += 2 * (T - (dist / 2)) // L + 1\n elif W[0] == 2 and W[i] == 1:\n dist = (L + X[0]) - X[i]\n n_colide += 2 * (T - (dist / 2)) // L + 1\n\nif W[0] == 1:\n num_a0 = n_colide % N\nelse:\n num_a0 = N - (n_colide % N)\n\nnum_a0 = int(num_a0)\n\nx_a0 = X_after[0]\nX_after = sorted(X_after)\ni = X_after.index(x_a0)\nif W[0] == 1 and X_after.count(x_a0) == 2:\n i += 1\nX_after = X_after[i-num_a0:] + X_after[:i-num_a0]\n\nfor x_a in X_after:\n print(x_a)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s092688272', 's193092283', 's149952750'] | [3064.0, 48316.0, 13432.0] | [17.0, 625.0, 551.0] | [1312, 1229, 880] |
p03747 | u692632484 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ['import math\ntemp=input().split()\nN=int(temp[0])\nL=int(temp[1])\nT=int(temp[2])\nXW=[[int(j) for j in input().split()] for i in range(N)]\ncount=0\nfor i in range(N):\n\tif XW[i][1]==1:\n\t\tXW[i][0]+=T\n\telse:\n\t\tXW[i][0]-=T\n\tcount+=math.floor(XW[i][0]/L)\n\n#print(count)\n#print(len())\nnewX=[]\nfor i in range(N):\n\tnewX.append(XW[i][0]%L)\nnewX.sort()\nprint(newX)\nfor i in range(N):\n\tprint(newX[(i+count)%N]%L)', 'import math\ntemp=input().split()\nN=int(temp[0])\nL=int(temp[1])\nT=int(temp[2])\nXW=[[int(j) for j in input().split()] for i in range(N)]\ncount=0\nfor i in range(N):\n\tif XW[i][1]==1:\n\t\tXW[i][0]+=T\n\telse:\n\t\tXW[i][0]-=T\n\tcount+=math.floor(XW[i][0]/L)\nif XW[0][1]==1:\n\tfor i in range(1,N):\n\t\tif XW[i][0]<XW[0][0]:\n\t\t\tcount+=int((XW[0][0]-XW[i][0])/L)+1\nelse:\n\tfor i in range(1,N):\n\t\tif XW[i][0]>XW[0][0]:\n\t\t\tcount+=int((XW[i][0]-XW[0][0])/L)+1\nprint(count)\nfor i in range(N):\n\tprint(XW[(i+count)%N][0]%L)', 'import math\ntemp=input().split()\nN=int(temp[0])\nL=int(temp[1])\nT=int(temp[2])\nXW=[[int(j) for j in input().split()] for i in range(N)]\ncount=0\nfor i in range(N):\n\tif XW[i][1]==1:\n\t\tXW[i][0]+=T\n\telse:\n\t\tXW[i][0]-=T\n\tcount+=math.floor(XW[i][0]/L)\nnewX=[]\nfor i in range(N):\n\tnewX.append(XW[i][0]%L)\nnewX.sort()\n#print(newX)\nfor i in range(N):\n\tprint(newX[(i+count)%N]%L)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s182984440', 's252761798', 's086409953'] | [25500.0, 19152.0, 23160.0] | [483.0, 490.0, 493.0] | [595, 497, 368] |
p03747 | u754022296 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ['import sys\ninput = sys.stdin.readline\n\nn, l, t = map(int, input().split())\nXW = [list(map(int, input().split())) for _ in range(n)]\nL = []\ncnt = 0\nfor i, xw in enumerate(XW):\n x, w = xw\n if w == 1:\n L.append((x+t)%l)\n if l-x > t:\n continue\n cnt -= 1 + (t-(l-x))//l\n else:\n L.append((x-t)%l)\n if x > t:\n continue\n cnt += 1 + (t-x)//l\nx_0, w_0 = XW[cnt%n]\nf = L.index((x_0+t*(3-2*w_0))%l)\nfor i in range(f, f+n):\n print(L[i%n])', 'f=lambda:map(int,input().split())\nn,l,t=f()\nX=[0]*n\nb=0\nfor i in range(n):x,w=f();x+=t*(3-2*w);b+=x//l;X[i]=x%l\nX.sort()\nfor i in range(n):print(X[(i+b)%n])'] | ['Wrong Answer', 'Accepted'] | ['s054830229', 's037409175'] | [29296.0, 8136.0] | [306.0, 479.0] | [457, 156] |
p03747 | u854685751 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ['N, L, T = list(map(int, input().split(" ")))\n\n# N,L,T = 3,10,6\n# a = [1,2,3]\n# b = [2,1,1]\n\na = []\nb = []\nfor i in range(N):\n an, ve = map(int, input().split(" "))\n a.append(an)\n b.append(ve)\n\ncrash = 0\n\nfor i in range(1, N):\n if b[0] != b[i]:\n if b[0] == 1:\n crash += (T - ((a[i] - a[0]) / 2)) // (L / 2) + 1\n else:\n crash += (T - (L - (a[i] - a[0])) / 2) // (L / 2) + 1\n\nfor i in range(N):\n if b[i] == 1:\n a[i] += T\n else:\n a[i] -= T\n a[i] %= L\n\n\nif b[0] == 1:\n where = int(crash) % N\nelse:\n where = int(-crash) % N\n\nnowplace = a[where]\na.sort()\n\nif b[0] == 1:\n\tif crash % 2 == 1:\n\t\twhere0 = min([i for i in range(N) if a[i] == nowplace])\n\telse:\n\t\twhere0 = max([i for i in range(N) if a[i] == nowplace])\t\t\nelse:\n\tif crash % 2 == 1:\n\t\twhere0 = max([i for i in range(N) if a[i] == nowplace])\n\telse:\n\t\twhere0 = min([i for i in range(N) if a[i] == nowplace])\n\nwhere0 = (where0 - crash) % N\n\nres = a[where0:] + a[:where0]\nres = map(str, res)\n\nfor i in res:\n print(i)\n', 'N, L, T = list(map(int, input().split(" ")))\n\n# N,L,T = 3,10,6\n# a = [1,2,3]\n# b = [2,1,1]\n\na = []\nb = []\nfor i in range(N):\n an, ve = map(int, input().split(" "))\n a.append(an)\n b.append(ve)\n\ncrash = 0\n\nfor i in range(1, N):\n if b[0] != b[i]:\n if b[0] == 1:\n crash += (T - ((a[i] - a[0]) / 2)) // (L / 2) + 1\n else:\n crash += (T - (L - (a[i] - a[0])) / 2) // (L / 2) + 1\n\nfor i in range(N):\n if b[i] == 1:\n a[i] += T\n else:\n a[i] -= T\n a[i] %= L\n\n\nif b[0] == 1:\n where = int(crash) % N\nelse:\n where = int(-crash) % N\n\nnowplace = a[where]\na.sort()\n\nif b[0] == 1:\n\tif crash % 2 == 1:\n\t\twhere0 = min([i for i in range(N) if a[i] == nowplace])\n\telse:\n\t\twhere0 = max([i for i in range(N) if a[i] == nowplace])\t\t\nelse:\n\tif crash % 2 == 1:\n\t\twhere0 = max([i for i in range(N) if a[i] == nowplace])\n\telse:\n\t\twhere0 = min([i for i in range(N) if a[i] == nowplace])\n\nwhere0 = (where0 - int(crash)) % N\n\nres = a[where0:] + a[:where0]\nres = map(str, res)\n\nfor i in res:\n print(i)\n', 'N, L, T = list(map(int, input().split(" ")))\n\n# N,L,T = 3,10,6\n# a = [1,2,3]\n# b = [2,1,1]\n\na = []\nb = []\nfor i in range(N):\n an, ve = map(int, input().split(" "))\n a.append(an)\n b.append(ve)\n\ncrash = 0\n\nfor i in range(1, N):\n if b[0] != b[i]:\n if b[0] == 1:\n crash += (T - ((a[i] - a[0]) / 2)) // (L / 2) + 1\n else:\n crash += (T - (L - (a[i] - a[0])) / 2) // (L / 2) + 1\n\nfor i in range(N):\n if b[i] == 1:\n a[i] += T\n else:\n a[i] -= T\n a[i] %= L\n\n\nif b[0] == 1:\n where = int(crash) % N\nelse:\n where = int(-crash) % N\n\nnowplace = a[0]\n\na.sort()\n\nif b[0] == 1:\n\twhere0 = max([i for i in range(N) if a[i] == nowplace])\nelse:\n\twhere0 = min([i for i in range(N) if a[i] == nowplace])\n\nwhere0 = (where0 - where) % N\n\nres = a[where0:] + a[:where0]\nres = map(str, res)\n\nfor i in res:\n print(i)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s636786001', 's718199446', 's590611178'] | [8992.0, 9756.0, 9664.0] | [385.0, 464.0, 466.0] | [1044, 1049, 867] |
p03747 | u868982936 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ["import sys\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n \ndef main():\n N, L, T = map(int, readline().split())\n position = []\n count = 0\n for i in range(N):\n x,w = map(int, readline().split())\n if w==1:\n \tcount += (x+T)//L\n position.append((x+T)%L)\n else:\n if x-T<0:\n count += (x-T)//L\n position.append((x-T)%L)\n position.sort()\n count %= N\n ans = position[count:] + position[:count]\n for i in range(N):\n print(ans[i])", "import sys\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n \ndef main():\n N, L, T = map(int, readline().split())\n position = []\n cnt = 0\n for i in range(N):\n x,w = map(int, readline().split())\n if w==1:\n \tcnt += (x+T)//L\n position.append((x+T)%L)\n else:\n if x-T<0:\n cnt += (x-T)//L\n position.append((x-T)%L)\n position.sort()\n cnt %= N\n ans = position[count:] + position[:count]\n for i in range(N):\n print(ans[i])", "import sys\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n \ndef main():\n N, L, T = map(int, readline().split())\n position = []\n \n cnt = 0\n for i in range(N):\n x, w = map(int, input().split())\n if w == 1:\n cnt += (x - T)//L\n position.append((x-T)%L)\n else:\n if x-T < 0:\n cnt += (x - T)//L\n position.append((x - T)%L)\n\tposition.sort()\n cnt %= N\n \n ans = position[cnt:] + position[:cnt]\n for i in range(N):\n print(ans[i])\n \n ", "import sys\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n \ndef main():\n N, L, T = map(int, readline().split())\n position = []\n cnt = 0\n for i in range(N):\n x,w = map(int, readline().split())\n if w==1:\n \tcnt += (x+T)//L\n position.append((x+T)%L)\n else:\n if x-T<0:\n cnt += (x-T)//L\n position.append((x-T)%L)\n position.sort()\n cnt %= N\n ans = position[cnt:] + position[:cnt]\n for i in range(N):\n print(ans[i])\n", "def main():\n N, L, T = map(int, input().split())\n collision = 0\n ants = []\n for i in range(N):\n x, w = map(int, input().split())\n if w == 1:\n collision += (x + T) // L\n a = (x + T) % L\n else:\n collision += (x - T) // L\n a = (x - T) % L\n ants.append(a)\n \n collision %= N\n ants.sort()\n ants = ants[collision:] + ants[:collision]\n for ant in ants:\n print(ant)\n \n \nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s077684191', 's178927960', 's337756552', 's422088433', 's019111880'] | [2940.0, 2940.0, 3064.0, 2940.0, 8604.0] | [17.0, 18.0, 17.0, 17.0, 393.0] | [584, 576, 578, 573, 502] |
p03747 | u884982181 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ['n,l,t = map(int,input().split())\nx = [list(map(int,input().split())) for i in range(n)]\nlas = [0]*n\nfor i in range(n):\n las[i] = (x[i][0]+(t if x[i][1]==1 else -t))%l\nhan = []\nfor i in range(1,n):\n if x[i][1] != x[0][1]:\n if x[0][1] ==1:\n han.append(x[i][1]-x[0][0])\n else:\n han.append(l-x[i][0]+x[0][0])\nsu = 0\nt*=2\nsu += len(han)*(t//l)\nt%=l\nfor i in han:\n if t> i:\n su+=1\nsu%=(n)\nii = las[0]\nlas.sort()\nbasyo = las.index(ii)\nfor i in range(basyo,n):\n if las[basyo] == las[i]:\n basyo+=1\n break\nlas.extend(las)\nans = [0]*n\nz = 0\nfor i in range(basyo,basyo+n):\n ans[(su+z)%n] = las[i]\n z += 1\nfor i in ans:\n print(i)', 'n,l,t = map(int,input().split())\nx = [list(map(int,input().split())) for i in range(n)]\nlas = [0]*n\nfor i in range(n):\n las[i] = (x[i][0]+(t if x[i][1]==1 else -t))%l\nhan = []\nfor i in range(1,n):\n if x[i][1] != x[0][1]:\n if x[0][1] ==1:\n han.append(x[i][0]-x[0][0])\n else:\n han.append(l-x[i][0]+x[0][0])\nsu = 0\nt*=2\nsu += (len(han))*(t//l)\nt%=l\nfor i in han:\n if t> i:\n su+=1\nif x[0][1] == 2:\n su=(-su)%n\nelse:\n su%=(n)\nii = las[0]\nlas.sort()\nbasyo = las.index(ii)\nfor i in range(basyo+1,n):\n if las[basyo] == las[i]:\n if x[0][1] == 2:\n basyo+=1\n break\nlas.extend(las)\nans = [0]*n\nz = 0\nfor i in range(basyo,basyo+n):\n ans[(su+z)%n] = las[i]\n z += 1\nfor i in ans:\n print(i)'] | ['Wrong Answer', 'Accepted'] | ['s155338273', 's150355831'] | [32888.0, 32912.0] | [507.0, 506.0] | [649, 712] |
p03747 | u985443069 | 2,000 | 262,144 | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i. The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction. For each ant, find its position after T seconds. | ["import sys\n\nsys.stdin = open('c2.in')\n\n\n\ndef solve_it_large(n, l, t, x, w):\n ants = []\n for i in range(n):\n ants.append([x[i], w[i], (x[i] + w[i] * t) % l, i])\n # ants.sort()\n\n n_intersections = 0\n x0, w0, dest0, i0 = ants[0]\n for x, w, dest, i in ants:\n if w != w0:\n d = (w0 * (x - x0) + l) % l\n intersections = 0\n if 2 * t >= d:\n intersections = (2 * t - d) // l + 1\n n_intersections += intersections\n\n res = [0] * n\n shift = n_intersections\n for i in range(n):\n res[ants[(i + w0 * shift) % n][3]] = ants[i][2]\n return res\n\n\ndef solve_it_chameleons(n, l, t, x, w):\n initial_color = [i for i in range(n)]\n\n chameleons = [[x[i], w[i], initial_color[i]] for i in range(n)]\n initial_color_clockwise = [chameleons[i][2] for i in range(n)]\n\n x0, w0, color0 = chameleons[0]\n for i in range(n):\n if w[i] != w0:\n d = (w0 * (x[i] - x0)) % l\n meet = 0\n if 2 * t >= d:\n meet = (2 * t - d) // l + 1\n color0 += w0 * meet\n color0 %= n\n\n # The chameleon (let's call him chameleon 0) initially at x0 is at (x0 + w0 * t) % l at the end,\n # Initially, its color is color0 and it changed <meet> times.\n # The final clockwise colors are a translation of the initial clockwise colors.\n\n x_final = [(x[i] + w[i] * t) % l for i in range(n)]\n x_final.sort()\n i = x_final.index((x0 + w0 * t) % l)\n if i + 1 < n and x_final[i] == x_final[i + 1]:\n if w0 == 1:\n i += 1\n res = [0] * n\n for k in range(n):\n color = (color0 + k) % n\n res[color] = x_final[(i+k) % n]\n return res\n\n\nif __name__ == '__main__':\n\n n, l, t = map(int, input().split())\n x = []\n w = []\n for i in range(n):\n _x, _w = map(int, input().split())\n if _w == 2:\n _w = -1\n x.append(_x)\n w.append(_w)\n\n res = solve_it_chameleons(n, l, t, x, w)\n for i in range(n):\n print(res[i])\n", "import sys\n\n\ndef solve_it_chameleons(n, l, t, x, w):\n initial_color = [i for i in range(n)]\n\n chameleons = [[x[i], w[i], initial_color[i]] for i in range(n)]\n initial_color_clockwise = [chameleons[i][2] for i in range(n)]\n\n x0, w0, color0 = chameleons[0]\n for i in range(n):\n if w[i] != w0:\n d = (w0 * (x[i] - x0)) % l\n meet = 0\n if 2 * t >= d:\n meet = (2 * t - d) // l + 1\n color0 += w0 * meet\n color0 %= n\n\n # The chameleon (let's call him chameleon 0) initially at x0 is at (x0 + w0 * t) % l at the end,\n # Initially, its color is color0 and it changed <meet> times.\n # The final clockwise colors are a translation of the initial clockwise colors.\n\n x_final = [(x[i] + w[i] * t) % l for i in range(n)]\n x_final.sort()\n\n # In the special case where chameleon meets just at the end, they swap their colors.\n # The index need to be incremented if he walks clockwise.\n i = x_final.index((x0 + w0 * t) % l)\n if i + 1 < n and x_final[i] == x_final[i + 1]:\n if w0 == 1:\n i += 1\n res = [0] * n\n for k in range(n):\n color = (color0 + k) % n\n res[color] = x_final[(i+k) % n]\n return res\n\n\nif __name__ == '__main__':\n\n n, l, t = map(int, input().split())\n x = []\n w = []\n for i in range(n):\n _x, _w = map(int, input().split())\n if _w == 2:\n _w = -1\n x.append(_x)\n w.append(_w)\n\n res = solve_it_chameleons(n, l, t, x, w)\n for i in range(n):\n print(res[i])\n"] | ['Runtime Error', 'Accepted'] | ['s940152051', 's971423990'] | [3192.0, 27616.0] | [18.0, 513.0] | [2077, 1571] |
p03764 | u036104576 | 2,000 | 262,144 | On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i. For every rectangle that is formed by these lines, find its area, and print the total area modulo 10^9+7. That is, for every quadruple (i,j,k,l) satisfying 1\leq i < j\leq n and 1\leq k < l\leq m, find the area of the rectangle formed by the lines x=x_i, x=x_j, y=y_k and y=y_l, and print the sum of these areas modulo 10^9+7. | ['N, M = map(int, input().split())\nX = list(map(int, input().split()))\nY = list(map(int, input().split()))\n\nxs = 0\nfor i in range(N):\n xs += i * X[i]\n xs -= (N - i - 1) * X[i]\n xs %= MOD\nys = 0\nfor i in range(M):\n ys += i * Y[i]\n ys -= (M - i - 1) * Y[i]\n ys %= MOD\nprint(xs * ys % MOD)\n', 'import sys\nimport itertools\n# import numpy as np\nimport time\nimport math\nfrom heapq import heappop, heappush\nfrom collections import defaultdict\nfrom collections import Counter\nfrom collections import deque\nsys.setrecursionlimit(10 ** 7)\n \nINF = 10 ** 18\nMOD = 10 ** 9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n# map(int, input().split())\nN, M = map(int, input().split())\nX = list(map(int, input().split()))\nY = list(map(int, input().split()))\n\nxs = 0\nfor i in range(N):\n xs += i * X[i]\n xs -= (N - i - 1) * X[i]\n xs %= MOD\nys = 0\nfor i in range(M):\n ys += i * Y[i]\n ys -= (M - i - 1) * Y[i]\n ys %= MOD\nprint(xs * ys % MOD)\n\n\n'] | ['Runtime Error', 'Accepted'] | ['s858341822', 's526046765'] | [24452.0, 24488.0] | [69.0, 154.0] | [305, 714] |
p03764 | u692632484 | 2,000 | 262,144 | On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i. For every rectangle that is formed by these lines, find its area, and print the total area modulo 10^9+7. That is, for every quadruple (i,j,k,l) satisfying 1\leq i < j\leq n and 1\leq k < l\leq m, find the area of the rectangle formed by the lines x=x_i, x=x_j, y=y_k and y=y_l, and print the sum of these areas modulo 10^9+7. | ['INF=10**9+7\nL=[int(i)-1 for i in input().split()]\nx=[int(i) for i in input().split()]\ny=[int(i) for i in input().split()]\nx.sort()\ny.sort()\n\nX=[x[i+1]-x[i] for i in range(L[0])]\nY=[y[i+1]-y[i] for i in range(L[1])]\n\nusingX=[0 for i in range(L[0])]\nusingY=[0 for i in range(L[1])]\n\nif L[0]%2==0:\n\tfor i in range(L[0]):\n\t\ttemp=min(i,L[0]-i-1)\n\t\ttemp+=1\n\t\tusingX[i]+=int(temp*(temp+1)/2)\n\t\t#print(usingX)\n\t\tusingX[i]+=temp*int(L[0]/2-temp)\n\t\t#print(usingX)\n\t\tusingX[i]*=2\n\t\t#print()\nelse:\n\tfor i in range(L[0]):\n\t\ttemp=min(i,L[0]-i-1)\n\t\ttemp+=1\n\t\tusingX[i]+=int(temp*(temp+1)/2)\n\t\tusingX[i]+=temp*int((L[0]-1)/2-temp)\n\t\tusingX[i]*=2\n\t\t\n\t\tusingX[i]+=temp\n\t#temp=int((L[0]-1)/2)\n\t#usingX[temp]-=(temp+1)*2\n\n\nif L[1]%2==0:\n\tfor i in range(L[1]):\n\t\ttemp=min(i,L[1]-i-1)\n\t\ttemp+=1\n\t\tusingY[i]+=int(temp*(temp+1)/2)\n\t\t\n\t\tusingY[i]+=temp*int(L[1]/2-temp)\n\t\t\n\t\tusingY[i]*=2\n\t\t#print()\nelse:\n\tfor i in range(L[1]):\n\t\ttemp=min(i,L[1]-i-1)\n\t\ttemp+=1\n\t\tusingY[i]+=int(temp*(temp+1)/2)\n\t\tusingY[i]+=temp*int((L[1]-1)/2-temp)\n\t\tusingY[i]*=2\n\t\t\n\t\tusingY[i]+=temp\n\t#temp=int((L[1]-1)/2)\n\t#usingY[temp]-=(temp+1)*2\t\n\nprint(usingX)\nprint(usingY)\nfor i in range(L[0]):\n\tX[i]*=usingX[i]\nfor j in range(L[1]):\n\tY[j]*=usingY[j]\nans=sum(X)*sum(Y)\nprint(ans%INF)', 'INF=10**9+7\nL=[int(i)-1 for i in input().split()]\nx=[int(i) for i in input().split()]\ny=[int(i) for i in input().split()]\nx.sort()\ny.sort()\n\nX=[x[i+1]-x[i] for i in range(L[0])]\nY=[y[i+1]-y[i] for i in range(L[1])]\n\nusingX=[0 for i in range(L[0])]\nusingY=[0 for i in range(L[1])]\n\nif L[0]%2==0:\n\tfor i in range(L[0]):\n\t\ttemp=min(i,L[0]-i-1)\n\t\ttemp+=1\n\t\tusingX[i]+=int(temp*(temp+1)/2)\n\t\t#print(usingX)\n\t\tusingX[i]+=temp*int(L[0]/2-temp)\n\t\t#print(usingX)\n\t\tusingX[i]*=2\n\t\t#print()\nelse:\n\tfor i in range(L[0]):\n\t\ttemp=min(i,L[0]-i-1)\n\t\ttemp+=1\n\t\tusingX[i]+=int(temp*(temp+1)/2)\n\t\tusingX[i]+=temp*int((L[0]-1)/2-temp)\n\t\tusingX[i]*=2\n\t\t\n\t\tusingX[i]+=temp\n\t#temp=int((L[0]-1)/2)\n\t#usingX[temp]-=(temp+1)*2\n\n\nif L[1]%2==0:\n\tfor i in range(L[1]):\n\t\ttemp=min(i,L[1]-i-1)\n\t\ttemp+=1\n\t\tusingY[i]+=int(temp*(temp+1)/2)\n\t\t\n\t\tusingY[i]+=temp*int(L[1]/2-temp)\n\t\t\n\t\tusingY[i]*=2\n\t\t#print()\nelse:\n\tfor i in range(L[1]):\n\t\ttemp=min(i,L[1]-i-1)\n\t\ttemp+=1\n\t\tusingY[i]+=int(temp*(temp+1)/2)\n\t\tusingY[i]+=temp*int((L[1]-1)/2-temp)\n\t\tusingY[i]*=2\n\t\t\n\t\tusingY[i]+=temp\n\t#temp=int((L[1]-1)/2)\n\t#usingY[temp]-=(temp+1)*2\t\n\n#print(usingX)\n\nfor i in range(L[0]):\n\tX[i]*=usingX[i]\nfor j in range(L[1]):\n\tY[j]*=usingY[j]\nans=sum(X)*sum(Y)\nprint(ans%INF)'] | ['Wrong Answer', 'Accepted'] | ['s481632788', 's820749530'] | [33800.0, 29444.0] | [508.0, 524.0] | [1267, 1269] |
p03764 | u729133443 | 2,000 | 262,144 | On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i. For every rectangle that is formed by these lines, find its area, and print the total area modulo 10^9+7. That is, for every quadruple (i,j,k,l) satisfying 1\leq i < j\leq n and 1\leq k < l\leq m, find the area of the rectangle formed by the lines x=x_i, x=x_j, y=y_k and y=y_l, and print the sum of these areas modulo 10^9+7. | ['mod=10**9+7\nn,m=map(int,input().split())\nx=list(map(int,input().split()))\ny=list(map(int,input().split()))\nxl=0\nyl=0\nfor i in range(1,n):\n l=i-1\n r=i+1\n while l>=0:\n xl=(xl+x[i]-x[l])%mod\n l-=1\n while r<n:\n xl=(xl+x[r]-x[i])%mod\n r+=1\nfor i in range(1,m):\n l=i-1\n u=i+1\n while l>=0:\n yl=(yl+y[i]-y[l])%mod\n l-=1\n while u<m:\n yl=(yl+y[u]-y[i])%mod\n u+=1\nprint(xl*yl%mod)', 'mod=10**9+7\nn,m=map(int,input().split())\nx=list(map(int,input().split()))\ny=list(map(int,input().split()))\nxl=0\nxt=0\nyl=0\nyt=0\nfor i in range(n-1):\n if i==0:\n for j in range(1,n):\n xt+=x[j]-x[i]\n xl=xt\n else:\n xt-=(x[i]-x[i-1])*(n-i)\n xl=(xl+xt)%mod\nfor i in range(m-1):\n if i==0:\n for j in range(1,m):\n yt+=y[j]-y[i]\n yl=yt\n else:\n yt-=(y[i]-y[i-1])*(m-i)\n yl=(yl+yt)%mod\nprint(xl*yl%mod)'] | ['Wrong Answer', 'Accepted'] | ['s219564230', 's140751881'] | [18752.0, 18576.0] | [2104.0, 234.0] | [401, 427] |
p03764 | u846694620 | 2,000 | 262,144 | On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i. For every rectangle that is formed by these lines, find its area, and print the total area modulo 10^9+7. That is, for every quadruple (i,j,k,l) satisfying 1\leq i < j\leq n and 1\leq k < l\leq m, find the area of the rectangle formed by the lines x=x_i, x=x_j, y=y_k and y=y_l, and print the sum of these areas modulo 10^9+7. | ["import itertools\n\n\ndef main():\n n, m = map(int, input().split())\n\n x = list(map(int, input().split()))\n y = list(map(int, input().split()))\n\n x_len = 0\n y_len = 0\n\n for i in range(n):\n x_len += (2 * i - n + 1) * x[i] % (10 ** 9 + 7)\n print(x_len)\n\n for j in range(m):\n y_len += (2 * j - m + 1) * y[j] % (10 ** 9 + 7)\n print(y_len)\n\n print(x_len * y_len % (10 ** 9 + 7))\n\n\nif __name__ == '__main__':\n main()\n", "import itertools\n\n\ndef main():\n n, m = map(int, input().split())\n\n x = list(map(int, input().split()))\n y = list(map(int, input().split()))\n\n x_len = 0\n y_len = 0\n\n for i in range(n):\n x_len += (2 * i - n + 1) * x[i] % (10 ** 9 + 7)\n # print(x_len)\n\n for j in range(m):\n y_len += (2 * j - m + 1) * y[j] % (10 ** 9 + 7)\n # print(y_len)\n\n print(x_len * y_len % (10 ** 9 + 7))\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s459514238', 's908780298'] | [18396.0, 18392.0] | [257.0, 120.0] | [462, 466] |
p03764 | u964299793 | 2,000 | 262,144 | On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i. For every rectangle that is formed by these lines, find its area, and print the total area modulo 10^9+7. That is, for every quadruple (i,j,k,l) satisfying 1\leq i < j\leq n and 1\leq k < l\leq m, find the area of the rectangle formed by the lines x=x_i, x=x_j, y=y_k and y=y_l, and print the sum of these areas modulo 10^9+7. | ['mod=10**9+7\nn,m=map(int,input().split())\nx=list(map(int,input().split()))\ny=list(map(int,input().split()))\nansx=0\ncum=x[0]\nfor i in range(1,n):\n ansx+=(i*x[i]-cum+mod)%mod\n ansx%=mod\n cum+=x[i]\nansy=0\ncum=y[0]\nfor i in range(1,m):\n ansy+=(i*y[i]-cum+mod)%mod\n ansy%=mod\n cum+=y[i]\nprint(ansx,ansy)\nprint((ansx*ansy)%mod)\n', 'mod=10**9+7\nn,m=map(int,input().split())\nx=list(map(int,input().split()))\ny=list(map(int,input().split()))\nansx=0\ncum=x[0]\nfor i in range(1,n):\n ansx+=(i*x[i]-cum+mod)%mod\n ansx%=mod\n cum+=x[i]\nansy=0\ncum=y[0]\nfor i in range(1,m):\n ansy+=(i*y[i]-cum+mod)%mod\n ansy%=mod\n cum+=y[i]\n#print(ansx,ansy)\nprint((ansx*ansy)%mod)\n'] | ['Wrong Answer', 'Accepted'] | ['s992132203', 's730238556'] | [18624.0, 18624.0] | [192.0, 195.0] | [339, 340] |
p03766 | u102461423 | 2,000 | 262,144 | How many infinite sequences a_1, a_2, ... consisting of {{1, ... ,n}} satisfy the following conditions? * The n-th and subsequent elements are all equal. That is, if n \leq i,j, a_i = a_j. * For every integer i, the a_i elements immediately following the i-th element are all equal. That is, if i < j < k\leq i+a_i, a_j = a_k. Find the count modulo 10^9+7. | ['import sys\ninput = sys.stdin.readline\n\nMOD = 10**9 + 7\nN = int(input())\n\ndp = [0] * (N+10)\ndp_cum = [0] * (N+10)\n\ndp[1] = N-1; dp_cum[1] = N-1\ndp[2] = N-1; dp_cum[2] = 2*(N-1)\nfor n in range(3,N+1):\n dp[n] = dp[n-1] + dp_cum[n-3]\n dp_cum[n] = (dp_cum[n-1] + dp[n]) % MOD\n\nanswer = sum(dp[1:N])*N + dp[-1] + 1\nanswer %= MOD\nprint(answer)', 'import sys\ninput = sys.stdin.readline\n\nMOD = 10**9 + 7\nN = int(input())\n\ndp = [0] * (N+10)\ndp_cum = [0] * (N+10)\n\ndp[1] = N-1; dp_cum[1] = N-1\ndp[2] = N-1; dp_cum[2] = 2*(N-1)\nfor n in range(3,N+1):\n dp[n] = dp[n-1] + dp_cum[n-3]\n dp_cum[n] = (dp_cum[n-1] + dp[n]) % MOD\n\nanswer = sum(dp[1:N])*N + dp[N] + 1\nanswer %= MOD\nprint(answer)'] | ['Wrong Answer', 'Accepted'] | ['s711539629', 's948450674'] | [97808.0, 97808.0] | [720.0, 734.0] | [342, 341] |
p03766 | u104282757 | 2,000 | 262,144 | How many infinite sequences a_1, a_2, ... consisting of {{1, ... ,n}} satisfy the following conditions? * The n-th and subsequent elements are all equal. That is, if n \leq i,j, a_i = a_j. * For every integer i, the a_i elements immediately following the i-th element are all equal. That is, if i < j < k\leq i+a_i, a_j = a_k. Find the count modulo 10^9+7. | ["n = int(input())\n\nres_v = np.zeros(n + 1, dtype='int64')\nres_v_cumsum = np.zeros(n + 1, dtype='int64')\nres_v[0] = 0\nres_v[1] = 1\nres_v[2] = 1\nres_v_cumsum[0] = 0\nres_v_cumsum[1] = 1\nres_v_cumsum[2] = 2\n\nM = 1000000007\n\nfor k in range(3, n):\n res_v[k] = (1 + res_v_cumsum[k-1] - res_v[k-2]) % M\n res_v_cumsum[k] = (res_v_cumsum[k-1] + res_v[k]) % M\n\nprint((((res_v_cumsum[n-2] * (((n-1) * (n-1)) % M)) % M) + ((res_v_cumsum[n-1] * (n-1)) % M) + n + (n-1)*(n-1)%M) % M)", 'n = int(input())\n\nif n == 1:\n print(1)\nelse:\n res_v = [0]*(n + 1)\n res_v_cumsum = [0]*(n + 1)\n res_v[0] = 0\n res_v[1] = 1\n res_v[2] = 1\n res_v_cumsum[0] = 0\n res_v_cumsum[1] = 1\n res_v_cumsum[2] = 2\n\n M = 1000000007\n\n for k in range(3, n):\n res_v[k] = (1 + res_v_cumsum[k-1] - res_v[k-2]) % M\n res_v_cumsum[k] = (res_v_cumsum[k-1] + res_v[k]) % M\n #print(res_v)\n print((((res_v_cumsum[n-2] * (((n-1) * (n-1)) % M)) % M) + ((res_v_cumsum[n-1] * (n-1)) % M) + n + (n-1)*(n-1)%M) % M)'] | ['Runtime Error', 'Accepted'] | ['s345761693', 's896649987'] | [3064.0, 82164.0] | [18.0, 704.0] | [473, 534] |
p03767 | u038319219 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['# -*- coding: utf-8 -*-\n\nN = int(input())\na = input().split()\n\ntotal = 0\na2 = sorted(a, reverse=True)\ni = N + 1\nj = 2 * N\n\nfor id in range(i, j+1):\n\ttotal += int(a2[id])\n\nprint(total)', '# -*- coding: utf-8 -*-\n\nN = int(input())\na = input().split()\n\ntotal = 0\na2 = sorted(a)\ni = N + 1\nj = 2 * N\n\nfor id in range(i, j+1):\n\tprint(id)\n\ttotal += int(a2[id])\n\nprint(total)', '# -*- coding: utf-8 -*-\n \nN = int(input())\na = list(map(int, input().split()))\n \ntotal = 0\na2 = sorted(a, reverse=True)\n \nfor id in range(N):\n\ttotal += a2[2*id+1]\n \nprint(total)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s592814110', 's953712317', 's897254462'] | [30812.0, 28380.0, 37212.0] | [319.0, 366.0, 235.0] | [183, 180, 177] |
p03767 | u045408189 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N=int(input())\na=sorted(list(map(int,input().split())),reverse=True)\nprint(sum(a[2::2]))\n', 'N=int(input())\na=sorted(list(map(int,input().split())))\nprint(sum(a[N::2]))\n'] | ['Wrong Answer', 'Accepted'] | ['s921188749', 's383580516'] | [37084.0, 37084.0] | [212.0, 210.0] | [89, 76] |
p03767 | u062691227 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n,*aa=map(int, open(0).read().split())\n\naa.sort(reverse=True)\n\nsum(aa[1::2][:n])', 'n,*aa=map(int, open(0).read().split())\n\naa.sort(reverse=True)\n\nprint(sum(aa[1::2][:n]))'] | ['Wrong Answer', 'Accepted'] | ['s925185420', 's516139738'] | [43972.0, 43972.0] | [139.0, 143.0] | [80, 87] |
p03767 | u067227603 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\n\n\nprint(sum(a[1:2*n:2]))', 'N = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\n\nprint(sum(a[1:2*n:2]))', 'n=int(input())\na=sorted(list(map(int, input().split())), reverse=True)\nprint(sum(a[1:2*n:2]))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s584232377', 's769990119', 's954226156'] | [39492.0, 39492.0, 37084.0] | [207.0, 207.0, 209.0] | [99, 98, 93] |
p03767 | u075595666 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = [int(i) for i in input().split()]\nans = 0\nfor i in range(n):\n ans += a[i*2+1]\nprint(ans)', 'n = int(input())\na = [int(i) for i in input().split()]\na.sort(reverse=True)\nans = 0\nfor i in range(n):\n ans += a[i*2+1]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s674162503', 's342333864'] | [39492.0, 37084.0] | [127.0, 238.0] | [110, 131] |
p03767 | u076936237 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ["import numpy as np\n\n\nN = int(input())\na = list(map(int, input().split(' ')))\na.sort()\n\nx = []\nfor n in range(N):\n x.append([])\n for i in range(3):\n x[n].append(0)\n\nfor i in range(N*3):\n x[i % N][i // N] = a[i]\n\nfor i in range(N-1, -1, -1):\n for j in range(i-1, -1, -1):\n if x[i][1] == x[j][1]:\n if x[j][2] < x[i][2]:\n tmp = x[i][2]\n x[i][2] = x[j][1]\n x[j][1] = tmp\n\nres = 0\n\nfor n in range(N):\n res += x[n][1]\n\nprint(res)\n", "import numpy as np\n\n\nN = int(input())\na = list(map(int, input().split(' ')))\na.sort()\n\nx = []\nfor n in range(N):\n x.append([])\n for i in range(3):\n x[n].append(0)\n\nfor i in range(N*3):\n x[i % N][i // N] = a[i]\n\nfor i in range(N-1, -1, -1):\n for j in range(i-1, -1, -1):\n if x[i][1] == x[j][1] and [j][2] < x[i][1] and x[i][2] > x[j][2]:\n x[j][2], x[i][1] = x[i][1], x[j][2]\n break\n else:\n break\n\n\nres = 0\n\nfor n in range(N):\n res += x[n][1]\n\nprint(res)\n", "import numpy as np\nfrom numpy import linalg as LA\nimport math\n\nmat_dic = {}\n\ndef f(mat, n):\n if mat_dic.get(n, None) is not None:\n return mat_dic.get(n, None)\n\n if n == 1:\n return mat\n\n if int(math.sqrt(n))**2 == n:\n return LA.matrix_power(f(mat, int(math.sqrt(n))), 2)\n\n return mat.dot(f(mat, n-1))\n\n\n\nN, M = tuple(map(int, input().split(' ')))\n\nmat = np.identity(N)\nres = np.zeros(N)\n\nfor m in range(M):\n a, b = tuple(map(int, input().split(' ')))\n mat[a-1, b-1] = 1\n mat[b-1, a-1] = 1\n mat[a-1, a-1] = 1\n mat[b-1, b-1] = 1\n\nQ = int(input())\n\nfor q in range(Q):\n v, d, c = tuple(map(int, input().split(' ')))\n x = f(mat, d)\n res[x[v-1,:] > 0] = c\n\n\nfor i in range(N):\n print(int(res[i]))\n", "import numpy as np\n\n\nN = int(input())\na = list(map(int, input().split(' ')))\na.sort(reverse=True)\n\nx = np.zeros((N, 3))\n\nfor i in range(N*3):\n x[i % N , i // N] = a[i]\n\nres = 0\n\nprint(x)\n\nfor n in range(N):\n res += x[n, 1]\n\nprint(int(res))\n", "import numpy as np\nfrom collections import defaultdict\n\nmemo = {}\ndef dp(v, d, c):\n if memo.get((v, d), False):\n return None\n\n memo[(v, d)] = True\n if d == 0:\n res[v-1] = c\n return None\n\n dp(v, d-1, c)\n for e in dic.get(v, []):\n dp(e, d-1, c)\n\n\nN, M = tuple(map(int, input().split(' ')))\n\ndic = defaultdict(list)\n\nfor m in range(M):\n a, b = tuple(map(int, input().split(' ')))\n dic[a].append(b)\n dic[b].append(a)\n\nQ = int(input())\n\nvdc = [None]*Q\n\nfor q in range(Q):\n vdc[q] = tuple(map(int, input().split(' ')))\n\nres = np.zeros(N)\n\nfor q in range(Q-1, -1, -1):\n v, d, c = vdc[q]\n dp(v, d, c)\n\n\nfor i in range(N):\n print(int(res[i]))\n", "import numpy as np\n\n\nN = int(input())\na = list(map(int, input().split(' ')))\na.sort()\n\nres = 0\nfor i in range(len(a[N:])):\n if i % 2 == 0:\n res += a[N+i]\n\nprint(res)\n"] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s147797423', 's261635964', 's363192506', 's801337484', 's988294771', 's707328244'] | [46120.0, 46116.0, 12508.0, 46120.0, 12480.0, 46124.0] | [2110.0, 565.0, 148.0, 1944.0, 152.0, 377.0] | [508, 522, 750, 246, 698, 176] |
p03767 | u077291787 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['\ndef main():\n # sort -> first 1/3 as smallest ones\n # the sum of 2nd ones: 1111 23 23 23 23\n N, *A = map(int, open(0).read().split())\n A.sort()\n ans = sum(A[N::2])\n print()\n\n\nif __name__ == "__main__":\n main()', '\ndef main():\n # sort -> first 1/3 as smallest ones\n # the sum of 2nd ones: 1111 23 23 23 23\n N, *A = map(int, open(0).read().split())\n A.sort()\n ans = sum(A[N::2])\n print(ans)\n\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s745124773', 's056878265'] | [36164.0, 36292.0] | [202.0, 203.0] | [263, 266] |
p03767 | u086503932 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N=int(input())\na = sorted(list(map(int,input().split())))\nans=0\nfor i in range(2*N):\n tmp=a.pop(0)\n if i%2==1:\n ans+=tmp\nprint(ans)', 'N=int(input())\na = sorted(list(map(int,input().split())),reverse=True)\nans=0\nfor i in range(N):\n ans+=a[2*i+1]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s869131635', 's792862624'] | [37084.0, 37084.0] | [2105.0, 224.0] | [136, 122] |
p03767 | u089142196 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N=int(input())\na=list(map(int,input().split()))\na.sort(reverse=True)\n\nprint(sum(N//3:2N//3))', 'N=int(input())\na=list(map(int,input().split()))\na.sort(reverse=True)\n\nprint(sum( a[N//3:2*N//3] ))', 'N=int(input())\na=list(map(int,input().split()))\na.sort(reverse=True)\n\n#print(a)\nprint(sum( a[1:2*N:2] ))\n\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s153697162', 's245706280', 's323679999'] | [3064.0, 37084.0, 37084.0] | [18.0, 203.0, 205.0] | [92, 98, 106] |
p03767 | u089230684 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['#bin/usr/env python3\n\nN = int(input())\na = input()\nx = 0\n\na = a.split()\na.sort\n\nfor i in range(N):\n\tx += int(a[-(2*i+2)])\n\t\nprint(x)', 'n = int(input())\na_s = input().split()\na_s = [int(a) for a in a_s]\n\na_s.sort(reverse=True)\n\ntotal = 0\nfor i in range(n):\n total += a_s[i*2 + 1]\n\nprint(total)'] | ['Wrong Answer', 'Accepted'] | ['s665769095', 's117345621'] | [27612.0, 37084.0] | [86.0, 250.0] | [132, 160] |
p03767 | u092244748 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\narray = list(map(int, input().split()))\n\narray = sorted(array, reverse=True)\ns = n\ne = 2 * n\nprint(sum(array[int(s)::2]))', 'n = int(input())\narray = list(map(int, input().split()))\n\narray = sorted(array, reverse=True)\nprint(sum(array[1:2 * n:2]))'] | ['Wrong Answer', 'Accepted'] | ['s362211781', 's063841418'] | [39492.0, 39492.0] | [215.0, 210.0] | [138, 122] |
p03767 | u095756391 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\n\na = list(map(int, input().split()))\n\nsorted_a = sorted(a)\nreversed_a = reversed(a)\n\naa = []\nfor i in range(3*n):\n sorted_a.pop(-1)\n reversed_a.pop(-1)\n aa.append(sorted_a.pop(-1))\n\nprint(sum(aa))', 'import sys \nn = int(input())\n\na = list(map(int, sys.stdin.readline().split()))\n\nsorted_a = sorted(a)\nreversed_a = sorted(a, reverse=True)\n\naa = []\nfor i in range(n):\n sorted_a.pop(-1)\n reversed_a.pop(-1)\n aa.append(sorted_a.pop(-1))\n\nprint(sum(aa))'] | ['Runtime Error', 'Accepted'] | ['s996406559', 's213713322'] | [37084.0, 37084.0] | [202.0, 360.0] | [222, 257] |
p03767 | u103902792 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\nA = list(map(int,input().split()))\nA.sort()\na = sum(A[n//3:n//3*2])\nb = sum(A[-2:-2-n//3*2:-2])\nc = sum(A[1:n+1:2])\nans = max(a,b,c)\nprint(ans)\n\n', 'n = int(input())\nA = list(map(int,input().split()))\nA.sort()\na = sum(A[n//3:n//3*2])\nb = sum(A[-2:-2-n//3*2:-2])\nans = max(a,b)\nprint(ans)\n', 'n = int(input())\nA = list(map(int,input().split()))\na = sum(A[n//3:n//3*2])\nb = sum(A[-2:-2-n//3*2:-2])\nans = max(a,b)\nprint(ans)', 'n = int(input())\nA = list(map(int,input().split()))\nA.sort()\na = sum(A[n//3:n//3*2])\nb = sum(A[-2:-2-n//3*2:-2])\nc = sum(A[1:n+1:2])\nans = max(a,b)\nprint(ans)\n\n', 'n = int(input())\nA = list(map(int,input().split()))\nA.sort()\nB = A[n:n*2]\nC = A[-2:-2-n*2:-2]\nD = A[1:n*3+1:3]\n\nans = max(sum(B), sum(C), sum(D))\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s090034775', 's196284629', 's353609010', 's694665246', 's414749507'] | [39492.0, 37084.0, 37084.0, 37084.0, 37084.0] | [213.0, 206.0, 95.0, 203.0, 213.0] | [162, 139, 129, 160, 156] |
p03767 | u104282757 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['from collections import deque\n\nG = dict()\nN, M = map(int, input().split())\ncolor = [0]*(N+1)\nfor n in range(1, N+1):\n G[n] = []\nfor _ in range(M):\n a, b = map(int, input().split())\n G[a].append(b)\n G[b].append(a)\nQ = int(input())\n\n\n\n\ndata = [list(map(int, input().split())) for _ in range(Q)]\ndata.reverse()\ncolor_d = [-1]*(N+1)\n\nfor v, d, c in data:\n if color_d[v] >= d:\n pass\n # BFS\n deq = deque([v])\n if color[v] == 0:\n color[v] = c\n color_d[v] = d\n while len(deq) > 0:\n s = deq.popleft()\n for t in G[s]:\n if color_d[t] >= color_d[s] - 1:\n pass\n else:\n color_d[t] = color_d[s] - 1\n if color[t] == 0:\n color[t] = c\n if color_d[t] > 0:\n deq.append(t)\n \nfor n in range(1, N+1):\n print(color[n])\n \n\n', 'import numpy as np\nN = int(input())\na = np.array(list(map(int, input().split())))\na.sort()\nprint(a[N:(3*N):2].sum())'] | ['Runtime Error', 'Accepted'] | ['s559920375', 's563768836'] | [3316.0, 46096.0] | [21.0, 712.0] | [909, 116] |
p03767 | u105302073 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\nA = list(sorted(list(map(int, input().split()))))\n# N = 2\n\ngroup = []\nret = 0\nfor a in A:\n print(A)\n group.append([A.pop(0), A.pop(), A.pop()])\nfor g in group:\n ret += list(sorted(g))[1]\nprint(ret)', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nret = 0\nfor n in range(N, N*3, 2):\n ret += A[n]\nprint(ret)'] | ['Runtime Error', 'Accepted'] | ['s149200129', 's502229684'] | [160184.0, 39492.0] | [2104.0, 217.0] | [256, 123] |
p03767 | u107077660 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\nA = sorted([int(i) for i in input().split()])\nA.reverse()\nprint(sum(A[1:2*N+2:2]))', 'N = int(input())\nA = sorted([int(i) for i in input().split()])\nA.reverse()\nprint(sum(A[1:2*N:2]))'] | ['Wrong Answer', 'Accepted'] | ['s767164070', 's608330922'] | [39492.0, 39492.0] | [218.0, 225.0] | [99, 97] |
p03767 | u125545880 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['def main():\n N, K = map(int, input().split())\n h = []\n for _ in range(N):\n h.append(int(input()))\n h.sort()\n ans = pow(10, 10)\n for k in range(N-K+1):\n ans = min(ans, abs(h[k]-h[K-1+k]))\n print(ans)\n\nif __name__ == "__main__":\n main()\n', 'from collections import deque\n\ndef main():\n N = int(input())\n a = list(map(int, input().split()))\n a.sort()\n a = deque(a)\n ans = 0\n for i in range(N):\n a.pop()\n ans += a.pop()\n a.popleft()\n print(ans)\n\nif __name__ == "__main__":\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s122631413', 's405511923'] | [9148.0, 43200.0] | [25.0, 154.0] | [273, 282] |
p03767 | u154756110 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N=int(input())\nA=list(map(int,input().split()))\nA.sort()\nans=0\nfor i in range(N*3):\n if(i%3==1):\n ans+=A[i]\nprint(ans)', 'N=int(input())\nA=list(map(int,input().split()))\nA.sort()\nans=0\nfor i in range(N):\n ans+=A[N-2-i*2]\nprint(ans)', 'N=int(input())\nA=list(map(int,input().split()))\nA.sort()\nans=0\nfor i in range(N):\n ans+=A[N*3-2-i*2]\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s094962538', 's853327261', 's660118155'] | [37084.0, 37084.0, 37084.0] | [250.0, 231.0, 233.0] | [122, 110, 112] |
p03767 | u163320134 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n=int(input())\narr=list(map(int,input().split()))\narr=sorted(arr,reverse=True)\nans=0\nfor i in range(n):\n ans+=arr[1+2*i]', 'n=int(input())\narr=list(map(int,input().split()))\narr=sorted(arr,reverse=True)\nans=0\nfor i in range(n):\n ans+=arr[1+2*i]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s710498138', 's899467361'] | [37084.0, 37084.0] | [222.0, 225.0] | [121, 132] |
p03767 | u185405877 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['s=int(input())\ni= list(map(int, input().split()))\n \ni.sort(reverse=True)\nsum=0\nfor j in range(s):\n sum+=i[3*j+1]\nprint(sum)', 's=int(input())\ni= list(map(int, input().split()))\ni.sort(reverse=True)\nsum=0\nfor j in range(s):\n sum+=i[(3*j)+1]\nprint(sum)', 's=int(input())\ni= list(map(int, input().split()))\n \ni.sort(reverse=True)\nsum=0\nks=0\nfor j in range(s):\n sum+=i[j+1]\nfor j in range(n,2*n):\n ks+=i[j]\nprint(max(sum,ks))', 's=int(input())\ni= list(map(int, input().split()))\ni.sort()\nsum=0\nfor j in range(s):\n sum+=i[(3*j)+1]\nprint(sum)', 's=int(input())\ni= list(map(int, input().split()))\nk=s//3\ni.sort(reverse=True)\nsum=0\nfor j in range(k):\n sum+=i[j+1]\nprint(sum)\n', 's=int(input())\ni= list(map(int, input().split()))\ni.sort(reverse=True)\nsum=0\nfor j in range(s):\n sum+=i[(2*j)+1]\nprint(sum)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s125946850', 's150905425', 's182007970', 's496853537', 's806115890', 's288975129'] | [37084.0, 39492.0, 37084.0, 37084.0, 37084.0, 37084.0] | [222.0, 233.0, 225.0, 230.0, 208.0, 222.0] | [126, 126, 171, 114, 130, 126] |
p03767 | u187109555 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\nstrengths = map(int, input().split())\nsorted_strengths = sorted(strengths, reverse=True)\nprint(sorted_strengths)\nteam_strength_sum = 0\n\nfor i in range(3*N):\n if (i)%3 == 1:\n team_strength_sum += sorted_strengths[i]\nprint(team_strength_sum)', 'N = int(input())\nstrengths = map(int, input().split())\nsorted_strengths = sorted(strengths, reverse=True)\nprint(sorted_strengths)\nteam_strength_sum = 0\nfor i in range(3*N - 1):\n if (i+1)%2 == 0:\n team_strength_sum += sorted_strengths[i]\nprint(team_strength_sum)', 'N = int(input())\nstrengths = map(int, input().split())\nsorted_strengths = sorted(strengths, reverse=True)\nprint(sorted_strengths)\nteam_strength_sum = 0\nfor i in range(3*N):\n if ((i+1)%2 == 0) & ((i+1)//2 <= N):\n team_strength_sum += sorted_strengths[i]\nprint(team_strength_sum)', 'N = int(input())\nstrengths = map(int, input().split())\nsorted_strengths = sorted(strengths, reverse=True)\n# print(sorted_strengths)\nteam_strength_sum = 0\nfor i in range(3*N):\n if ((i+1)%2 == 0) & ((i+1)//2 <= N):\n team_strength_sum += sorted_strengths[i]\nprint(team_strength_sum)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s662555303', 's768478149', 's808478010', 's873349994'] | [37084.0, 37084.0, 37084.0, 37084.0] | [274.0, 296.0, 342.0, 304.0] | [266, 271, 287, 289] |
p03767 | u189397279 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['import sys\n\nN = int(sys.stdin.readline())\na = sorted(list(map(int, sys.stdin.readline().split(" "))))\nsum = 0\nfor i in range(3 * N):\n if i % 3 == 1:\n sum += a[i]\nprint(sum)', 'import sys\n \nN = int(sys.stdin.readline())\na = sorted(list(map(int, sys.stdin.readline().split(" "))), reverse=True)\nsum = 0\nfor i in range(N):\n sum += a[2 * N + 1]\nprint(sum)', 'import sys\n \nN = int(sys.stdin.readline())\na = sorted(list(map(int, sys.stdin.readline().split(" "))), reverse=True)\nsum = 0\nfor i in range(N):\n sum += a[2 * i + 1]\nprint(sum)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s420283203', 's799204365', 's810646748'] | [39516.0, 39516.0, 37084.0] | [249.0, 222.0, 229.0] | [176, 176, 176] |
p03767 | u193264896 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ["import sys\nimport time\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\ndef main():\n N = int(readline())\n A = list(map(int, readline().split()))\n A.sort(reverse=True)\n print(A)\n ans = 0\n for i in range(N):\n ans += A[2*i +1]\n print(ans)\n\nif __name__ == '__main__':\n main()", "import sys\nimport time\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\ndef main():\n N = int(readline())\n A = list(map(int, readline().split()))\n A.sort(reverse=True)\n ans = 0\n for i in range(N):\n ans += A[2*i +1]\n print(ans)\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s526266541', 's083197922'] | [31684.0, 31684.0] | [233.0, 205.0] | [427, 414] |
p03767 | u194894739 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse=True)\nprint(sum(A[2:2 * n + 1:2]))\n', 'n = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse=True)\nprint(sum(A[2:2 * n + 1:2]))\n', 'n = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse=True)\nprint(sum(A[1:2 * n:2]))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s033180245', 's261825636', 's624553186'] | [37084.0, 37084.0, 37084.0] | [203.0, 213.0, 217.0] | [102, 102, 98] |
p03767 | u197300260 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['\n# Python 1st Try\n\nimport sys\n# from collections import defaultdict\n# import heapq,copy\n# from collections import deque\n\n\ndef II(): return int(sys.stdin.readline())\n\n\ndef MI(): return map(int, sys.stdin.readline().split())\n\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\ndef solver(eachPoints):\n result = 0\n menbers = len(eachPoints)\n group = menbers // 3\n eachPoints.sort(reverse=False)\n print(eachPoints)\n useSkillList = []\n \n for ui in range(group, menbers, +1):\n useSkillList.append(eachPoints[ui])\n# print("UseListOnly {}".format(useSkillList))\n # for pi in range(0, menbers):\n # if pi // group == 1:\n # print("Get Position -> {}={}".format(pi, eachPoints[pi]))\n # result = result + eachPoints[pi]\n # algorithm\n for sum2pos in range(0, len(useSkillList), +2):\n result = useSkillList[sum2pos] + result\n return result\n\n\nif __name__ == "__main__":\n _ = II()\n AI = LI()\n print("{}".format(solver(AI)))\n', '\n# Python 3rd Try\n\nimport sys\n# from collections import defaultdict\n# import heapq,copy\n# from collections import deque\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef solver(groups, eachScore):\n result = 0\n sortEachScore= sorted(eachScore)\n for userNo in range(groups, groups*3, +2):\n result = result + sortEachScore[userNo]\n return result\nif __name__ == "__main__":\n N = II()\n AI = LI()\n print("{}".format(solver(N, AI)))\n'] | ['Wrong Answer', 'Accepted'] | ['s251844648', 's850920168'] | [37212.0, 37084.0] | [271.0, 213.0] | [1231, 693] |
p03767 | u221345507 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N=int(input())\nA=list(map(int,input().split()))\nans=0\nfor i in range (N):\n ans+=A[i*2+1]\nprint (ans)', 'N=int(input())\nA=list(input().split())\nA.sort(reverse=True)\nmean=0\ncount=0\nimport sys\n\nfor i in range (3*N-1):\n if count==10:\n print(mean)\n sys.exit()\n if (i+1)%2==0:\n mean+=int(A[i])\n count+=1', 'N=int(input())\nA=list(map(int,input().split()))\nA.sort(reverse=True)\nans=0\nfor i in range (N):\n ans+=A[i*2+1]\nprint (ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s365039908', 's820351549', 's954624583'] | [37084.0, 27612.0, 37084.0] | [114.0, 257.0, 221.0] | [103, 227, 124] |
p03767 | u221401884 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\nA = [int(n) for n in input().split()]\n\nres = 0\nsortedA = sorted(A, reverse=True)\nfor i in range(1, N*2+1, 2):\n print(sortedA[i])\n res += sortedA[i]\n\nprint(res)', 'N = int(input())\nA = [int(n) for n in input().split()]\n\nres = 0\nsortedA = sorted(A, reverse=True)\nfor i in range(1, N*2+1, 2):\n res += sortedA[i]\n\nprint(res)\n'] | ['Wrong Answer', 'Accepted'] | ['s342334400', 's058397314'] | [37084.0, 37084.0] | [314.0, 236.0] | [182, 161] |
p03767 | u223904637 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n=int(input())\nl=list(map(int,input().split()))\nsorted(l)\nans=0\nfor i in range(n):\n ans+=l[n*3-2-i*2]\nprint(ans) ', 'n=int(input())\nl=list(map(int,input().split()))\nl=sorted(l)\nans=0\nfor i in range(n):\n ans+=l[n*3-2-i*2]\nprint(ans) \n'] | ['Wrong Answer', 'Accepted'] | ['s256924391', 's807559451'] | [39492.0, 37084.0] | [231.0, 236.0] | [117, 120] |
p03767 | u227082700 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n,a=int(input()),sorted(list(map(int,input().split())))print(sum([a[i]*(i%3==1)for i in range(3*n)]))', 'n=int(input())\na=list(map(int,input().split()))\na.sort(reverse=1)\nans=0\nfor i in range(1,2*n+1,2):ans+=a[i]\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s364697909', 's345680143'] | [2940.0, 37084.0] | [17.0, 224.0] | [101, 118] |
p03767 | u227085629 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = list(map(int,input().split()))\nc = 0\nt = 1\nwhile t < 2*n:\n c += a[t]\n t += 2\nprint(c)', 'n = int(input())\na = list(map(int,input().split()))\na.sort(reverse=True)\nc = 0\nt = 1\nwhile t < 2*n:\n c += a[t]\n t += 2\nprint(c)\n'] | ['Wrong Answer', 'Accepted'] | ['s219843183', 's129453920'] | [37212.0, 37084.0] | [120.0, 232.0] | [108, 130] |
p03767 | u235905557 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['\nN = int(input())\ntotal_members = N*3\nmembers = sorted(map(int, input().split()))\ntotal = 0\nfor i in range(1, total_members, 2):\n if i >= N:\n break\n total += members[i+1]\nprint (total)', 'N = int(input())\ntotal_members = N*3\nmembers = sorted(map(int, input().split()))\ntotal = 0\nfor i in range(0, N):\n total += members[i * 2 + 1]\nprint (total)', 'N = int(input())\ntotal_members = N*3\nmembers = sorted(map(int, input().split()))\ntotal = 0\nfor i in range(0, total_members, 3):\n total += members[i+1]\nprint (total)', 'N = int(input())\ntotal_members = N*3\nmembers = sorted(map(int, input().split()), reverse=True)\ntotal = 0\nfor i in range(0, N):\n total += members[i * 2 + 1]\nprint (total)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s017092071', 's208190962', 's728913639', 's793542758'] | [37084.0, 37084.0, 37084.0, 37084.0] | [213.0, 232.0, 234.0, 231.0] | [197, 158, 167, 173] |
p03767 | u239725287 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = sorted(list(map(int, input().split())))\nans = 0\nfor i in range(n, n*3, 2):\n print(i)\n ans += a[i]\nprint(ans)', 'n = int(input())\na = sorted(list(map(int, input().split())))\nans = 0\nfor i in range(n, n*3, 2):\n ans += a[i]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s461841759', 's788439844'] | [37084.0, 37084.0] | [304.0, 221.0] | [135, 122] |
p03767 | u242031676 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n,*a=map(int, open(0).read().split())\nprint(sum(sorted(a)[n-1:][::2]))', 'n,*a=map(int, open(0).read().split())\nprint(sum(sorted(a)[n:][::2]))\n'] | ['Wrong Answer', 'Accepted'] | ['s180038541', 's485557671'] | [44048.0, 44268.0] | [141.0, 139.0] | [70, 69] |
p03767 | u256464928 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = list(sorted(list(map(int,input().split())))[::-1])\nans = 0\nprint(a)\nfor i in range(n):\n ans += a[n+i]\nprint(ans)', 'n = int(input())\na = list(sorted(list(map(int,input().split()))))\nans = 0\nfor i in range(0,n*2,2):\n ans += a[n+i]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s173671507', 's145008491'] | [37084.0, 39492.0] | [283.0, 237.0] | [134, 125] |
p03767 | u257541375 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\narray = [int(i) for i in input().split()]\n\narray.sort()\nans = 0\n\n#nkara2nmade\n\nfor i in range(n):\n ans = ans + array[2*i+1]\n \nprint(ans)', 'n = int(input())\narray = [int(i) for i in input().split()]\n\nlist.sort(array, reverse=True)\nans = 0\n\n#nkara2nmade\n\nfor i in range(n):\n ans = ans + array[2*i+1]\n \nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s617537502', 's874420923'] | [37084.0, 37084.0] | [236.0, 230.0] | [155, 173] |
p03767 | u258073778 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\na3N = list(map(int, input().split()))\n\na3N.sort(reverse = True)\nsumn = 0\nfor i in range(N):\n sumn += a3N[2*(i+1)]\n\nprint(sumn)', 'N = int(input())\na3N = list(map(int, input().split()))\n\na3N.sort(reverse = True)\nsumn = 0\nfor i in range(N):\n sumn += a3N[2*i+1]\n\nprint(sumn)'] | ['Wrong Answer', 'Accepted'] | ['s861365323', 's810937673'] | [37084.0, 39492.0] | [231.0, 227.0] | [144, 142] |
p03767 | u260036763 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\na = sorted(map(int, input().split())) [::-1]\nans = 0\nfor i in range(0, 3*N, 2):\n ans += a[i+1]\nprint(ans)', 'N = int(input())\na = sorted(map(int, input().split())) [::-1]\nans = 0\nfor i in range(0, 3N, 2):\n ans += a[i+1]\nprint(ans)', 'N = int(input())\na = sorted(map(int, input().split())) [::-1]\nans = 0\ncnt = 0\nfor i in range(0, 3*N, 2):\n ans += a[i+1]\n cnt += 1\n if cnt == N:\n break\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s497255719', 's833119494', 's491074621'] | [39492.0, 2940.0, 37084.0] | [238.0, 17.0, 255.0] | [123, 122, 167] |
p03767 | u273010357 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = list(map(int, input().split()))\na.sort()\n\n\ndef T(x,y,z):\n ma = max(x,y,z)\n mi = min(x,y,z)\n return (x+y+z) - (ma+mi)\n\nans = 0\nfor i in range(0,3*n,3):\n print(a[i:i+3])\n ans += T(*a[i:i+3])\nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\na.sort()\n\n\ndef T(x,y,z):\n ma = max(x,y,z)\n mi = min(x,y,z)\n return (x+y+z) - (ma+mi)\n\nans = 0\nfor i in range(0,3*n,3):\n ans += T(*a[i:i+3])\nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\na.sort()\n\n\ndef T(x,y,z):\n ma = max(x,y,z)\n mi = min(x,y,z)\n return (x+y+z) - (ma+mi)\n\nb = a[0::2]\nc = a[1::2]\n\n\nans = 0\nfor i in range(0,3*n//2,3):\n print(b[i:i+3],c[i:i+3])\n ans += T(*b[i:i+3]) + T(*c[i:i+3])\nprint(ans)', 'N = int(input())\na = list(map(int, input().split()))\na.sort()\n#print(a)\n# @0~N-1, !N,N+1,!N+2,N+3,!N+4, ... ,!N+N=2N\na = a[N::2]\nprint(sum(a))'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s014843998', 's076210209', 's830859389', 's918326305'] | [37084.0, 37084.0, 37084.0, 37084.0] | [495.0, 316.0, 479.0, 203.0] | [251, 231, 304, 142] |
p03767 | u281216592 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\na = [int(i) for i in input().split()]\na = sorted(a,reverse = True)\ns = 0\nfor i in range(N):\n s += a[2*(i+1)]\nprint(s)\n', 'N = int(input())\na = [int(i) for i in input().split()]\na = sorted(a,reverse = True)\ns = 0\nfor i in range(N):\n s += a[2*i+1]\nprint(s)\n'] | ['Wrong Answer', 'Accepted'] | ['s212029858', 's884542766'] | [37084.0, 39492.0] | [233.0, 239.0] | [138, 136] |
p03767 | u284999381 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['###ABC 012A\nN = input()\nA = list(map(int, input().split()))\nA = sorted(A,reverse = True)\nans = 0\nfor i in range(1, 2*N, 2):\n ans += A[i]\nprint(ans) ', 'N = input()\nA = list(map(int, input().split()))\nA = sorted(A,reverse = True)\nans = 0\nfor i in range(1, 2*N, 2):\n ans += A[i]\n', 'N = input()\nA = list(map(int, input().split()))\nA = sorted(A,reverse = True)\nans = 0\nfor i in range(1, 2*N, 2):\n ans += A[i]\n', 'N = int(input())\nA = list(map(int, input().split()))\nA = sorted(A,reverse = True)\nans = 0\nfor i in range(1, 2*N, 2):\n ans += A[i]\nprint(ans) '] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s100794461', 's508441487', 's973855721', 's402007649'] | [37084.0, 37084.0, 37084.0, 37084.0] | [203.0, 205.0, 207.0, 224.0] | [152, 128, 126, 145] |
p03767 | u288430479 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = list(map(int,input().split()))\na = sorted(a)[::-1]\nans = sum(a[:2*n:2])\nprint(ans)', 'n = int(input())\na = list(map(int,input().split()))\na = sorted(a)[::-1]\nans = sum(a[1:2*n:2])\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s136918375', 's618333506'] | [42920.0, 42624.0] | [156.0, 142.0] | [103, 104] |
p03767 | u288786530 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = sorted(list(map(int, input().split())))\n\nsyo = a[0:n]\ntyu = a[n:2*n]\ndai = a[2*n:3*n]\n\nl = a[n:3*n]\nsec = l[0::2]\n\nprint(sum(l))\n', 'n = int(input())\na = sorted(list(map(int, input().split())))\n\nsyo = a[0:n]\ntyu = a[n:2*n]\ndai = a[2*n:3*n]\n\nl = a[n:3*n]\nsec = l[0::2]\n\nprint(sum(sec))'] | ['Wrong Answer', 'Accepted'] | ['s483111009', 's574386985'] | [39492.0, 39492.0] | [226.0, 229.0] | [150, 151] |
p03767 | u292810930 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = input()\nalist = list(map(int, input().split()))\nalist.sort(reverse=True)\nprint(alist[::2])\n', 'N = input()\nalist = list(map(int, input().split()))\nalist.sort(reverse=True)\nprint(sum(alist[1:int(2*N):2]))\n', 'N = input()\nalist = list(map(int, input().split()))\nalist.sort(reverse=True)\nprint(sum(alist[::2]))\n', 'N = int(input())\nalist = list(map(int, input().split()))\nalist.sort(reverse=True)\nprint(sum(alist[1:2*N:2]))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s260634383', 's298090293', 's613655640', 's413799407'] | [37084.0, 39492.0, 37084.0, 39492.0] | [217.0, 204.0, 215.0, 203.0] | [95, 109, 100, 109] |
p03767 | u329749432 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['from collections import deque\n\nn = int(input())\na = [int(i) for i in input().split()]\na.sort()\na = deque(a)\nfor i in range(0,2*n):\n a.popleft()\nans=0\nfor i in a:\n ans += i\nprint(ans)\n', 'n = int(input())\na = [int(i) for i in input().split()]\na.sort()\nsum=0\n\nfor i in range(0,2*n,2):\n sum+=a[n+i]\nprint(sum)\n'] | ['Wrong Answer', 'Accepted'] | ['s262958450', 's119906027'] | [37468.0, 39492.0] | [252.0, 232.0] | [189, 123] |
p03767 | u339199690 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = list(map(int, input().split()))\n\nnum = 0\na.sort(reverse=True)\nfor i in range(0, 3*n):\n if i % 2 == 0:\n num += a[i]\nprint(num)', 'n = int(input())\na = list(map(int, input().split()))\n\nnum = 0\na.sort(reverse=True)\ni = 0\nwhile i < 3*n:\n num += a[i]\n i += 2\nprint(num)', 'n = int(input())\na = list(map(int, input().split()))\n\nnum = 0\na.sort(reverse=True)\ni = 1\nj = 0\nwhile j < n:\n num += a[i]\n i += 2\n j += 1\nprint(num)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s056082305', 's380512061', 's324995451'] | [37084.0, 37084.0, 37084.0] | [256.0, 246.0, 237.0] | [156, 141, 156] |
p03767 | u346308892 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N=int(input())\na=input().split(" ")\na=list(map(int,a))\nprint(sum(a[1::2][:N]))', 'N=int(input())\na=input().split(" ")\na=list(map(int,a))\na=sorted(a,reverse=True)\nprint(sum(a[1::2][:N]))'] | ['Wrong Answer', 'Accepted'] | ['s114012590', 's045143694'] | [39492.0, 37084.0] | [95.0, 216.0] | [78, 103] |
p03767 | u353895424 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = list(map(int, input().split()))\n\na.sort(reverse=True)\n\nsecond = []\nfor i in range(2*n):\n if i%2 != 0:\n second.append(a[i])\nprint(second)\nprint(sum(second))\n', 'n = int(input())\na = list(map(int, input().split()))\n\na.sort(reverse=True)\n\nsecond = 0\nfor i in range(2*n):\n if i%2 != 0:\n second += a[i]\nprint(second)\n'] | ['Wrong Answer', 'Accepted'] | ['s996292535', 's486040828'] | [37084.0, 37084.0] | [249.0, 245.0] | [187, 162] |
p03767 | u371132735 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['# agc012_a.py\nN = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse=True)\nans = 0\nprint(A)\nfor i in range(2*N):\n if i%2==1:\n ans+=A[i]\nprint(ans)\n', '# agc012_a.py\nN = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse=True)\nans = 0\nfor i in range(2*N):\n if i%2==1:\n ans+=A[i]\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s963616821', 's134510168'] | [37084.0, 39492.0] | [288.0, 248.0] | [169, 160] |
p03767 | u373047809 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n, *a = map(int, open(0).read().split())\nprint(sum(sorted(a)[1:n*2:2]))', 'n, *a = map(int, open(0).read().split())\nprint(sum(sorted(a)[-2:n-1:-2]))'] | ['Wrong Answer', 'Accepted'] | ['s305057239', 's241864194'] | [36164.0, 36164.0] | [207.0, 202.0] | [71, 73] |
p03767 | u382303205 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = list(map(int,input().split()))\n\nprint(sum(a[n:-n]))', 'n = int(input())\na = list(map(int,input().split()))\na.sort()\nprint(sum(a[n::2])) '] | ['Wrong Answer', 'Accepted'] | ['s590702673', 's802952320'] | [39492.0, 39492.0] | [96.0, 211.0] | [72, 84] |
p03767 | u391812144 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ["input_lines = str(input())\ninput_lines2 = str(input())\n\nn = int(input_lines)\naAry = input_lines2.split(' ')\naAry = map(int,aAry)\naAry = sorted(aAry)\nprint(aAry)\n\nanswer1 = 0\nfor i in range(n):\n answer1 += int(aAry[(-i-1)*2])\n\nprint(answer1)", "input_lines = str(input())\ninput_lines2 = str(input())\n\nn = int(input_lines)\naAry = input_lines2.split(' ')\naAry = map(int,aAry)\naAry = sorted(aAry)\nprint(aAry)\n\nanswer1 = 0\nfor i in range(n):\n answer1 += int(aAry[(-i-1)*2])\n\nprint(answer1)", "input_lines = str(input())\ninput_lines2 = str(input())\n\nn = int(input_lines)\naAry = input_lines2.split(' ')\naAry = map(int,aAry)\naAry = sorted(aAry)\n#print(aAry)\n\nanswer1 = 0L\nfor i in range(n):\n answer1 += int(aAry[(-i-1)*2])\n\nanswer2 = 0L\nfor i in range(n):\n answer2 += int(aAry[-i-3])\n\nif answer1 >= answer2:\n answer = answer1\nelse:\n answer = answer2\nprint(answer)", "input_lines = str(input())\ninput_lines2 = str(input())\n\nn = int(input_lines)\naAry = input_lines2.split(' ')\naAry = map(int,aAry)\naAry = sorted(aAry)\n#print(aAry)\n\nanswer1 = 0\nfor i in range(n):\n answer1 += int(aAry[(-i-1)*2])\n\nprint(answer1)"] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s345116569', 's619870728', 's861563223', 's282272409'] | [39516.0, 39516.0, 2940.0, 39516.0] | [274.0, 267.0, 17.0, 241.0] | [384, 243, 379, 385] |
p03767 | u411544692 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse=True)\nprint(sum(A[1::2][N]))', 'N = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse=True)\nprint(sum(A[1::2][:N]))'] | ['Runtime Error', 'Accepted'] | ['s987730425', 's463853098'] | [39492.0, 37084.0] | [210.0, 212.0] | [95, 96] |
p03767 | u416758623 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\nnumbers = [int(x) for x in input().split()]\n\nnumbers.sort(reverse=True)\nans = 0\norder = 1\nfor j in range(1, n+1):\n ans+=numbers[order]\n print(numbers[order])\n order+=2\n \nprint(ans)', 'n = int(input())\nl = sorted(list(map(int, input().split())),reverse=True)\nprint(sum(l[1:len(l)-n:2]))'] | ['Wrong Answer', 'Accepted'] | ['s320384268', 's886891891'] | [39492.0, 42708.0] | [320.0, 145.0] | [201, 101] |
p03767 | u419963262 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N=int(input())\nA=list(map(int,input().split()))\nB=sorted(A)\nans=0\nfor i in range(N):\n ans+=B[N+2*i]\nprint(B)\nprint(ans)', 'N=int(input())\nA=list(map(int,input().split()))\nB=sorted(A)\nans=0\nfor i in range(N):\n ans+=B[N+2*i]\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s935764957', 's207231710'] | [37084.0, 37084.0] | [258.0, 235.0] | [120, 112] |
p03767 | u420522278 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = input().split()\na = [int(i) for i in a]\n\ncandidate = a[n:len(a)+1]\nprint(sum([candidate[i] for i in (1 , 2n+1, 2)]))', 'n = int(input())\na = input().split()\na = [int(i) for i in a]\n \ncandidate = a[n:len(a)+1]\nprint(sum([candidate[i] for i in range(0, 2*n, 2)]))', 'n = int(input())\na = input().split()\na = [int(i) for i in a]\na = sorted(a)\n \ncandidate = a[n:len(a)+1]\nprint(sum([candidate[i] for i in range(0, 2*n, 2)]))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s647535502', 's925397319', 's059007641'] | [2940.0, 39492.0, 37084.0] | [17.0, 112.0, 238.0] | [137, 141, 155] |
p03767 | u425762225 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\na = sorted(list(map(int,input().split())))\n\nprint(sum([a[3*i-2] for i in range(N)]))', 'N = int(input())\na = sorted(list(map(int,input().split())),reverse=True)\n\nprint(sum([a[2*i+1] for i in range(N)]))\t\t'] | ['Wrong Answer', 'Accepted'] | ['s050791464', 's503337203'] | [39492.0, 37084.0] | [223.0, 222.0] | [101, 116] |
p03767 | u428891594 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['#!/usr/bin/env python3\n\ndef main():\n N, *a = map(int, open(0).read().split())\n\n a.sort(reverse = True)\n s = 0\n print(a)\n for i in range(N, 2*N):\n s = s + a[i]\n print(s)\n\n\nmain()', '#!/usr/bin/env python3\n\ndef main():\n N, *a = map(int, open(0).read().split())\n\n a.sort(reverse = True)\n s = 0\n for i in range(N):\n s = s + a[2*i + 1]\n print(s)\n\n\nmain()'] | ['Wrong Answer', 'Accepted'] | ['s104826653', 's092585899'] | [36164.0, 36164.0] | [233.0, 221.0] | [202, 190] |
p03767 | u431981421 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N=int(input())\nt = list(map(int,input().split()))\n\nnewLi = sorted(t)\nli = []\n\nfor i in range(N):\n k = [newLi.pop(0), newLi.pop(0), newLi.pop(-1)]\n li.append(k)\n\nans = 0\n\nfor s in li:\n ans += s[1]\n\nprint(ans)', 'N=int(input())\nt = list(map(int,input().split()))\n\nnewLi = sorted(t, reverse=True)\nans = 0\n\nfor i in range(N):\n ans += newLi[i * 2 + 1]\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s235521067', 's378214488'] | [39492.0, 37084.0] | [2105.0, 231.0] | [210, 148] |
p03767 | u433515605 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\na_list = list(map(int,input().split()))\n\na_list.sort(reverse=True)\nprint(a_list)\n\nsum = 0\nfor i in range(N, 2*N, 1):\n sum += a_list[i]\n\nprint(sum)', 'N = int(input())\na_list = list(map(int,input().split()))\n\na_list.sort(reverse=True)\n\nsum = 0\nfor i in range(1, 2*N, 2):\n sum += a_list[i]\n\nprint(sum)'] | ['Wrong Answer', 'Accepted'] | ['s471430983', 's972419657'] | [37084.0, 37084.0] | [251.0, 224.0] | [166, 152] |
p03767 | u437215432 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = list(map(int, input().split()))\n\na = sorted(a)\nm1 = n // 3\nm2 = 2 * m1\nprint(sum(a[m1:m2]))\n', 'n = int(input())\na = list(map(int, input().split()))\n\na = sorted(a)\ncount = 0\nfor i in range(n, 3*n, 2):\n count += a[i]\nprint(count)\n'] | ['Wrong Answer', 'Accepted'] | ['s539952394', 's032323020'] | [42892.0, 42756.0] | [142.0, 153.0] | [113, 136] |
p03767 | u448720391 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = list(map(int,input().split()))\n\na.sort(reverse=True)\n\nprint(sum(a[n:2*n]),a)', 'n = int(input())\na = list(map(int,input().split()))\n\na.sort(reverse=True)\nc = 0\nfor i in range(n):\n c += a[2*i + 1]\n\nprint(c)'] | ['Wrong Answer', 'Accepted'] | ['s522077463', 's663283237'] | [37084.0, 37084.0] | [244.0, 226.0] | [97, 128] |
p03767 | u454697629 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['# -*- coding: utf-8 -*-\n"""\nCreated on Sat Apr 1 22:07:55 2017\n\n@author: taichiNakamura\n"""\n\nN = int(input())\n\nnum = map(int, input().split())\n\nimport numpy as np\nnum = np.array(num)\nnum = np.sort(num)\nsum = 0\nfor i in range(N):\n sum += num[3*N - 2 - i*2]\n\nprint(sum)', '# -*- coding: utf-8 -*-\n"""\nCreated on Sat Apr 1 22:07:55 2017\n\n@author: taichiNakamura\n"""\nimport numpy as np\nN = int(input())\n\nnum = list(map(int, input().split()))\n\nnum = np.array(num, dtype="int64")\nnum.sort()\nsum = 0\n\nfor i in range(N):\n sum += num[3*N - 2 - i*2]\n\nprint(sum)'] | ['Runtime Error', 'Accepted'] | ['s923988382', 's201448913'] | [33804.0, 46116.0] | [1795.0, 343.0] | [320, 333] |
p03767 | u455533363 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\nli = sorted(list(map(int,input().split())))\n#print(li)\ncount = 0\nk = 1\nfor i in range(n):\n count += li[k]\n k += 2\n\nprint(count)\n', 'n = int(input())\nli = sorted(list(map(int,input().split())) , reverse=True)\nprint(li)\ncount = 0\nk = 1\nfor i in range(n):\n count += li[k]\n k += 2\n\nprint(count)\n', 'n = int(input())\nli = sorted(list(map(int,input().split())) , reverse=True)\ncount = 0\nk = 1\nfor i in range(n):\n count += li[k]\n k += 2\n\nprint(count)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s116944942', 's337342855', 's667112743'] | [37084.0, 37084.0, 37084.0] | [227.0, 265.0, 237.0] | [152, 166, 156] |
p03767 | u469063372 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = list(map(int, input().split()))\na.sort()\ns = 0\nfor i in range(n):\n s += a[i * 2 + n]\nprint(sum(s))', 'n = int(input())\na = list(map(int, input().split()))\na.sort()\ns = 0\nfor i in range(n):\n s += a[i * 2 + n]\nprint(s)'] | ['Runtime Error', 'Accepted'] | ['s256719728', 's454598757'] | [37084.0, 39492.0] | [224.0, 223.0] | [122, 117] |
p03767 | u469700628 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\n\nnums = sorted(list(map(int, input().split())))\n\nprint(nums)\nres = 0\nfor i in range(N):\n res += nums[3 * N - 2 * (i+1)]\n\nprint(res)', 'N = int(input())\n\nnums = sorted(list(map(int, input().split())))\n\nres = 0\nfor i in range(N):\n res += nums[3 * N - 2 * (i+1)]\n\nprint(res) '] | ['Wrong Answer', 'Accepted'] | ['s502706291', 's612694410'] | [39620.0, 37084.0] | [262.0, 244.0] | [151, 141] |
p03767 | u481250941 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['#\n# agc012 a\n#\n\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = """2\n5 2 8 5 1 5"""\n output = """10"""\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = """10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000"""\n output = """10000000000"""\n self.assertIO(input, output)\n\n\ndef resolve():\n N = int(input())\n a = list(map(int, input().split()))\n a.sort()\n ans = 0\n for i in range(N/3):\n a.pop()\n a.pop(0)\n ans += a.pop()\n print(ans)\n\n\nif __name__ == "__main__":\n unittest.main()\n \n', '#\n# agc012 a\n#\n \nimport sys\nfrom io import StringIO\nimport unittest\n \n \nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n \n def test_入力例_1(self):\n input = """2\n5 2 8 5 1 5"""\n output = """10"""\n self.assertIO(input, output)\n \n def test_入力例_2(self):\n input = """10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000"""\n output = """10000000000"""\n self.assertIO(input, output)\n \n \ndef resolve():\n N = int(input())\n a = list(map(int, input().split()))\n a.sort()\n ans = 0\n for i in range(N):\n \ta.pop(0)\n a.pop()\n ans += a.pop()\n print(ans)\n \n \nif __name__ == "__main__":\n # unittest.main()\n resolve()', '#\n# agc012 a\n#\n\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = """2\n5 2 8 5 1 5"""\n output = """10"""\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = """10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000"""\n output = """10000000000"""\n self.assertIO(input, output)\n\n\ndef resolve():\n N = int(input())\n a = list(map(int, input().split()))\n a.sort()\n ans = 0\n for i in range(N):\n a.pop()\n ans += a.pop()\n print(ans)\n\n\nif __name__ == "__main__":\n # unittest.main()\n resolve()\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s001477222', 's448286217', 's654778474'] | [16764.0, 8948.0, 50148.0] | [74.0, 24.0, 201.0] | [1272, 1277, 1253] |
p03767 | u496821919 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\na = list(map(int,input().split()))\n\na.sort(reverse=True)\ns = 0\n\nfor i in [n*2 for n in range(1,N +1)]:\n s += a[i]\n\nprint(s)\n', 'N = int(input())\na = list(map(int,input().split()))\n\na.sort(reverse=True)\ns = 0\n\nfor i in [n*2-1 for n in range(1,N +1)]:\n s += a[i]\n\nprint(s)\n'] | ['Wrong Answer', 'Accepted'] | ['s323624401', 's415127877'] | [39492.0, 37084.0] | [227.0, 227.0] | [144, 146] |
p03767 | u502731482 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = list(map(int, input().split()))\na = sorted(a)\nprint(a)\ni = 0\nans = 0\nj = 3 * n - 2\nwhile i < n:\n ans += a[j]\n i += 1\n j -= 2\n\nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\na = sorted(a)\ni = 0\nans = 0\nj = 3 * n - 2\nwhile i < n:\n ans += a[j]\n i += 1\n j -= 2\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s193425380', 's439261002'] | [39620.0, 39492.0] | [303.0, 248.0] | [166, 157] |
p03767 | u506549878 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\ndata = list(map(int,input().split()))\ndata = sorted(data, reverse=True)\nsum = 0\ndel data[0]\ndel data[-1]\nsum += data[0]\ndel data[0]\nprint(sum)', 'n = int(input())\ndata = list(map(int,input().split()))\ndata = sorted(data, reverse=True)\nsum = 0\nwhile data != []\n del data[0]\n del data[-1]\n sum += data[0]\n del data[0]\nprint(sum)', 'n = int(input())\ndata = list(map(int,input().split()))\ndata = sorted(data, reverse=True)\nsum = 0\nfor i in range(n):\n sum += data[1+2*i]\nprint(sum)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s294649326', 's374358538', 's388996118'] | [37084.0, 2940.0, 37084.0] | [215.0, 17.0, 231.0] | [159, 192, 149] |
p03767 | u514299323 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\nA = list(map(int,input().split()))\n\nA.sort(reverse = True)\nB = A[1::3]\n\nc = sum(B)\nprint(c)\n', 'N = int(input())\nA = list(map(int,input().split()))\n \nA.sort(reverse = True)\nB = A[1::2]\nc = 0\n\nfor i in range(N):\n c += B[i]\n\nprint(c)'] | ['Wrong Answer', 'Accepted'] | ['s090917672', 's513691266'] | [39492.0, 37084.0] | [209.0, 224.0] | [109, 140] |
p03767 | u519939795 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['Not', 'tms=int(input())\nstrlist=sorted(list(map(int,input().split())))\nans=sum(strlist[tms::][::2])\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s754453629', 's097964621'] | [2940.0, 37084.0] | [18.0, 212.0] | [3, 103] |
p03767 | u527993431 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N=int(input())\nL=list(map(int,input().split()))\nL=sorted(L)\nprint(L[-2])', 'N=int(input())\nL=list(map(int,input().split()))\nL=sorted(L)\nK=0\nfor i in range(N):\n\tK+=L[i*2+N]\nprint(K)\n'] | ['Wrong Answer', 'Accepted'] | ['s033129818', 's832276727'] | [37084.0, 37084.0] | [225.0, 232.0] | [72, 105] |
p03767 | u536034761 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nprint(sum(A[N:2 * N + 1]))', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nprint(sum(A[N + 1:2N + 1])', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort(reverse=True)\nprint(sum(A[1:2 * N:2]))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s376253507', 's781547219', 's873977509'] | [37084.0, 2940.0, 37084.0] | [209.0, 16.0, 212.0] | [88, 88, 98] |
p03767 | u536113865 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['input()\na = list(map(int, input().split()))\na.sort(reverse=True)\nprint(sum(a[1::2]))', 'n = int(input())\na = list(map(int, input().split()))\na.sort(reverse=True)\nprint(sum(a[1:2*n:2]))'] | ['Wrong Answer', 'Accepted'] | ['s957137280', 's433034224'] | [37084.0, 37084.0] | [209.0, 210.0] | [84, 96] |
p03767 | u539123425 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['n = int(input())\na = sorted(list(map(int,input().split())))\nsum_a = 0\nfor i in range(n):\n print(a[n//2+1+i])\n sum_a += a[len(a)//2+i]\nprint(sum_a)', 'n = int(input())\na = sorted(list(map(int,input().split())),reverse=True)\nsum_a = 0\nfor i in range(1,2*n+1,2):\n print(a[i])\n sum_a += a[i]\nprint(sum_a)', 'n = int(input())\na = sorted(list(map(int,input().split())),reverse=True)\nsum_a = 0\nfor i in range(1,2*n+1,2):\n sum_a += a[i]\nprint(sum_a)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s466005311', 's736956413', 's093960814'] | [43704.0, 42732.0, 42604.0] | [203.0, 191.0, 153.0] | [152, 156, 140] |
p03767 | u541610817 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\na_lst = [int(x) for x in input().split()]\n\na_lst.sort(reverse=True)\n\nsum = 0\nfor i in range(1, 3*N, 2):\n sum += a_lst[i]\nprint(sum)\n', 'N = int(input())\na_lst = [int(x) for x in input().split()]\n\na_lst.sort(reverse=True)\n\nsum = 0\nfor i in range(1, 2*N, 2):\n sum += a_lst[i]\nprint(sum)\n'] | ['Wrong Answer', 'Accepted'] | ['s474043709', 's104949610'] | [37084.0, 37084.0] | [238.0, 226.0] | [152, 152] |
p03767 | u549161102 | 2,000 | 262,144 | There are 3N participants in _AtCoder Group Contest_. The _strength_ of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams. The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3. Find the maximum possible sum of the strengths of N teams. | ['N = int(input())\na = [int(i) for i in input().split()]\na = a.sort(reverse=True)\n\nans = sum(a[2*i] for i in range(1,N+1))\nprint(ans)', 'N = int(input())\na = [int(i) for i in input().split()]\na = a.sort(reverse=True)\n\nfor i in range(N):\n suma[3*N-2*(i+1)])\nans = sum(array)\nprint(ans)\n', 'N = int(input())\na = [int(i) for i in input().split()]\na = a.sort(reverse=True)\n\nfor i in range(1,N+1):\n ans = sum(a[2*i-1])\nprint(ans)', 'N = int(input())\na = [list(map(int, input().split()))]\na = a.sort()\narray = []\nfor i in range(N):\n array = array.append(a[3*N-2*(i+1)])\nans = sum(array)\nprint(ans)', 'N = int(input())\na = [int(i) for i in input().split()]\na.sort(reverse=True)\n\nans = sum(a[2*i-1] for i in range(1,N+1))\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s002880500', 's220473824', 's376681839', 's527958641', 's634370471'] | [39492.0, 2940.0, 37084.0, 37084.0, 37084.0] | [224.0, 17.0, 211.0, 91.0, 229.0] | [131, 149, 136, 164, 129] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.