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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02989 | u847605090 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['n=int(input())\nd=list(map(int,input().split()))\nd.sort()\nprint(d[n//2]-d[n//\n ', 'n=int(input())\nd=list(map(int,input().split()))\nd.sort()\nprint(d[n//2]-d[n//2-1])\n'] | ['Runtime Error', 'Accepted'] | ['s247947999', 's833571517'] | [2940.0, 14008.0] | [17.0, 76.0] | [80, 82] |
p02989 | u852367841 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ["N = int(input())\nd_list = list(map(int, input().split()))\nd_list.sort()\n\nk = d_list[int(N/2)]\nprint(k)\n\ncount = 0\nfor i in range(N):\n if count == int(N/2):\n print('k is ' + str(k)) \n print(d_list[int(N/2)] - d_list[int(N/2)-1])\n break\n elif k > d_list[i]:\n count += 1\n ... | ['Wrong Answer', 'Accepted'] | ['s558557858', 's231536422'] | [14556.0, 14396.0] | [113.0, 113.0] | [387, 344] |
p02989 | u860002137 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['N = int(input())\nd = [int(x) for x in input().split()]\n\nd.sort()\nlength = len(d)\nleft = d[length//2-1]\nright = d[length//2]\n\nif left==right:\n print(0)\nelse:\n print(ans)', 'N = int(input())\nd = [int(x) for x in input().split()]\n\nd.sort()\nlength = len(d)\nleft = d[length//2-1]\nright = d[length//2]... | ['Runtime Error', 'Accepted'] | ['s008428502', 's494246938'] | [14120.0, 14428.0] | [81.0, 79.0] | [174, 183] |
p02989 | u863397945 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1', 'N = int(input())\nD = list(map(int,input().split()))\n\nsorted_D = sorted(D)\n\nf = N//2 - 1\ns = f + 1\n\nprint(sorted_D[s]-sorted_D[f])'] | ['Runtime Error', 'Accepted'] | ['s594777897', 's757373726'] | [8744.0, 20516.0] | [24.0, 68.0] | [80, 129] |
p02989 | u868628468 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['N = int(input())\nD = map(int, input().split())\nB = sorted(D)\n\nif B[N/2] == B[(N/2)-1]:\n print(0)\nelse:\n print(B[N/2]-B[(N/2)-1])', 'N = int(input())\nD = list(map(int, input().split()))\nB = sorted(D)\n\nif B[N/2] == B[(N/2)-1]:\n print(0)\nelse:\n print(B[N/2]-B[(N/2)-1])', 'N = int(input())\nD = ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s161119273', 's667802614', 's034531498'] | [14428.0, 14428.0, 14396.0] | [95.0, 76.0, 76.0] | [134, 140, 156] |
p02989 | u882209234 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['N = int(input())\nd = list(map(int,input().split()))\nd.sort()\nl = N//2-1\nr = N//2\n\nif d[l] == d[r]: print(0)\nelse:\n print(d[l],d[r])\n print(d[r]-d[l])', 'N = int(input())\nd = list(map(int,input().split()))\nd.sort()\nl = N//2-1\nr = N//2\n\nif d[l] == d[r]: print(0)\nelse:\n print(d[r]-d[l])'] | ['Wrong Answer', 'Accepted'] | ['s265706460', 's763988360'] | [14396.0, 14556.0] | [76.0, 76.0] | [155, 134] |
p02989 | u888337853 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['import math\nimport copy\n# import numpy as np\n\n# ===FUNCTION===\n\ndef getInputNum():\n inputNum = int(input())\n return inputNum\n\ndef getInputListInt():\n outputoData = []\n inputData = input().split()\n outputData = [int(n) for n in inputData]\n\n return outputData\n\ndef getSomeInputInt(n):\... | ['Wrong Answer', 'Accepted'] | ['s724141480', 's700663937'] | [15040.0, 15040.0] | [98.0, 88.0] | [868, 856] |
p02989 | u893661063 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['N = int(input())\nd = map(int, input().split())\nd = sorted(d, reverse = False)\nprint (d)\n\nans = d[N//2] - d[N//2-1]\nprint (ans)', 'N = int(input())\nd = map(int, input().split())\nd = sorted(d, reverse = False)\n\nans = d[N//2] - d[N//2-1]\nprint (ans)'] | ['Wrong Answer', 'Accepted'] | ['s602612882', 's737211872'] | [20568.0, 20692.0] | [70.0, 67.0] | [126, 116] |
p02989 | u896741788 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['n=int(input())\nl=sorted(list(map(int,input().split())))\nprint(l[n//2]-l[n//2-1]-1)', 'n=int(input())\nl=sorted(map(int,input().split()))\nprint(l[n//2]-l[n//2-1])'] | ['Wrong Answer', 'Accepted'] | ['s751018929', 's177540480'] | [14428.0, 14396.0] | [77.0, 75.0] | [82, 74] |
p02989 | u900139929 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ["n = input()\nnums = input().split(' ')\nprint(nums)\nnums = [int(num) for num in nums]\ncnt=0\n\nfor i in range(1,len(nums)-1):\n \n print(nums[i-1], nums[i], nums[i+1])\n if nums[i-1] < nums[i] and nums[i] < nums[i+1]:\n cnt += 1\n print('OK')\n if nums[i+1] < nums[i] and nums[i] < nums[i-1]:\n cnt += 1... | ['Wrong Answer', 'Accepted'] | ['s735305933', 's760901281'] | [14752.0, 14120.0] | [314.0, 81.0] | [342, 172] |
p02989 | u901598613 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['n=input()\nl=list(map(int,input().split()))\nans=0\nfor i in range(n-2):\n a=l[i:i+3]\n b=a[1]\n c=sorted(a)\n if b==c[1]:\n ans+=1\nprint(ans)', 'n=int(input())-1\nl=list(map(int,input().split()))\nl.sort()\nm=n//2\nif l[m]==l[m+1]:\n print(0)\nelse:\n print(l[m+1]-l[m])'] | ['Runtime Error', 'Accepted'] | ['s952876389', 's101067588'] | [14396.0, 14396.0] | [41.0, 75.0] | [153, 124] |
p02989 | u905582793 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['n = int(input())\na = list(map(int,input().split()))\na.sort()\nprint(a[n//2+1]-a[n//2])', 'n = int(input())\na = list(map(int,input().split()))\na.sort()\nelse:\n print(a[n//2]-a[n//2-1])', 'n = int(input())\na = list(map(int,input().split()))\na.sort()\nif n == 2:\n print(a[1]-a[0])\nelse:\n print(a[n//2+1]-a[n/... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s667680763', 's948180904', 's957020473', 's696047134'] | [13992.0, 2940.0, 13988.0, 14396.0] | [77.0, 17.0, 76.0, 77.0] | [85, 93, 123, 85] |
p02989 | u912179452 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['N = int(input())\nd = list(map(int, input().split()))\n""" \nd = [9, 1, 4, 4, 6, 7]\n#N = 8\nN = 6\n#d = [9, 1, 14, 5, 5, 4, 4, 14]\nd = [9, 1, 4, 4, 6, 7]\n """\n# prob\n# [number,value]\nprob = []\ncnt = 0\nfor i in d:\n prob.append([cnt, i])\n cnt += 1\n\n\nsorted_d = sorted(prob, key=lambda x: x[1])\n\n#pri... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s447825957', 's919726471', 's981472569'] | [23168.0, 2940.0, 23164.0] | [154.0, 18.0, 158.0] | [489, 792, 496] |
p02989 | u918601425 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['N=input()\nls=[int(s) for s in input().split()]\nls.sort()\nprint(ls[N//2]-ls[N//2-1])', 'N=int(input())\nls=[int(s) for s in input().split()]\nls.sort()\nprint(ls[N//2]-ls[N//2-1])\n'] | ['Runtime Error', 'Accepted'] | ['s616653210', 's744571286'] | [14396.0, 14396.0] | [82.0, 80.0] | [83, 89] |
p02989 | u923659712 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['n=int(input())\na=list(map(int,input().splilt()))\na.sort()\nif a[n/2-1]!=a[n/2]:\n print(a[n/2]-a[n/2-1])\nelse:\n print(0)', 'n=int(input())\na=list(map(int,input().split()))\na.sort()\nif a[n//2-1]!=a[n//2]:\n print(a[n//2]-a[(n//2)-1])\nelse:\n print(0)'] | ['Runtime Error', 'Accepted'] | ['s896230642', 's622618576'] | [4724.0, 14396.0] | [18.0, 76.0] | [120, 125] |
p02989 | u934788990 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['n = int(input())\n\ni = [int(input()) for d in range(n)]\n\ni.sort()\n\nl = i[n//2]\nk = i[n//2-1]\n\nprint(l-k)', 'n=int(input())//2\nd=sorted(list(map(int,input().split())))\nprint(d[n]-d[n-1])\n'] | ['Runtime Error', 'Accepted'] | ['s376574661', 's312163191'] | [4724.0, 14428.0] | [21.0, 76.0] | [103, 78] |
p02989 | u934868410 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['n = int(input())\nd = list(map(int, input().split()))\nd.sort()\n\nprint(d[n/2] - d[n/2-1])', 'n = int(input())\nd = list(map(int, input().split()))\nd.sort()\nprint(d[int(n/2)] - d[int(n/2)-1])'] | ['Runtime Error', 'Accepted'] | ['s852971064', 's290568524'] | [13992.0, 14428.0] | [77.0, 78.0] | [87, 96] |
p02989 | u943057856 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['n=int(input())\na=sorted(list(map(int,input(.split()))))\np=a[n//2-1]\nq=a[n//2]\nprint(q-p)', 'n=int(input())\na=sorted(list(map(int,input().split())))\np=a[n//2-1]\nq=a[n//2]\nprint(q-p)'] | ['Runtime Error', 'Accepted'] | ['s757600727', 's188676742'] | [2940.0, 14428.0] | [17.0, 76.0] | [88, 88] |
p02989 | u947327691 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['n=int(input())\nl=list(map(int,input().split()))\nprint(n//2)\nl.sort()\nprint(l[n//2]-l[n//2-1])\n', 'n=int(input())\nl=list(map(int,input().split()))\nl.sort()\nprint(l[n//2]-l[n//2-1])\n'] | ['Wrong Answer', 'Accepted'] | ['s521351052', 's474433259'] | [14396.0, 14428.0] | [75.0, 76.0] | [94, 82] |
p02989 | u958581328 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ["def main():\n n = int(input())\n ks = sorted(list(map(int, input().split())))\n a, b = ks[n/2-1:n/2]\n if a == b:\n print(0)\n else:\n print(b-a)\n \n \nif __name__ == '__main__':\n main()", "def main():\n n = int(input())\n ks = sorted(list(map(int, input().split())))\n a, b = ks[n//2-1:n//2+1... | ['Runtime Error', 'Accepted'] | ['s322643229', 's047128528'] | [14556.0, 14004.0] | [79.0, 76.0] | [191, 211] |
p02989 | u963963908 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['#ABC132 C\n\nN = int(input())\nD = list(map(int,input().split()))\ncount = 0\nfor K in range(N):\n A = []\n B = []\n if D[i] >= K:\n A.append(D[i])\n else:\n B.append(D[i])\n if len(A) == len(B):\n count += 1\n \nprint(count)', '#ABC132 C\n\nN = int(input())\nD = list(map(int,in... | ['Runtime Error', 'Accepted'] | ['s010343002', 's819497688'] | [20444.0, 20684.0] | [50.0, 67.0] | [249, 133] |
p02989 | u982462877 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['n = int(input())\nnums = list(map(int,input().split()))\n\nnums.sort()\nprint(nums)\n\nif n%2==1:\n print(0)\nelse:\n x=int((n/2)-1)\n y=int(n/2)\n a=nums[x]\n b=nums[y]\n s=b-a\n print(s)\n', 'n = int(input())\nnums = list(map(int,input().split()))\n\nnums.sort()\n\nif n%2==1:\n print(0)\nels... | ['Wrong Answer', 'Accepted'] | ['s568189029', 's139553334'] | [14428.0, 14428.0] | [85.0, 75.0] | [196, 183] |
p02989 | u984276646 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['N = int(input())\nA = list(map(int, input()))\nA.sort()\nprint(A[N//2] - A[N//2 - 1])', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nprint(A[N//2] - A[N//2 - 1])\n'] | ['Runtime Error', 'Accepted'] | ['s232825890', 's053073743'] | [4724.0, 14556.0] | [19.0, 77.0] | [82, 91] |
p02989 | u986190948 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['N = int(input())\nd = sorted(map(int, input().split()))\nprint(d[N/2]-d[N/2-1])\n', 'N = int(input())\nd = sorted(map(int, input().split()))\nK = d[int(N/2)]-d[int(N/2)-1]\nprint(K)\n'] | ['Runtime Error', 'Accepted'] | ['s647889091', 's643151211'] | [13992.0, 14396.0] | [76.0, 76.0] | [78, 94] |
p02989 | u991130896 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['N = int(input())\nL = list(map(int, input().split()))\n\nL_sorted= L.sort()\n\ntarget_num = N/2\nif L_sorted[target_num-1] = L_sorted[target_num]\n\tprint(0)\nelse:\n \tprint(L_sorted[target_num]-L_sorted[target_num-1])', 'N = int(input())\nL = list(map(int,input().split()))\n \nL.sort()\n \ntarget_num = int(N/2)\ni... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s017271965', 's195311378', 's532139172', 's719545873', 's754277518', 's823682033', 's859953381', 's388974185'] | [2940.0, 2940.0, 2940.0, 14396.0, 2940.0, 2940.0, 2940.0, 14396.0] | [17.0, 17.0, 17.0, 75.0, 17.0, 17.0, 17.0, 76.0] | [209, 188, 222, 80, 215, 212, 227, 91] |
p02989 | u993461026 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['N = int(input())\nd = map(int, input().split())\nd.sort()\na = d[N//2-1]\nb = d[N//2]\nif a==b:\n print(0)\nelse:\n print(b-a)', 'N = int(input())\nd = list(map(int, input().split()))\nd.sort()\na = d[N//2-1]\nb = d[N//2]\nif a==b:\n print(0)\nelse:\n print(b-a)'] | ['Runtime Error', 'Accepted'] | ['s428209917', 's734553997'] | [10588.0, 14396.0] | [25.0, 76.0] | [120, 126] |
p02989 | u998679483 | 2,000 | 1,048,576 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder). He is dividing the problems into two categories by choosing an integer K, as follows: * A problem with difficulty K or higher will be _f... | ['# ALC 005 C\n\nN = int(input())\nlist_d = list(map(int, input().split()))\n\nlist_d.sort()\nlist_d[N//2] - list_d[N//2 -1]', '# ALC 005 C\n\nN = int(input())\nlist_d = list(map(int, input().split()))\n\nlist_d.sort()\nprint(list_d[N//2] - list_d[N//2 -1])'] | ['Wrong Answer', 'Accepted'] | ['s391257516', 's126130997'] | [14556.0, 14428.0] | [76.0, 76.0] | [116, 123] |
p02990 | u003475507 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['n, k = map(int, input().split())\nmod = 10 ** 9 + 7\n \n \ndef cmb(n, r):\n\n # print("nsr",n,r)\n if (r < 0): return 1\n if (n < 0): return 1\n if (n < r): return 0\n\n\n r = min(r, n - r)\n x = 1\n y = 1\n for i in range(r):\n x = x * (n - i) % mod\n y = y * (i + 1) % mod\n ... | ['Wrong Answer', 'Accepted'] | ['s050903470', 's212107787'] | [3188.0, 3316.0] | [426.0, 428.0] | [703, 704] |
p02990 | u007550226 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['N,K = map(int,input().split())\nif K == 1:\n print(1)\nelse:\n for i in range(1,K+1):\n if i == 1 or i == K:\n print(comb(N-K+1,i,10**9+7))\n else:\n k = factorial(N-K+1) #% (10**9+7)\n l = factorial(N-K+1-i) #% (10**9+7)\n m = factorial(i-1) #% (10**9+7... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s156047746', 's213609487', 's914631669', 's192602964'] | [3060.0, 3064.0, 3064.0, 3828.0] | [17.0, 17.0, 17.0, 25.0] | [451, 437, 450, 493] |
p02990 | u009219947 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import math\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nN, K = map(int, input().split())\nmod = int(1e+9 + 7)\nprint(mod)\nfor i in range(1, K+1):\n print(int(combinations_count(N-K+1, i) * combinations_count(K-1, i-1) % mod))\n', 'import mat... | ['Runtime Error', 'Accepted'] | ['s733092764', 's817094486'] | [3188.0, 3316.0] | [203.0, 833.0] | [292, 327] |
p02990 | u019678995 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import math\n\ndef main():\n N, K = list(map(int, input().split(" ")))\n for i in range(1, K+1):\n \n blue_remain = K-i\n blue_comb = i**blue_remain\n red_remain = N-K-(i-1)\n red_comb = (i+1)**red_remain+1\n comb = blue_comb * red_comb\n print(comb)\n \n\... | ['Runtime Error', 'Accepted'] | ['s297312891', 's560763078'] | [5236.0, 3316.0] | [166.0, 27.0] | [356, 668] |
p02990 | u020959776 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["import io\nimport sys\nfrom functools import lru_cache\n\nsys.setrecursionlimit(10000)\n\n\ndef IN_S():\n return input()\n\n\ndef IN_I():\n return int(input())\n\n\ndef IN_L_I():\n return list(map(int, input().split()))\n\n\ndef IN_L_S():\n return list(map(str, input().split()))\n\n\ndef STR_SPLIT(s, n):\n for l... | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s024129542', 's315110688', 's476546756'] | [9564.0, 213516.0, 4596.0] | [1085.0, 2117.0, 32.0] | [1148, 1242, 1756] |
p02990 | u022215787 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['n, k = map(int,input().split())\nfrom math import factorial\nans = []\nfor i in range(1, k+1):\n c = factorial(n-k+1) // (factorial(n-k+1 - i) * factorial(i))\n if c == 0:\n break\n ans.append(c)\n\nmod = 10**9 + 7\nfor j in ans:\n print(j%mod)', 'import math\ndef C(n,r):\n if n<0 or r<0 or n-r<0:... | ['Runtime Error', 'Accepted'] | ['s663379007', 's833927053'] | [3316.0, 3316.0] | [136.0, 831.0] | [252, 235] |
p02990 | u032566873 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['N, K = map(int, input().split())\nfrom operator import mul\nfrom functools import reduce\n\ndef nCr(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n\nfor j in range(K):\n if (2*j+1)>N:\n print(0)\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s059259709', 's113234142', 's464447155', 's465948650', 's994898319', 's999158673', 's356641907'] | [3060.0, 4016.0, 2940.0, 4004.0, 2940.0, 2940.0, 3316.0] | [17.0, 75.0, 17.0, 75.0, 17.0, 17.0, 204.0] | [438, 366, 382, 367, 319, 319, 258] |
p02990 | u044635590 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['nk = list(map(int, list(input().split())))\n\nn = nk[0]\nk = nk[1]\n\ncountSplit = 1\ncountPut = n - k + 1\n\nfor i in range(k):\n if i == 0:\n print(n - k + 1)\n elif i <= n - k:\n countSplit = int(countSplit * (k - i) / i)\n countPut = int(countPut * (n - k + 1 - i) / (i + 1))\n pr... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s140320704', 's217770302', 's285728451', 's350978882', 's442855707', 's522944468', 's804989482', 's467712627'] | [3316.0, 3316.0, 3316.0, 3316.0, 3316.0, 3316.0, 3316.0, 3316.0] | [19.0, 203.0, 204.0, 203.0, 204.0, 204.0, 204.0, 211.0] | [377, 560, 560, 560, 560, 552, 556, 606] |
p02990 | u046432236 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['def cmb(n, r):\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2,r+1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n ... | ['Wrong Answer', 'Accepted'] | ['s238383475', 's827493853'] | [3444.0, 3444.0] | [545.0, 545.0] | [863, 864] |
p02990 | u058861899 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import math\n\nn,k=map(int,input().split())\n\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nfor i in range(1,k+1):\n a = comb(k-1, i-1)\n b = comb(n-k+1, i)\n print((a*b)%(10**9+7))\n\n \n \n\n\nfor i in range(1,k+1):\n a = comb(k-1, i-1)\n b =... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s775521167', 's961069461', 's713792908'] | [3188.0, 3064.0, 3316.0] | [389.0, 18.0, 830.0] | [345, 351, 279] |
p02990 | u061984624 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['n, k = map(int, input().split())\nC = [[1], [1,1]]\nfor i in range(2, n):\n C.append([1])\n for j in range(1, i):\n C[i].append(C[i-1][j-1] + C[i-1][j])\nfor i in range(1, k+1):\n print(C[n-k+1][i] * C[k-1,i-1])\n \n', 'n, k = map(int, input().split())\nC = [[1], [1,1]]\nfor i in range(2, n):\n C.append([1])\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s311294309', 's485607951', 's014994700'] | [3060.0, 3060.0, 83472.0] | [20.0, 17.0, 718.0] | [214, 213, 280] |
p02990 | u062459048 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['N, K = map(int, input().split())\nimport math\nmod =10**9+7\n\nl = []\nl.append(N-K+1)\nfor i in range(1, K):\n a = l[i-1] * 1/(i+1) * (N-K-i) * 1/(i) * (K-1-i) \n l.append(int(a))\n\nfor j in l:\n print(j%mod)\n', 'N, K = map(int, input().split())\nimport math\n\nttl = 0\nl = []\nfor i in range(K):\n a = math.fa... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s364078486', 's394583041', 's709897414', 's851427215', 's768498876'] | [3316.0, 3060.0, 3060.0, 3688.0, 3444.0] | [21.0, 21.0, 107.0, 23.0, 20.0] | [203, 298, 296, 197, 197] |
p02990 | u075304271 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['def ncr(n, r):\n if n < r: return 0\n r = min(r, n-r)\n numer = functools.reduce(operator.mul, range(n, n-r, -1), 1)\n denom = functools.reduce(operator.mul, range(1, r+1), 1)\n return numer / denom\n\ndef solve():\n n, k = map(int, input().split())\n for i in range(1,k+1):\n ans = (ncr(k-... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s473714013', 's560292652', 's714671319', 's735628514', 's897125040'] | [9208.0, 10532.0, 10452.0, 10428.0, 10552.0] | [28.0, 42.0, 61.0, 39.0, 363.0] | [422, 544, 548, 545, 554] |
p02990 | u077291787 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['# ABC132D - Blue and Red Balls\ndef get_fact_and_inv(lim: int) -> tuple:\n # compute tables of factorials and inverse factorials (1-idx)\n fact = [1] * (lim + 1)\n x = 1\n for i in range(1, lim + 1):\n x = (x * i) % MOD\n fact[i] = x\n\n inv = [1] * (lim + 1)\n inv[-1] = pow(fact[-1], ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s429922337', 's841351042', 's395439619'] | [3432.0, 3432.0, 3064.0] | [21.0, 21.0, 19.0] | [964, 963, 330] |
p02990 | u095426154 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['# coding: utf-8\n# Your code here!\ndef cmb(n, r):\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2,r+1):\n pivot = denominator[p - 1]\n if pivot > 1:\n... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s248277748', 's538348154', 's668590262'] | [3700.0, 3700.0, 3948.0] | [21.0, 1114.0, 26.0] | [1010, 978, 704] |
p02990 | u106311097 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["# -*- coding: utf-8 -*-\n# abc132/abc132_d\nimport sys\nfrom functools import lru_cache\n\ns2nn = lambda s: [int(c) for c in s.split(' ')]\nss2nn = lambda ss: [int(s) for s in list(ss)]\nss2nnn = lambda ss: [s2nn(s) for s in list(ss)]\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lamb... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s324795666', 's946759285', 's320377148'] | [4084.0, 4084.0, 3572.0] | [28.0, 27.0, 22.0] | [1837, 1831, 545] |
p02990 | u106778233 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['n,k=map(int,input().split())\nr1=1\nimport math\nmod=10**9+7\ndif=n-k\nfor i in range(k):\n r1*=(k-1-i)*(dif+1-i)*pow((i+1)**2, mod-2, mod)%mod\n print(r1)', 'n,k=map(int,input().split())\nr1=1\nt=1\nimport math\nmod=10**9+7\ndif=n-k\nfor i in range(k):\n if i==0:r1=dif+1\n else:\n r1=r1*(k-i)*(dif+1-i)*pow((i... | ['Wrong Answer', 'Accepted'] | ['s930685279', 's125721754'] | [6004.0, 3316.0] | [261.0, 27.0] | [150, 182] |
p02990 | u114139438 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import math\nn,k=map(int,input().split()) \nlst=list()\n\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nfor i in range(1, k+1):\n if i > N - K + 1:\n lst.append(int(0))\n else:\n lst.append(comb(n-k+1, i) * comb(k-i+(i-1), i-1)) \n\nfor i in range... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s001155708', 's012299186', 's171417775', 's361530028', 's569240303', 's662343925', 's736300987', 's752807277', 's932548862', 's689521944'] | [3064.0, 3412.0, 3060.0, 3064.0, 3064.0, 3444.0, 3060.0, 3412.0, 3060.0, 3316.0] | [17.0, 204.0, 17.0, 17.0, 17.0, 203.0, 17.0, 203.0, 17.0, 202.0] | [337, 401, 282, 343, 332, 438, 278, 436, 304, 293] |
p02990 | u130900604 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['a=10**9+7\nn,k=map(int,input().split())\nfrom math import factorial \n"def c(t, r):\n" return factorial(t)//factorial(t-r)//factorial(r)\ndef f(x):\n return factorial(x)\n\n\nfor _ in range(1,k+1):\n a1=f(n-k+1)%a\n a2=f(n-k+1-_)\n a3=f(_)\n a4=f(k-1)%a\n a5=f(k-1-_+1)\n a6=f(_-1)\n ans=a1*a4//(a2*a3*a5*a6)%... | ['Runtime Error', 'Accepted'] | ['s554113828', 's327980043'] | [2940.0, 4852.0] | [17.0, 34.0] | [355, 637] |
p02990 | u150664457 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['N, K = map(int,input().split()) \n\nfrom operator import mul\nfrom functools import reduce\n\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n \nred = N - K\nblue = K\ndivision = 10 ** 9 + 7\n\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s620486676', 's877406148', 's671245419'] | [3812.0, 3064.0, 3940.0] | [28.0, 17.0, 175.0] | [644, 645, 580] |
p02990 | u151503168 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['# -*- coding:utf-8 -*-\n\ndef cmb(n, r):\n if n == 0 or r == 0:\n return 1\n a = b = 1\n for i in range(1,r+1):\n a *= i\n for i in range(n-r+1,n+1):\n b *= i\n return b//a\n\nN = list(map(int,input().split()))\nM = 10**9 + 7\nred = N[0]-N[1]\nfor i in range(1,N[1]+1):\n x = cmb... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s137172419', 's270441704', 's439229399', 's861147562'] | [3316.0, 3316.0, 3060.0, 3316.0] | [2104.0, 20.0, 17.0, 20.0] | [350, 172, 150, 173] |
p02990 | u153302617 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['n = int(input())\nk = int(input())\ndef cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n-r] % p\n\np = 10 ** 9 + 7\nN = 10 ** 6 \nfact = [1, 1] # fact[n] = (n! mod p)\nfactinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)\ninv = [0, 1] \n\... | ['Runtime Error', 'Accepted'] | ['s952530278', 's646013626'] | [3064.0, 3700.0] | [17.0, 24.0] | [579, 584] |
p02990 | u197038614 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import sys\nsys.setrecursionlimit(100000)\nn, k = map(int, input().split())\n\nnCr = {}\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n\nfor i in range(1, k + 1):\n # print("{0},... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s011542714', 's474609624', 's335450166'] | [234004.0, 230872.0, 3316.0] | [2115.0, 2115.0, 202.0] | [377, 394, 385] |
p02990 | u203022424 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['def cmb(n, r):\n n_ = math.factorial(n)\n n_r_ = math.factorial(n-r) \n r_ = math.factorial(r)\n return n_//(r_*n_r_)\n \ni = list(map(int, input().split(" ")))\nk = i[1]\nn = i[0]\na = 1000000007\n \nfor i in range(1, k+1):\n if n-k+1 >= i:\n \tni = cmb(n-k+1,i)*cmb(k-1,i-1)\n \tprint(int(ni%a))\n else:\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s024443558', 's457122487', 's495041686', 's618119072', 's862956439', 's863365743'] | [3064.0, 2940.0, 3060.0, 2940.0, 3316.0, 3316.0] | [17.0, 17.0, 17.0, 17.0, 89.0, 201.0] | [310, 291, 277, 345, 274, 293] |
p02990 | u204800924 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import math\n\nn, k = map(int, input().split())\nif n > k:\n\tif n+1 >= 2*k\n\t\tfor i in range(k):\n\t\t\tj = i+1\n\t\t\tc_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))\n\t\t\tc_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))\n\t\t\tcomb = c_blue * c_d... | ['Runtime Error', 'Accepted'] | ['s334246912', 's574727633'] | [2940.0, 3444.0] | [17.0, 202.0] | [684, 685] |
p02990 | u207464563 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["import numpy as np\n \ndef main():\n N,M = map(int,input().split())\n A = np.array(list(map(int,input().split())))\n A = np.sort(A)\n BC = [] \n \n for i in range(M):\n tmp = list(map(int,input().split()))\n BC.append(tmp)\n \n \n BC =sorted(BC, key=lambda x: x[1],reverse=True)\n ... | ['Runtime Error', 'Accepted'] | ['s877699271', 's803698787'] | [12516.0, 3316.0] | [150.0, 203.0] | [1133, 281] |
p02990 | u211236379 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["mport math\nall ,blue = map(int,input().split())\nred = all - blue\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nfor i in range(1,blue+1):\n if (red+1) < i:\n print('0')\n else:\n print((combinations_count(blue-1,i-1)*combination... | ['Runtime Error', 'Accepted'] | ['s986760388', 's148619606'] | [2940.0, 3316.0] | [17.0, 203.0] | [335, 339] |
p02990 | u214434454 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['n,k= map(int,input().split())\nm = n - k +1 \ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7\nN = 10**4\ng1 = [1, 1]\ng2 = [1, 1]\ninverse = [0, 1] \n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s668458459', 's800961833', 's990078052', 's641777553'] | [4596.0, 4328.0, 4596.0, 15508.0] | [30.0, 29.0, 30.0, 138.0] | [479, 469, 478, 462] |
p02990 | u222207357 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['\nN, K = map(int,input().split())\n\nmod = 10000000007\n\nR = N-K\n\ndef cmb(n, r, mod):\n if (r < 0 or r > n):\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n \nmod = 10 ** 9 + 7\ng1 = [1, 1]\ng2 = [1, 1]\ninverse = [0, 1]\n \nfor i in range(2, 2010 + 1):\n g1.append((g1[... | ['Wrong Answer', 'Accepted'] | ['s710911189', 's622488672'] | [3444.0, 3572.0] | [25.0, 24.0] | [543, 542] |
p02990 | u222643751 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import math\n\ndef combi(n ,k):\n return math.factorial(n)/(math.factorial(k)*math.factorial(n-k))\n\nN, K = map(int, input().split())\n\ncnt_list = []\nfor i in range(1,K+1):\n if N-K+1 >= i:\n cnt = combi(N-K+1,i)*combi(K-1,i-1)\n else:\n cnt =0\n cnt_list.append(cnt%(10**9+7))\n\nfor i in... | ['Runtime Error', 'Accepted'] | ['s830391917', 's414086161'] | [3316.0, 3444.0] | [89.0, 203.0] | [348, 354] |
p02990 | u248670337 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['#ABC132 D\nimport math\ndef cmb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nN, K = map(int, input().split())\nfor i in range(K):\n try:\n print((cmb(N - K + 1, i + 1) * cmb(K, i)) % ((10 ** 9) + 7))\n except:\n print(0)', '#ABC132 D\nimport math\ndef cmb(n,... | ['Wrong Answer', 'Accepted'] | ['s412297675', 's403645804'] | [3316.0, 3316.0] | [203.0, 202.0] | [271, 275] |
p02990 | u255821449 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['# -*- coding: utf-8 -*-\n\ndef conbination(n, r):\n return f[n] // f[r]*f[n-r]\n\nf = [1]\nfor i in range(1, 2001):\n f.append(int(f[i-1]*i))\n\nN, K = map(int, input().split())\n\nfor i in range(1, K+1):\n c_blue = conbination(K-1, i-1)\n c_red = conbination(N-K+1, i)\n print((c_blue * c_red) % (10**9... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s062754817', 's688540911', 's775202808', 's798106465', 's514663933'] | [5748.0, 3060.0, 3060.0, 2940.0, 5748.0] | [432.0, 17.0, 17.0, 17.0, 68.0] | [311, 505, 306, 305, 366] |
p02990 | u255943004 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['from operator import mul\nfrom functools import reduce\ndef nCr(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\nN,K = [int(i) for i in input().split()]\nmod = 1000000000+7\nR = N-K\nB = K\nfor i in rang... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s279465437', 's772843475', 's257914715'] | [3688.0, 3060.0, 3316.0] | [175.0, 18.0, 202.0] | [385, 156, 299] |
p02990 | u256315261 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["def BC132_D():\n n, k = list(map(int, input().split(' ')))\n f = [1] * max(k, n - k + 2)\n for i in range(1, len(f) + 1):\n f[i] = f[i - 1] * i\n\n def comb(n, r):\n if n < r: return 0\n return f[n] // f[r] // f[n - r]\n\n for i in range(1, k + 1):\n print(comb(k - 1, i - 1)... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s421444599', 's463525388', 's511714569', 's549240833', 's629639056'] | [5364.0, 2940.0, 5364.0, 3060.0, 5364.0] | [20.0, 17.0, 20.0, 17.0, 274.0] | [354, 384, 363, 287, 351] |
p02990 | u263830634 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import math\nimport sys\nsys.setrecursionlimit(10 ** 4)\nN, K = map(int, input().split())\nR = N - K\n\nif R == 0: \n print (1)\n for _ in range(1, K):\n print (0)\n exit()\n\nif K == 1: \n print (R+1)\n exit()\n\nK_1 = math.factorial(K-1)\nR_1 = math.factorial(R+1)\n\nfor i in range(1, K+1): \n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s203563174', 's711670300', 's026075785'] | [3444.0, 3316.0, 3700.0] | [21.0, 21.0, 23.0] | [847, 665, 859] |
p02990 | u266964556 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['n,k = map(int,input().split())\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nfor i in range(1,k+1):\n ans = (combinations_count(n-k+1,i)*combinations_count(k-1,i-1))%((10**9)+7)\n print(ans)', 'n,k = map(int,input().split())\n\ndef cmb(n, r, mod):... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s211568890', 's281002066', 's623849379', 's108177648'] | [3060.0, 4332.0, 4596.0, 3316.0] | [18.0, 32.0, 32.0, 202.0] | [255, 579, 579, 343] |
p02990 | u282228874 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['u = 10**5\nmod = 10**9+7\nf = [1]*u\nfor i in range(1,u):\n f[i]*=f[i-1]*i\n f[i] %= mod\n\ndef comb(n,k):\n x = f[n]\n x *= pow(f[k],mod-2,mod)\n x %= mod\n x *= pow(f[n-k],mod-2,mod)\n x %= mod\n return x\n\nn,k = map(int,input().split())\nfor i in range(1,k+1):\n res = 0\n if n-k >= i... | ['Wrong Answer', 'Accepted'] | ['s485133423', 's224910668'] | [7284.0, 7284.0] | [76.0, 80.0] | [378, 380] |
p02990 | u285891772 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\nfrom operator import itemgetter, mul\nfrom copy import deepco... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s136612796', 's137874943', 's749023307'] | [21332.0, 21204.0, 26144.0] | [170.0, 173.0, 148.0] | [1415, 1414, 1671] |
p02990 | u311379832 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['N, K = map(int, input().split())\nINF = 1000000007\nanslist = []\nanslist.append(N - K + 1)\nfor i in range(1, K - 1):\n anslist.append(int(anslist[i - 1] * (anslist[i - 1] - 1)))\n\n\nfor i in anslist:\n print(i % INF)', 'import sys\ninput = sys.stdin.readline\nimport math\n\ndef combnations(n, r):\n return... | ['Wrong Answer', 'Accepted'] | ['s599936076', 's091008514'] | [10992.0, 3316.0] | [2104.0, 203.0] | [216, 377] |
p02990 | u312078744 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["from scipy.misc import comb\n# > comb(n, k, exact = True)\n\nnn, kk = map(int, input().split())\nr = nn - kk\nb = kk\np = 10 ** 9 + 7\n\n# for nCk calculation -----------------------\n'''\nfactorial = [0] * (nn + 1)\nfactorial[0] = 1\nfor i in range(nn):\n factorial[i + 1] = factorial[i] * (i + 1) % p\n# 逆元\n\n\nd... | ['Wrong Answer', 'Accepted'] | ['s634252545', 's562275086'] | [24164.0, 3444.0] | [882.0, 32.0] | [779, 765] |
p02990 | u314260680 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import math\n\ndef C(m,n):\n return math.factorial(m)/math.factorial(n)/math.factorial(m-n)\n\nN,K = map(int,input().split())\nfor i in range(1,K):\n print(C(K-1,i-1)*C(N-K+1,i)/(10**9+7))', 'import math\n\ndef C(m,n):\n if m>=n:\n return math.factorial(m)//math.factorial(n)//math.factorial(m-n)\n ... | ['Runtime Error', 'Accepted'] | ['s985952070', 's165234187'] | [3060.0, 3316.0] | [18.0, 884.0] | [187, 245] |
p02990 | u319839544 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | [' Input1 = [str(input()) for i in range(1)]\n N,K = list(map(int,Input1[0].split()))\n ANS = []\n if N == K:\n ANS.append(1)\n print(1)\n for i in range(K-1):\n ANS.append(0)\n print(0)\n else:\n M = max(K,N-K)\n Mem = [[1 for j in range(i+1)] for... | ['Runtime Error', 'Accepted'] | ['s779960396', 's406810777'] | [2940.0, 83024.0] | [17.0, 1099.0] | [1306, 1378] |
p02990 | u321035578 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['n,k = map(int,input().split())\nmod = 10**9+7\ndp = [None] * (k+1)\ndp[0] = (1 * (n-k+1)) % mod\nprint(dp[0])\nb = k-1\nr = n-k\nfor i in range(1,k+1):\n dp[i] = (dp[i-1] * b * r // (i*(i+1)))%mod\n b -= 1\n r -= 1\n print(dp[i])\n\n\n\n\n\ndef comb_mod(n, k, mod):\n numerator = 1\n denominator = 1\... | ['Wrong Answer', 'Accepted'] | ['s410874939', 's277891961'] | [3316.0, 98304.0] | [20.0, 1712.0] | [485, 373] |
p02990 | u322185540 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['n,k = map(int,input().split())\nfrom math import factorial\nfor i in range(1,k+1):\n if n-k < i-1:\n print(0)\n if n-k == i-1:\n print(factorial(k-1) / factorial(i-1) / factorial((k-1) - (i-1)))\n else:\n a = factorial(k-1) // factorial(i-1) // factorial(k-i)\n b = factorial(n-k+1... | ['Runtime Error', 'Accepted'] | ['s719371281', 's903675640'] | [3188.0, 3316.0] | [213.0, 212.0] | [414, 323] |
p02990 | u330661451 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['# code test \nfrom operator import mul\nfrom functools import reduce\n\n\ndef cmb(n, r):\n r = min(r, n - r)\n if r == 0:\n return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1, r + 1))\n return over // under\n\n\n\nN, K = map(int, input().split())\nMOD = 10**9 + 7\n\... | ['Wrong Answer', 'Accepted'] | ['s484737981', 's565866050'] | [3940.0, 3944.0] | [550.0, 545.0] | [485, 470] |
p02990 | u333945892 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["from collections import defaultdict,deque\nimport sys,heapq,bisect,math,itertools,string,queue\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nmod = 10**9+7\neps = 10**-7\ndef inp(): return int(input())\ndef inpl(): return list(map(int, input().split()))\ndef inpl_str(): return list(input().split())\n\nclass Combi... | ['Wrong Answer', 'Accepted'] | ['s758789343', 's271636273'] | [4464.0, 4468.0] | [40.0, 39.0] | [1502, 1513] |
p02990 | u334712262 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, prod... | ['Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s142000461', 's759322043', 's338751168'] | [6240.0, 6872.0, 6428.0] | [2104.0, 66.0, 83.0] | [2353, 2282, 2359] |
p02990 | u344030307 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["import math\n\nn,k = map(int, input().split())\n\ndef main(i):\n blue = int(math.factorial(k-1) / (math.factorial(i-1) * math.factorial(k-i)))\n red = int(math.factorial(n-k+1) / (math.factorial(n-k+1-i) * math.factorial(i)))\n print((blue*red) % (10**9 + 7))\n\nfor i in range(1, k+1)):\n if i > min(k+1, n-k+2):\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s153790541', 's208570684', 's927769750'] | [9036.0, 9176.0, 9224.0] | [20.0, 81.0, 161.0] | [341, 300, 325] |
p02990 | u346308892 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['\n\nimport sys\nsys.setrecursionlimit(50000)\n\nnCr = {}\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n nCr[(n,r)]=nCr[(n,r)]%(10**9+7)\n return nCr[(n,r)]\n\n\ndef f(a,b):\n #print(a,b)\n if... | ['Wrong Answer', 'Accepted'] | ['s840915240', 's893191903'] | [165980.0, 166116.0] | [2110.0, 1982.0] | [621, 641] |
p02990 | u346812984 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import sys\n\nsys.setrecursionlimit(10 ** 6)\nINF = float("inf")\nMOD = 10 ** 9 + 7\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\nclass Combination:\n \n\n def __init__(self, n_max, mod=10 ** 9 + 7):\n self.mod = mod\n self.modinv = self.make_modinv_list(n_max)\n self.fac,... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s222897820', 's360886651', 's723393754'] | [3572.0, 3572.0, 3572.0] | [22.0, 22.0, 23.0] | [1816, 1768, 1730] |
p02990 | u347640436 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['N, K = map(int, input().split())\n\nc = [[0] * 4000 for _ in range(4000)]\nc[0][0] = 1\nfor i in range(1, 4000):\n ci = c[i]\n ci1 = c[i - 1]\n ci[0] = 1\n for j in range(1, i + 1):\n ci[j] = (ci1[j - 1] + ci1[j]) % 1000000007\n\nfor i in range(1, K + 1):\n print(c[K - 1][i - 1] * c[N - K + 1][i... | ['Time Limit Exceeded', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s249469306', 's458727071', 's721482465', 's165826638'] | [365044.0, 5492.0, 5496.0, 9348.0] | [2126.0, 2104.0, 2104.0, 46.0] | [322, 479, 478, 646] |
p02990 | u350248178 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import math\ndef c(n,r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n \nn,k=map(int,input().split())\nmod=10**9+7\n \nfor i in range(K):\n if n-k<i:\n print(0)\n else:\n print(c(k-1,i)*c(n-k+1,i+1)%mod)', 'import math\ndef c(n,r):\n return math.factorial(n) // ... | ['Runtime Error', 'Accepted'] | ['s760681004', 's015475895'] | [3060.0, 3316.0] | [17.0, 204.0] | [245, 245] |
p02990 | u369402805 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['def prob_d(n=None, k=None):\n if n is None and k is None:\n n, k = [int(a) for a in input().split()]\n div = 10 ** 9 + 7\n for i in range(k):\n if n - k + 1 < i:\n print("0")\n else:\n if k == 1:\n ans = cmb(n, i+1) % div\n print(str(an... | ['Runtime Error', 'Accepted'] | ['s419856764', 's987004866'] | [3064.0, 3944.0] | [17.0, 174.0] | [497, 723] |
p02990 | u375695365 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['n, k = list(map(int, input().split()))\nmod = 10**9 + 7\n\n\n\na = [1] \nb = [1] \n\nfor i in range(1, n+1):\n a.append(i * a[i-1] % mod)\n b.append(pow(a[i], -1, mod))\nprint(a)\nprint(b)\nfor i in range(1, k+1): # ../data_picture\n if n-k < i-1:\n print(0)\n else:\n blue_ball = k-i\n ... | ['Wrong Answer', 'Accepted'] | ['s616840060', 's833283153'] | [9280.0, 9264.0] | [38.0, 35.0] | [750, 732] |
p02990 | u379692329 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i]... | ['Wrong Answer', 'Accepted'] | ['s227928502', 's113953425'] | [4596.0, 4596.0] | [31.0, 31.0] | [684, 552] |
p02990 | u384094369 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import math\nn, k = map(int, input().split())\n \ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n \nfor i in range(1, min(k+1, n-k+1)):\n c = 1\n c *= comb(n-k+1, i)\n c *= comb(k-1, i-1)\n print(c%(10**9+7))', 'import math\nn, k = map(int, input().split())\n... | ['Wrong Answer', 'Accepted'] | ['s405283892', 's894651992'] | [3188.0, 3316.0] | [203.0, 203.0] | [257, 311] |
p02990 | u386782537 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['\nimport math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\ndef permutations_count(n, r):\n return math.factorial(n) // math.factorial(n - r)\n\nN, K = map(int, input().split())\nred = N - K\nfor i in range(K):\n if i+1 ==1:\n ans = (red+1)\n... | ['Wrong Answer', 'Accepted'] | ['s024959849', 's706553287'] | [3316.0, 3316.0] | [203.0, 204.0] | [797, 507] |
p02990 | u398642144 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["N, K = [int(x) for x in input().split(' ')]\nm = 10**9 + 7\nimport math\ndef combination(n, r):\n return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))\n \nfor k in range(1, n+1):\n print(combination(N-K+1, k) % m * combination(K-1, k-1) % m)\n", "N, K = [int(x) for x in input().split(' ')]\nm = 10... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s406408708', 's917078585', 's195019802'] | [3060.0, 3188.0, 5748.0] | [18.0, 157.0, 273.0] | [255, 249, 284] |
p02990 | u402629484 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["import sys\nsys.setrecursionlimit(1000000000)\nimport math\nfrom math import gcd\ndef lcm(a, b): return a * b // gcd(a, b)\nfrom itertools import count, permutations, chain, product\nfrom functools import lru_cache\nfrom collections import deque, defaultdict\nfrom pprint import pprint\nii = lambda: int(input())\nmis ... | ['Wrong Answer', 'Accepted'] | ['s857051332', 's633629831'] | [9996.0, 9776.0] | [38.0, 37.0] | [2375, 2359] |
p02990 | u404629709 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['n,k=map(int,input().split())\ndp=[[0 for i in range(k+1)] for j in range(n+1)]\na=n-r\nif r>=a:\n r=a\nfor i in range(n+1):\n dp[i][0]=1\ndp[1][1]=1\nfor i in range(2,n+1):\n for j in range(1,k+1):\n dp[i][j]=dp[i-1][j-1]+dp[i-1][j]\nfor i in range(1,k+1):\n ans=dp[n-k+1][i]*dp[k-1][i-1]\n while ans>10**9+7:\... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s165139030', 's654427482', 's739573649', 's994584851'] | [35444.0, 35444.0, 35828.0, 357592.0] | [204.0, 208.0, 203.0, 1877.0] | [334, 398, 458, 313] |
p02990 | u405256066 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['from sys import stdin\nfrom operator import mul\nfrom functools import reduce\n\n\ndef cmb(n, r):\n r = min(n-r, r)\n if r == 0:\n return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1, r + 1))\n return over // under\n\n\nN, K = [int(x) for x in stdin.readline().rstrip... | ['Wrong Answer', 'Accepted'] | ['s629308656', 's235762044'] | [3944.0, 3944.0] | [178.0, 176.0] | [458, 462] |
p02990 | u405483159 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['N, K = map( int, input().split() )\nMOD = 10 ** 9 + 7\n\ndef Combi( n, r ):\n n1 = 1\n n2 = 1\n for i in range( 1, r + 1 ):\n n1 = n1 * i % MOD\n n2 = n2 * ( n - i + 1 )\n return ( n2 * pow( n1, MOD - 2, MOD ) ) % MOD\n\nfor i in range( 1, K + 1 ):\n if K - N + 1 > i:\n print( ( Combi( N - K + 1, i ) * ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s134612900', 's344418283', 's514861886', 's676885217', 's914675725', 's001353389'] | [3316.0, 3316.0, 3316.0, 3316.0, 3316.0, 3316.0] | [20.0, 19.0, 19.0, 18.0, 19.0, 248.0] | [362, 368, 382, 382, 396, 368] |
p02990 | u425834921 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['\nn = int(input())\nk = int(input())\n\nimport math\ni = 1\n\nwhile i <= k:\n print((int(math.factorial(n-k+i)/(math.factorial(n-k))*(math.factorial(i))))%(10**9 + 7))\n i += 1\n ', 'n,k = map(int,input().split())\nimport math\n\ndef c(x,y):\n if x == 0 or y == 0:\n return 1\n return math.factorial(x)//math.f... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wro... | ['s008208276', 's019176930', 's030618064', 's068587020', 's103729478', 's166825149', 's296065302', 's331270232', 's366379646', 's415662291', 's445661075', 's446305310', 's455983836', 's473117980', 's506569884', 's513074126', 's537965571', 's564646093', 's624785334', 's679303243', 's700329033', 's711510364', 's725789140... | [2940.0, 3188.0, 2940.0, 3316.0, 3188.0, 2940.0, 3188.0, 2940.0, 3188.0, 3188.0, 3060.0, 2940.0, 3188.0, 2940.0, 3064.0, 3188.0, 3316.0, 2940.0, 3188.0, 3316.0, 3060.0, 2940.0, 2940.0, 3060.0, 3188.0, 3316.0, 3188.0, 3316.0, 2940.0, 3060.0, 3316.0, 3188.0, 3316.0] | [17.0, 2104.0, 17.0, 2104.0, 2103.0, 17.0, 20.0, 17.0, 2103.0, 2097.0, 17.0, 17.0, 17.0, 17.0, 18.0, 2104.0, 2104.0, 17.0, 2104.0, 846.0, 31.0, 17.0, 17.0, 42.0, 1060.0, 279.0, 473.0, 846.0, 17.0, 18.0, 2103.0, 2104.0, 833.0] | [172, 253, 221, 215, 389, 158, 220, 217, 217, 212, 219, 171, 393, 330, 388, 387, 391, 387, 217, 334, 166, 160, 171, 191, 191, 181, 191, 339, 172, 221, 222, 289, 388] |
p02990 | u443536265 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['def nCr(n,r):\n nk = 1\n nrk = 1\n rk = 1\n for i in range (n):\n nk *= i + 1\n for i in range (n-r):\n nrk *= i + 1\n for i in range (r):\n rk *= i + 1\n return int(nk/(nrk*rk))\n\nN,K = map(int,input().split())\nfor i in range(1,K):\n com1 = nCr(N - K + 1, i)\n com2 =... | ['Runtime Error', 'Accepted'] | ['s969109869', 's142537071'] | [3064.0, 3316.0] | [517.0, 1935.0] | [349, 247] |
p02990 | u450956662 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['N, K = map(int, input().split())\nR = N - K\nmod = pow(10, 9) + 7\n\nN += 1\n\nfact = [0] * N\ninv = [0] * N\ninv_cal = [0] * N\n\nfact[:2] = [1, 1]\ninv[1] = 1\ninv_cal[:2] = [1, 1]\n\nfor i in range(2, 2001):\n fact[i] = fact[i-1] * i % mod\n inv[i] = mod - (mod // i) * inv[mod % i] % mod\n inv_cal[i] = in... | ['Runtime Error', 'Accepted'] | ['s912641063', 's616184342'] | [3572.0, 3572.0] | [22.0, 23.0] | [547, 544] |
p02990 | u464244643 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import sys\nsys.setrecursionlimit(10 ** 6)\n\nMOD = 10**9 + 7\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\nclass Combination:\n \n\n def __init__(self, n_max, mod=10**9+7):\n self.mod = mod\n self.modinv = self.make_modinv_list(n_max)\n self.fac, self.facinv = self.make_factor... | ['Runtime Error', 'Accepted'] | ['s453038396', 's858575285'] | [3192.0, 3444.0] | [18.0, 27.0] | [1592, 543] |
p02990 | u467736898 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['class Combination:\n \n def __init__(self, n_max, mod=10**9+7):\n self.mod = mod\n self.modinv = self.make_modinv_list(n_max)\n self.fac, self.facinv = self.make_factorial_list(n_max)\n\n def __call__(self, n, r):\n return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r]... | ['Runtime Error', 'Accepted'] | ['s785661650', 's252066022'] | [3440.0, 3700.0] | [21.0, 23.0] | [1656, 1362] |
p02990 | u476604182 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['import sys\n\n# import sys\n sys.setrecursionlimit(100000)\nnCr = {}\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n\ninf = input().split()\nN = int(inf[0])\nK = int(inf[1])\nM = N-... | ['Runtime Error', 'Accepted'] | ['s413731215', 's246875902'] | [2940.0, 3944.0] | [17.0, 593.0] | [447, 408] |
p02990 | u480200603 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['from math import factorial as f\nn, blue = map(int, input().split())\nred = n - blue\nmod = 10 ** 9 + 7\n\n\ndef p(n, r):\n return f(n) // f(n-r)\n\n\ndef c(n, r):\n return p(n, r) // f(r)\n\n\nfor i in range(1, min(blue + 1, red + 1)):\n space = c(red + 1, i)\n pattern = c(blue - 1, blue - i)\n print(... | ['Wrong Answer', 'Accepted'] | ['s845335726', 's717954644'] | [3188.0, 3316.0] | [211.0, 211.0] | [324, 368] |
p02990 | u484229314 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['from math import factorial\n\nN, K = [int(_) for _ in input().split()]\n# N = 10\nMOD = 10 ** 9 + 7\n\nkaijo = [0] * (N + 1)\nkaijo[0] = kaijo[1] = 1\nfor i in range(2, N + 1):\n kaijo[i] = (kaijo[i - 1] * i) % MOD\n\ngyaku = [0] * (N + 1)\ngyaku[0] = gyaku[1] = 1\n\nfor i in range(2, N + 1):\n \n gyaku[i] =... | ['Wrong Answer', 'Accepted'] | ['s361897045', 's992235419'] | [3444.0, 3444.0] | [213.0, 28.0] | [735, 726] |
p02990 | u486065927 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['def euclid(a,n):\n a0 = a\n a1 = n\n x0 = 1\n x1 = 0\n while (a1!=1):\n q = a0 // a1\n temp = a1\n a1 = a0 - a1*q\n a0 = temp\n temp = x1\n x1 = x0 - q*x1\n x0 = temp\n if (x1 < 0):\n x1 = n + x1\n return x1\n\n\nn, k = map(int, input().spli... | ['Wrong Answer', 'Accepted'] | ['s091400759', 's936207385'] | [3444.0, 3444.0] | [27.0, 27.0] | [586, 589] |
p02990 | u486646943 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ["BIG_NUM = 2000000000\nMOD = 1000000007\nEPS = 0.000000001\n\nN,K = map(int,input().split())\ndp=[[0 for i in range(N)] for j in range(N)]\n\nfor i in range(N):\n dp[i][0] = 1\n dp[i][0] = i\nfor i in range(2,N+1):\n for j in range(1,i):\n# print(dp[i-1][j-1])\n# print(dp[i-1][j])\n dp[i]... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s003981086', 's690746907', 's444865312'] | [356776.0, 3316.0, 3316.0] | [1243.0, 204.0, 203.0] | [553, 673, 674] |
p02990 | u500297289 | 2,000 | 1,048,576 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ['N, K = map(int, input().split())\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nP = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] \n\nfor i in range( 2, P + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n invers... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s708784462', 's810714779', 's329074305'] | [4432.0, 2940.0, 4584.0] | [33.0, 18.0, 31.0] | [671, 2, 657] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.