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
|
---|---|---|---|---|---|---|---|---|---|---|
p03775 | u736729525 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['from math import sqrt, ceil\n\ndef check(n):\n minf = len(str(n))\n square = ceil(sqrt(n)) # 10^5\n print(square)\n for a in range(1, square+1):\n b, r = divmod(n, a)\n if r == 0:\n f = max(len(str(a)), len(str(b)))\n minf = min(f, minf)\n return minf\n\n#print(check(10**10))\nN = int(input())\nprint(check(N))\n', 'from math import sqrt, ceil\n\ndef check(n):\n minf = len(str(n))\n square = ceil(sqrt(n)) # 10^5\n for a in range(1, square+1):\n b, r = divmod(n, a)\n if r == 0:\n f = max(len(str(a)), len(str(b)))\n minf = min(f, minf)\n return minf\n\n#print(check(10**10))\nN = int(input())\nprint(check(N))\n'] | ['Wrong Answer', 'Accepted'] | ['s766527621', 's072728436'] | [3060.0, 3060.0] | [36.0, 35.0] | [348, 330] |
p03775 | u747515887 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ["def main():\n n = int(input())\n\n m = int(n ** 0.5)\n if n < 4:\n m += 1\n\n for i in reversed(range(1, m + 1)):\n if n % i == 0:\n b = n // i\n db = len(str(b))\n di = len(str(i))\n print(abs(db - di))\n break\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n n = int(input())\n\n m = int(n ** 0.5)\n if n < 4:\n m += 1\n\n min_f = len(str(n))\n\n for i in reversed(range(1, m + 1)):\n if n % i == 0:\n b = n // i\n db = len(str(b))\n di = len(str(i))\n f = max(db, di)\n if f < min_f:\n min_f = f\n\n print(min_f)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s596615825', 's990338567'] | [3060.0, 3060.0] | [27.0, 27.0] | [320, 393] |
p03775 | u754022296 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['n = int(input())\nif n < 10:\n print(1)\nelse:\n sqn = int(n**0.5)\n c = float("inf")\n for i in range(1, sqn):\n if n%i == 0:\n d = max(i//10, (n//i)//10)\n c = min(c, d)\n print(c)', 'n = int(input())\nif n < 10:\n print(1)\nelse:\n sqn = int(n**0.5)\n c = float("inf")\n for i in range(1, sqn+1):\n if n%i == 0:\n d = max(len(str(i)), len(str(n//i)))\n c = min(c, d)\n print(c)'] | ['Wrong Answer', 'Accepted'] | ['s365895269', 's770332783'] | [3064.0, 3060.0] | [30.0, 31.0] | [190, 202] |
p03775 | u759412327 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['N = int(input())\nx = int(n**.5)\nwhile N%x:\n x-=1\n\nprint(len(str(N//x)))', 'N = int(input())\nK = int(n**(1/2))\na = len(str(N))\n\nfor i in range(1,k+1):\n if N%i==0:\n a=len(str(n//i))\n\nprint(a)', 'N = int(input())\nx = int(n**.5)\nwhile n%x:\n x-=1\n\nprint(len(str(n//x)))', 'N = int(input())\nn = int(N**0.5)\n\nwhile N%n:\n n-=1\n\nprint(len(str(N//n)))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s104262098', 's208838530', 's386335562', 's956922634'] | [2940.0, 3060.0, 2940.0, 9388.0] | [17.0, 19.0, 17.0, 39.0] | [72, 118, 72, 74] |
p03775 | u779455925 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['N=int(input())\nM=int((N**(1/2)))\n\nprint(min([max([len(str(i)),len(str(int(N/i)))]) for i in range(int(N/2)-M,int(N/2)+M) if N%i==0]))', 'N=int(input())\nM=int((N**(1/2)))\nprint(min([max([len(str(i)),len(str(int(N/i)))]) for i in range(1,M+1) if N%i==0]))\n'] | ['Runtime Error', 'Accepted'] | ['s276150167', 's095503538'] | [3060.0, 2940.0] | [44.0, 28.0] | [133, 117] |
p03775 | u782654209 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\nN=int(input())\nans=10**5\nfor i in range(1, int(math.sqrt(N))+1):\n if int(N/i) != N/i:\n continue\n else:\n j = int(N/i)\n ans = min(ans, len(str(i)), len(str(j)))\nprint(ans)', 'import math\nN=int(input())\nans=10**5\nfor i in range(1, int(math.sqrt(N))+1):\n if int(N/i) != N/i:\n continue\n else:\n j = int(N/i)\n ans = min(ans, max(len(str(i)), len(str(j))))\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s579167740', 's356787844'] | [3060.0, 3060.0] | [55.0, 59.0] | [208, 214] |
p03775 | u785578220 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['b = input()\na =int(b)\nm = len(b)\nfor i in reversed(range(1,int(math.sqrt(a))+1)):\n if a/i == int(a/i):\n m = max(len(str(a//i)),len(str(i)))\n break\nprint(m)', 'n = int(input())\n\ndef cal(a):\n return len(str(a))\nm = 11\nfor j in range(1,10**5+1):\n if n%j==0:\n m = min(m,max(cal(j),cal(n//j)))\n # print(m)\nprint(m)'] | ['Runtime Error', 'Accepted'] | ['s739497645', 's994550419'] | [3060.0, 9080.0] | [18.0, 42.0] | [172, 158] |
p03775 | u787449825 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['def f(x):\n count_x = 1\n while x/10>=1:\n x = x//10\n count_x += 1\n return count_x\n\npf = {}\nm = int(input())\nroot_m = int(m**0.5)\nfor i in range(2,root_m+1):\n while m%i == 0:\n pf[i] = pf.get(i,0) + 1\n m//=i\nif m>1:pf[m]=1\n\nif m == 1:\n print(f(1))\nelif root_m<max(pf.keys()):\n print(f(max(pf.keys())))\nelse:\n print(f(root_m))', 'def f(x,y):\n count_x, count_y = 1, 1\n while x/10>=1:\n x = x//10\n count_x += 1\n while y/10>=1:\n y = y//10\n count_y += 1\n return max(count_x, count_y)\n\npf = []\nm = int(input())\n\nfor i in range(1,int(m**0.5)+1):\n if m%i == 0:\n pf.append(i)\n\nprint(f(pf[-1], m/pf[-1]))'] | ['Wrong Answer', 'Accepted'] | ['s757431631', 's452019016'] | [3064.0, 3060.0] | [31.0, 30.0] | [368, 314] |
p03775 | u796708718 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['N = int(input())\n\nmin = 10\n\nfor n in range(1,int(N**(1/2))+1):\n if min > max(len("{}".format(n)),len("{}".format(N/n))) and N%n == 0:\n \tmin = max(len("{}".format(n)),len("{}".format(int(N/n))))\n \nprint(min)\n ', 'N = int(input())\n\nF = 1\nF_min = 10**10\n\nfor A in range(1,int((N+1)**(1/2))+1):\n if N%A == 0:\n F = max(len(str(A)),len(str(int(N/A))))\n if F_min > F:\n F_min = F\n \nprint(F_min)\n'] | ['Wrong Answer', 'Accepted'] | ['s882959552', 's671768843'] | [3060.0, 3060.0] | [217.0, 30.0] | [214, 198] |
p03775 | u798093965 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['n = int(input())\n\ndef primefact(n):\n x = 0\n table = []\n for i in range(2, int(n ** 0.5) + 1):\n while n % i == 0:\n n //= i\n x += 1\n \n if x != 0:\n table.append([i, x])\n x = 0\n\n if n != 1:\n table.append([n, 1])\n \n return table\n"""\n if len(table) == 0:\n table.append([n, 1])\n"""\n \nbunkai = primefact(n)\n\na = 1\nb = 1\nbunkai = list(reversed(bunkai))\n\nfor i in range(len(bunkai)):\n while bunkai[i][1] != 0:\n if a < b:\n a *= bunkai[i][0]\n else:\n b *= bunkai[i][0]\n bunkai[i][1] -= 1\n \na = int(a)\nb = int(b)\nc = max(a, b)\nprint(len(str(c))-1)\n \n \n \n', 'n = int(input())\na = 1\nb = n\nfor i in range(1, int(n ** 0.5) + 1):\n if n % i == 0:\n a = i\n b = n // i\n \n\nc = max(a, b)\nprint(len(str(c))) \n'] | ['Wrong Answer', 'Accepted'] | ['s322899159', 's412021170'] | [3064.0, 3060.0] | [30.0, 29.0] | [721, 164] |
p03775 | u806855121 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['N = int(input())\nans = N\nfor i in range(1, N):\n if N*i > N:\n break\n d = 0\n if N % i == 0:\n d = max(len(str(i)), len(str(N//i)))\n ans = min(ans, d)\nprint(ans)', 'N = int(input())\nans = N\nfor i in range(1, N):\n if i**2 > N:\n break\n d = 0\n if N % i == 0:\n d = max(len(str(i)), len(str(N//i)))\n ans = min(ans, d)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s617412539', 's797116030'] | [3060.0, 3060.0] | [18.0, 63.0] | [187, 188] |
p03775 | u807021746 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\n\nN = int(input())\nI = int(math.sqrt(N) // 1)\nprint(I)\n\na = []\nfor i in range(1, I):\n if N%i==0:\n j=N//i\n k = len(list(str(i)))\n l = len(list(str(j)))\n m = max(k, l)\n a.append(m)\nprint(min(a))', 'import math\n\nN = int(input())\nI = int(math.sqrt(N) // 1)\nprint(I)\n\na = []\nfor i in range(1, I):\n if N%i==0:\n j=N//i\n k = len(str(i))\n l = len(str(j))\n m = max(k, l)\n a.append(int(m))\nprint(min(a))', 'N = int(input())\nI = int(N**(0.5)//1)\na = []\nfor i in range(1, I+1):\n if N%i==0:\n j=N//i\n i = len(list(str(i)))\n j = len(list(str(j)))\n k = max(i, j)\n a.append(k)\nprint(min(a))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s421733979', 's954021266', 's537384652'] | [9124.0, 9108.0, 9368.0] | [42.0, 42.0, 43.0] | [219, 212, 192] |
p03775 | u807028974 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\n\ndef F(A,B):\n if A > B:\n return len(str(A))\n else:\n return len(str(B))\n \n\nN = int(input())\nmin = F(1,N)\nrt = int(math.sqrt(N))\nfor i in range(2,rt+1):\n if N % i != 0:\n continue\n f = F(i,int(N/i))\n if f < min:\n min = f\n break\nprint(min)', 'import math\n\ndef F(A,B):\n if A > B:\n return len(str(A))\n else:\n return len(str(B))\n \n\nN = int(input())\nmin = F(1,N)\nrt = int(math.sqrt(N))\nfor i in range(2,rt):\n if N % i != 0:\n continue\n f = F(i,int(N/i))\n if f < min:\n min = f\n break\nprint(min)', 'import math\n\ndef F(A,B):\n if A > B:\n return len(str(A))\n else:\n return len(str(B))\n \n\nN = int(input())\nmin = F(1,N)\nrt = int(math.sqrt(N))\nfor i in range(2,rt+1):\n if N % i != 0:\n continue\n f = F(i,int(N/i))\n if f < min:\n min = f\nprint(min)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s121770414', 's915701445', 's694656993'] | [3064.0, 3064.0, 3064.0] | [29.0, 30.0, 30.0] | [308, 306, 294] |
p03775 | u811000506 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n \n return divisors\n\nN = int(input())\nlist = make_divisors(N)\nans = 10**9\nfor i in range(0,len(list),2):\n tmp1 = len(str(list[i]))\n tmp2 = len(str(list[i+1]))\n ans = min(ans,max(tmp1,tmp2))\nprint(ans)\n', 'def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n \n return divisors\n\nN = int(input())\nlist = make_divisors(N)\nans = 10**9\nif len(list)%2==1:\n list.append(list[-1])\nfor i in range(0,len(list),2):\n tmp1 = len(str(list[i]))\n tmp2 = len(str(list[i+1]))\n ans = min(ans,max(tmp1,tmp2))\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s828522803', 's450046088'] | [3064.0, 3064.0] | [28.0, 27.0] | [425, 475] |
p03775 | u816645498 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['#include<bits/stdc++.h>\nusing namespace std;\nusing ll = long long;\n\nint main()\n{\n ll N;\n cin >> N;\n int res = 30;\n for(ll i = 1; i*i <= N; ++i) {\n if(N%i) continue;\n ll j = N/i;\n int cnt = 0;\n while(j > 0) ++cnt, j /= 10;\n res = min(res, cnt);\n }\n cout << res << endl;\n return 0;\n}', "import sys\ninput = sys.stdin.readline\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n return divisors\n\ndef main():\n N = int(input())\n a = make_divisors(N)\n a.sort()\n ans = 10\n for i in a:\n ans = min(ans, len(str(max(i, N/i))))\n \n print(ans)\n\nif __name__ == '__main__':\n main()"] | ['Runtime Error', 'Accepted'] | ['s074093360', 's787644694'] | [2940.0, 3188.0] | [17.0, 27.0] | [337, 464] |
p03775 | u823585596 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\nN=int(input())\nans=len(str(N))\nfor a in range(2,math.sqrt(N)+1):\n if N%a==0:\n b=N//a\n ans=min(ans,len(str(b)))\nprint(ans)', 'import math\nN=int(input())\nans=len(str(N))\nfor a in range(2,math.sqrt(N**0.5)+1):\n if N%a==0:\n b=N//a\n ans=min(ans,len(str(b)))\nprint(ans)', 'N=int(input())\nans=len(str(N))\nfor a in range(2,int(N**0.5)+1):\n if N%a==0:\n b=N//a\n ans=min(ans,len(str(b)))\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s473374398', 's747123595', 's767736690'] | [9172.0, 9436.0, 9392.0] | [23.0, 25.0, 42.0] | [150, 155, 137] |
p03775 | u830054172 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['n = int(input())\nhalf = min(n//10**(len(str(n))//2),n%10**(len(str(n))//2))\n\nans = []\nfor i in range(half, 0, -1):\n if n%i==0:\n ans.append(max(len(str(i)), len(str(n//i))))\nprint(half)', 'n = int(input())\nhalf = min(n//10**(len(str(n))//2),n%10**(len(str(n))//2))\n\nans = []\nfor i in range(half+10, 0, -1):\n if n%i==0:\n ans.append(max(len(str(i)), len(str(n//i))))\nprint(min(ans))', 'import fractions\nn = int(input())\nhalf = int(fractions.sqrt(n))\n\nans = []\nfor i in range(half, 0, -1):\n if n%i==0:\n ans.append(max(len(str(i)), len(str(n//i))))\nprint(min(ans))', 'n = int(input())\nhalf = min(n//10**(len(str(n))//2),n%10**(len(str(n))//2))\n\nans = []\nfor i in range(half, 0, -1):\n if n%i==0:\n ans.append(max(len(str(i)), len(str(n//i))))\nprint(min(ans))', 'n = int(input())\nhalf = min(n//10**(len(str(n))//2),n%10**(len(str(n))//2))\n\nans = []\nfor i in range(half, 0, -1):\n if n%i==0:\n ans.append(max(len(str(i)), len(str(n//i))))\nprint(min(ans))', 'import math\nn = int(input())\nhalf = int(math.sqrt(n))\n\nans = []\nfor i in range(half, 0, -1):\n if n%i==0:\n ans.append(max(len(str(i)), len(str(n//i))))\nprint(min(ans))'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s191486804', 's344633343', 's456013100', 's520611885', 's746922948', 's171593528'] | [3060.0, 3064.0, 5048.0, 3060.0, 3060.0, 3060.0] | [30.0, 31.0, 36.0, 29.0, 30.0, 30.0] | [194, 201, 186, 198, 198, 176] |
p03775 | u841623074 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['N=int(input())\nn=len(str(N))\nm=(n//2)+1\ndef wari(x):\n array=[]\n if m==0:\n for j in range(9,0,-1):\n if N%j==0:\n c=max(len(str(N//j)),len(str(j)))\n array.append(c)\n break\n \n for i in range(m+1):\n if i==0:\n for j in range(9,0,-1):\n if N%j==0:\n c=max(len(str(N//j)),len(str(j)))\n array.append(c)\n break\n else:\n for j in range((10**(m+1))-1,(10**m)-1,-1):\n if N%j==0:\n c=max(len(str(N//j)),len(str(j)))\n array.append(c)\n break\n return min(array)\nprint(wari(N))\n ', 'N=int(input())\nn=len(str(N))\nm=(n//2)\ndef wari(x):\n array=[]\n if m==0:\n for j in range(9,0,-1):\n if N%j==0:\n c=max(len(str(N//j)),len(str(j)))\n array.append(c)\n break\n \n for i in range(m+1):\n if i==0:\n for j in range(9,0,-1):\n if N%j==0:\n c=max(len(str(N//j)),len(str(j)))\n array.append(c)\n break\n else:\n for j in range((10**(i+1))-1,(10**i)-1,-1):\n if N%j==0:\n c=max(len(str(N//j)),len(str(j)))\n array.append(c)\n break\n return min(array)\nprint(wari(N))'] | ['Wrong Answer', 'Accepted'] | ['s691085526', 's562336269'] | [3064.0, 3064.0] | [2104.0, 122.0] | [726, 715] |
p03775 | u844005364 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['def divisible_length(n):\n min_length = len(str(n))\n for i in range(1, int(n ** 0.5) + 1):\n if n % i == 0:\n min_length = min(min_length, len(str(i)))\n if i != n // i:\n min_length = min(min_length, len(str(n // i)))\n return min_length\n\nn = int(input())\nprint(divisible_length(n))', 'def divisible_length(n):\n\tmin_length = len(str(n))\n \tfor i in range(1, int(n ** 0.5) + 1):\n if n % i == 0:\n min_length = min(min_length, len(str(i)))\n if i != n // i:\n\t min_length = min(min_length, len(str(n // i)))\n return min_length\n\n\nn = int(input())\nprint(divisible_length(n))', 'def divisible_length(n):\n min_length = len(str(n))\n for i in range(1, int(n ** 0.5) + 1):\n if n % i == 0:\n min_length = min(min_length, max(len(str(i)), len(str(n // i))))\n return min_length\n\nn = int(input())\nprint(divisible_length(n))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s160818563', 's292532325', 's171208923'] | [3060.0, 2940.0, 3188.0] | [27.0, 17.0, 29.0] | [330, 324, 262] |
p03775 | u845620905 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['n = int(input())\na = 0\nt = 0\nfor i in range(1, n+1):\n a = n / i\n if(n % i == 0):\n t = i\n if(a <= i):\n break\n\nb = max(int(n / t), t)\nans = 0\nwhile(b > 1):\n ans += 1\n b /= 10\nprint(ans)\n\n', 'n = int(input())\na = 0\nt = 0\nfor i in range(1, n+1):\n a = n / i\n if(n % i == 0):\n t = i\n if(a <= i):\n break\n\nb = max(int(n / t), t)\nans = 0\nwhile(b >= 1):\n ans += 1\n b /= 10\nprint(ans)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s628522897', 's142691562'] | [3060.0, 3060.0] | [51.0, 52.0] | [214, 215] |
p03775 | u846150137 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\nn=int(input())\nx=math.floor(n)\n\nwhile 1:\n if n % x ==0:\n break\n x-=1\n\nprint(max(len(str(int(n/x))),len(str(x))))', 'import math\nn=int(input())\nx=math.floor(n**0.5)\n\nwhile 1:\n if n % x ==0:\n break\n x-=1\n\nprint(max(len(str(int(n/x))),len(str(x))))'] | ['Wrong Answer', 'Accepted'] | ['s833931635', 's987177712'] | [3060.0, 3060.0] | [17.0, 36.0] | [129, 134] |
p03775 | u855831834 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import itertools\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\nn = int(input())\n\nf = factorization(n)\n\nprint(f)\n\nif len(f) == 1:\n print(len(str(n)))\nelse:\n pf = []\n for r in f:\n pf += [r[0]]*r[1]\n ans = len(str(n))\n for i in range(1,len(pf)//2+2):\n for c in itertools.combinations(pf, i):\n tmp = 1\n for t in c:\n tmp *= t\n ans = min(ans, max(len(str(tmp)), len(str(n//tmp))))\n print(ans)', 'import itertools\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\nn = int(input())\n\nf = factorization(n)\n\n#print(f)\n\nif len(f) == 1 and f[0][1] == 1:\n print(len(str(n)))\nelse:\n pf = []\n for r in f:\n if r[0] == 1:\n continue\n pf += [r[0]]*r[1]\n ans = len(str(n))\n for i in range(1,len(pf)//2+1):\n for c in itertools.combinations(pf, i):\n #print(c)\n tmp = 1\n for t in c:\n tmp *= t\n ans = min(ans, max(len(str(tmp)), len(str(n//tmp))))\n print(ans)'] | ['Wrong Answer', 'Accepted'] | ['s891711425', 's171478210'] | [9012.0, 9028.0] | [1183.0, 922.0] | [774, 857] |
p03775 | u857673087 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\n\nN = int(input())\nend = int(math.sqrt(N))+1\nans = len(str(N))\n\nfor a in range(1,end):\n if N%a == 0:\n b = N//a\n ans = min(ans, len(str(max(a,b)))\nprint(ans)\n', 'import math\n\nN = int(input())\nend = int(math.sqrt(N))+1\nans = len(str(N))\n\nfor a in range(1,end):\n if N%a == 0:\n b = N//i\n ans = min(ans, len(str(max(a,b)))\nprint(ans)\n', 'N = int(input())\n\nimport math\n\nend = int(math.sqrt(N))+1\nans = len(str(N))\n\nfor a in range(1,end):\n if N % a ==0:\n b = N//a\n ans = min(ans, len(str(max(a,b))))\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s430027388', 's870451394', 's076155507'] | [2940.0, 2940.0, 3060.0] | [17.0, 17.0, 30.0] | [175, 175, 177] |
p03775 | u871303155 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['\n\n# O(root:N)\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\nimport math\nN=int(input())\n\n\nans = 0\npairs = factorization(N)\nketa = lambda x: len(str(x))\nfor a,b in pairs:\n ans = max(keta(a), keta(b))\n\nprint(ans)\n\n# root_n = int(math.sqrt(N))\n# up_n = root_n\n\n\n# while up_n <= N:\n# if N % up_n == 0:\n\n\n \n# break\n# else:\n# up_n+=1\n\n# print(up_ans)\n\n', 'import math\nN=int(input())\n\n\nroot_n = int(math.sqrt(N))\nup_n = root_n\nup_ans = 0\nketa = lambda x: len(str(x))\nwhile up_n <= N:\n if N % up_n == 0:\n pair = int(N/up_n)\n \n up_ans = max(keta(pair), keta(up_n))\n break\n else:\n up_n-=1\n\nprint(up_ans)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s948868482', 's164902712'] | [3188.0, 3060.0] | [28.0, 38.0] | [889, 344] |
p03775 | u888337853 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\nimport copy\nfrom copy import deepcopy\nimport sys\nimport fractions\n# import numpy as np\nfrom functools import reduce\n# import statistics\nimport decimal\nimport heapq\nimport collections\nimport itertools\nfrom operator import mul\n\nsys.setrecursionlimit(100001)\n\n\n# input = sys.stdin.readline\n\n\n# ===FUNCTION===\n\ndef getInputInt():\n inputNum = int(input())\n return inputNum\n\n\ndef getInputListInt():\n outputData = []\n inputData = input().split()\n outputData = [int(n) for n in inputData]\n\n return outputData\n\n\ndef getSomeInputInt(n):\n outputDataList = []\n for i in range(n):\n inputData = int(input())\n outputDataList.append(inputData)\n\n return outputDataList\n\n\ndef getSomeInputListInt(n):\n inputDataList = []\n outputDataList = []\n for i in range(n):\n inputData = input().split()\n inputDataList = [int(n) for n in inputData]\n outputDataList.append(inputDataList)\n\n return outputDataList\n\n\n# ===CODE===\n\nn = int(input())\n\nans = sys.maxsize\nfor i in range(1, math.sqrt(n)+1, 1):\n if n % i == 0:\n b = n//i\n tmp_ans = max(len(str(i)), len(str(b)))\n ans = min(ans, tmp_ans)\n\nprint(ans)\n\n', 'import math\nimport copy\nfrom copy import deepcopy\nimport sys\nimport fractions\n# import numpy as np\nfrom functools import reduce\n# import statistics\nimport decimal\nimport heapq\nimport collections\nimport itertools\nfrom operator import mul\n\nsys.setrecursionlimit(100001)\n\n\n# input = sys.stdin.readline\n\n\n# ===FUNCTION===\n\ndef getInputInt():\n inputNum = int(input())\n return inputNum\n\n\ndef getInputListInt():\n outputData = []\n inputData = input().split()\n outputData = [int(n) for n in inputData]\n\n return outputData\n\n\ndef getSomeInputInt(n):\n outputDataList = []\n for i in range(n):\n inputData = int(input())\n outputDataList.append(inputData)\n\n return outputDataList\n\n\ndef getSomeInputListInt(n):\n inputDataList = []\n outputDataList = []\n for i in range(n):\n inputData = input().split()\n inputDataList = [int(n) for n in inputData]\n outputDataList.append(inputDataList)\n\n return outputDataList\n\n\n# ===CODE===\n\nn = int(input())\n\nans = sys.maxsize\nfor i in range(1, int(math.sqrt(n))+1, 1):\n if n % i == 0:\n b = n//i\n tmp_ans = max(len(str(i)), len(str(b)))\n ans = min(ans, tmp_ans)\n\nprint(ans)\n\n'] | ['Runtime Error', 'Accepted'] | ['s266349342', 's507567240'] | [5164.0, 5164.0] | [36.0, 49.0] | [1214, 1219] |
p03775 | u896741788 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['n=int(input())\nm=n**(1/2)//1+1\nl=[]\nfor i in range(m+1)[:0:-1]:\n if n%i==0:\n l.append(max(len(str(i)),len(str(n//i))))\n if len(l)==3:\n break\nprint(min(l))', 'from math imoprt sqrt\nn=int(input())\nfor i in range(int(sqrt(n)),0,-1):\n if n%i==0:\n print(max(len(str(i)),len(str(n//i))))\n exit()', 'from math import sqrt\nn=int(input())\nfor i in range(int(sqrt(n)),0,-1):\n if n%i==0:\n print(max(len(str(i)),len(str(n//i))))\n exit()\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s033784587', 's344743803', 's800426202'] | [3060.0, 2940.0, 2940.0] | [17.0, 17.0, 29.0] | [162, 138, 139] |
p03775 | u897329068 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\n\nN = int(input())\n\nanss = []\nfor n in range(1,math.ceil(N**0.5)):\n\tif N % n == 0:\n\t\tanss.append(max(len(str(n)),len(str(N//n))))\nelse:\n\tanss.append(1)\n\t\t\nprint(min(anss))', 'import math\n\nN = int(input())\n\nanss = []\nfor n in range(1,math.ceil(N**0.5)+1):\n\tif N % n == 0:\n\t\tanss.append(max(len(str(n)),len(str(N//n))))\n\nif len(anss) == 0:\n\tanss.append(1)\n\t\t\nprint(min(anss))'] | ['Wrong Answer', 'Accepted'] | ['s315470371', 's285928036'] | [3060.0, 3060.0] | [31.0, 31.0] | [182, 198] |
p03775 | u898336293 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | [' divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n return divisors\n \nN=int(input()) \ndiv = make_divisors(N)\n\nA = div[-1]\nB = N//A\nprint(max(len(str(A)),len(str(B))))', 'def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n return divisors\n \nN=int(input()) \ndiv = make_divisors(N)\n\nA = div[-1]\nB = N//A\nprint(max(len(str(A)),len(str(B))))'] | ['Runtime Error', 'Accepted'] | ['s064367989', 's558281207'] | [2940.0, 3188.0] | [17.0, 27.0] | [228, 250] |
p03775 | u905582793 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['n=int(input())\nans = []\nfor i in range(1,int(n**0.5+1)):\n if n%i==0:\n j=n//i\n ans.append(len(str(i))+len(str(j)))\nprint(max(ans))', 'n=int(input())\nans = []\nfor i in range(1,int(n**0.5+1)):\n if n%i==0:\n j=n//i\n ans.append(min(len(str(i)),len(str(j))))\nprint(min(ans))', 'n=int(input())\nans = []\nfor i in range(1,int(n**0.5+1)):\n if n%i==0:\n j=n//i\n ans.append(len(str(i))+len(str(j)))\nprint(min(ans))', 'n=int(input())\nans = []\nfor i in range(1,n**0.5+1):\n if n%i==0:\n j=n//i\n ans.append(len(str(i))+len(str(j)))\nprint(max(ans))', 'n=int(input())\nans = []\nfor i in range(1,int(n**0.5+1)):\n if n%i==0:\n j=n//i\n ans.append(max(len(str(i)),len(str(j))))\nprint(min(ans))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s000023244', 's009977082', 's121590879', 's765953726', 's544342735'] | [3060.0, 3060.0, 3060.0, 3060.0, 3060.0] | [30.0, 30.0, 30.0, 17.0, 30.0] | [136, 141, 136, 131, 141] |
p03775 | u919025034 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\nN = int(input())\nc = math.sqrt(N) // 1\nwhile 1:\n if N % c == 0:\n A = int(c)\n B = int(N / c)\n break\n c -= 1\nprint(A,B)\nprint(max(len(str(A)),len(str(B)) ))\n', 'import math\nN = int(input())\nc = math.sqrt(N) // 1\nwhile 1:\n if N % c == 0:\n A = int(c)\n B = int(N / c)\n break\n c -= 1\nprint(max(len(str(A)),len(str(B)) ))\n'] | ['Wrong Answer', 'Accepted'] | ['s401484034', 's785098311'] | [3060.0, 2940.0] | [49.0, 45.0] | [178, 167] |
p03775 | u925364229 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['from math import sqrt\nN = int(input())\n\ndiv = 1\nmax_v = int(sqrt(N))\nfor num in range(max_v,1,(-1)):\n\tif N % num == 0:\n\t\tdiv = num\n\t\tbreak\n\nprint(div)\nprint(max(len(str(div)),len(str(N//div))))', 'from math import sqrt\nN = int(input())\n\ndiv = 1\nmax_v = int(sqrt(N))\nfor num in range(max_v,1,(-1)):\n\tif N % num == 0:\n\t\tdiv = num\n\t\tbreak\n\n#print(div)\nprint(max(len(str(div)),len(str(N//div))))'] | ['Wrong Answer', 'Accepted'] | ['s489236390', 's703550380'] | [3060.0, 3060.0] | [30.0, 30.0] | [193, 194] |
p03775 | u928385607 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['n = int(input())\n\nab = []\nans = [1]\nfor i in range(1, int(n**(0.5))):\n\tab.clear()\n\tif n%i == 0:\n\t\tab.append(i)\n\t\tab.append(int(n/i))\n\t\tans.append(len(str(max(ab))))\n\t\t\t\nprint(min(ans))\n', 'n = int(input())\n\nab = []\nans = []\nfor i in range(1, int(n**(0.5))+1):\n\tab.clear()\n\tif n%i == 0:\n\t\tab.append(i)\n\t\tab.append(int(n/i))\n\t\tans.append(len(str(max(ab))))\n\t\t\t\nif len(ans) == 0:\n\tans.append(1)\n\nprint(min(ans))\n'] | ['Wrong Answer', 'Accepted'] | ['s859627543', 's825467962'] | [2940.0, 3188.0] | [35.0, 35.0] | [185, 220] |
p03775 | u934052933 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['\n\ndef findBiggerDigits(n):\n digits = 0\n while n > 0:\n digits += 1\n n //= 10\n return digits \n\ndef main()->None:\n n = int(input())\n sqrt_n = int(n ** (1/2))\n print(sqrt_n)\n range_a = range(1, sqrt_n+1)\n\n min_value = 1000000\n for a in range_a:\n if n % a != 0: continue\n b = n / a\n a_digits = findBiggerDigits(a)\n b_digits = findBiggerDigits(b)\n max_dig = max(a_digits, b_digits)\n if max_dig < min_value:\n min_value = max_dig\n\n print(min_value)\n\n\nif __name__ == "__main__":\n main()', '\n\ndef findBiggerDigits(n):\n digits = 0\n while n > 0:\n digits += 1\n n //= 10\n return digits \n\ndef main()->None:\n n = int(input())\n sqrt_n = int(n ** (1/2))\n range_a = range(1, sqrt_n+1)\n\n min_value = 1000000\n for a in range_a:\n if n % a != 0: continue\n b = n / a\n a_digits = findBiggerDigits(a)\n b_digits = findBiggerDigits(b)\n max_dig = max(a_digits, b_digits)\n if max_dig < min_value:\n min_value = max_dig\n\n print(min_value)\n\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s445980457', 's584843295'] | [3188.0, 3064.0] | [28.0, 28.0] | [577, 559] |
p03775 | u937782958 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ["N = int(input())\n\ndef check(a, b):\n return max(len(str(a)), len(str(b)))\n\nn = int(N ** (1/2))\n#arr =[]\nres = check(1, N)\nprint('first-res',res,n)\ni = 1\nwhile i <= n:\n if N % i == 0:\n res = min(res, check(i,int(N / i)))\n# print(res, i, N/i)\n i += 1\n\nprint(res)", 'N = int(input()) \nn = int(N**.5)\nres = len(str(N))\nprint(n)\nfor i in range(2,n+1):\n if N % i == 0:\n #print(len(str(i)),len(str(N/i)))\n f = max(len(str(i)),len(str(N//i)))\n res = min(res, f)\n\nprint(res)\n', 'N = int(input()) \nn = int(N**.5)\nres = len(str(N))\nfor i in range(2,n+1):\n if N % i == 0:\n #print(len(str(i)),len(str(N/i)))\n f = max(len(str(i)),len(str(N//i)))\n res = min(res, f)\n\nprint(res)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s171259584', 's704180459', 's903178382'] | [3188.0, 3060.0, 2940.0] | [42.0, 30.0, 30.0] | [270, 277, 268] |
p03775 | u940652437 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['n = int(input())\ntmp = n\nans = n\ny = tmp **0.5\no = int(y // 1)\nfor i in range(o+1):\n a=i+1\n print("a:"+str(a))\n b=n/(i+1)\n print("b:"+str(b))\n #print("a*b:"+str(a*b))\n if (b.is_integer()==True ):\n kari = max(len(str(a)),len(str(int(b))))\n print("kari:"+str(kari))\n ans = min(ans,kari)\nprint(ans)', 'n = int(input())\ntmp = n\nans = n\ny = tmp **0.5\no = int(y // 1)\nfor i in range(o+1):\n a=i+1\n #print("a:"+str(a))\n b=n/(i+1)\n #print("b:"+str(b))\n #print("a*b:"+str(a*b))\n if (b.is_integer()==True ):\n kari = max(len(str(a)),len(str(int(b))))\n #print("kari:"+str(kari))\n ans = min(ans,kari)\nprint(ans)\n '] | ['Wrong Answer', 'Accepted'] | ['s706765825', 's147128746'] | [9480.0, 9344.0] | [192.0, 51.0] | [334, 353] |
p03775 | u944731949 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import sympy\nN = int(input())\ndiv_arr = sympy.divisors(N)\n\nif len(div_arr) == 1:\n print(1)\nif len(div_arr) == 2:\n ans_num = max(div_arr)\nelse:\n memo = []\n if len(div_arr) % 2 == 0:\n last_idx = -1\n count = 0\n for i in range(len(div_arr)):\n print(div_arr)\n print(div_arr[i] * div_arr[last_idx])\n count += 1\n if N == div_arr[i] * div_arr[last_idx] and count != len(div_arr) // 2:\n last_idx -= 1\n memo.append(len(str(div_arr[last_idx])))\n else:\n break\n else:\n print(div_arr)\n target_index = len(div_arr) // 2\n memo.append(len(str(div_arr[target_index])))\n print(min(memo))', 'import sympy\nN = int(input())\ndiv_arr = sympy.divisors(N)\n\nif len(div_arr) == 1:\n print(1)\nif len(div_arr) == 2:\n ans_num = max(div_arr)\n print(len(str(ans_num)))\nelse:\n memo = []\n if len(div_arr) % 2 == 0:\n last_idx = -1\n count = 0\n for i in range(len(div_arr)):\n print(div_arr)\n print(div_arr[i] * div_arr[last_idx])\n count += 1\n if N == div_arr[i] * div_arr[last_idx] and count != len(div_arr) // 2:\n last_idx -= 1\n memo.append(len(str(div_arr[last_idx])))\n else:\n break\n else:\n print(div_arr)\n target_index = len(div_arr) // 2\n memo.append(len(str(div_arr[target_index])))\n print(min(memo))', 'N = int(input())\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n divisors.sort()\n return divisors\ndiv_arr = make_divisors(N)\n\nif len(div_arr) == 1:\n print(1)\nelif len(div_arr) == 2:\n ans_num = max(div_arr)\n print(len(str(ans_num)))\nelse:\n memo = []\n if len(div_arr) % 2 == 0:\n last_idx = -1\n count = 0\n for i in range(len(div_arr)):\n count += 1\n if N == div_arr[i] * div_arr[last_idx] and count != len(div_arr) // 2:\n last_idx -= 1\n memo.append(len(str(div_arr[last_idx])))\n else:\n break\n else:\n target_index = len(div_arr) // 2\n memo.append(len(str(div_arr[target_index])))\n print(min(memo))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s190504970', 's652785575', 's740213768'] | [9116.0, 9180.0, 9356.0] | [28.0, 30.0, 39.0] | [728, 757, 884] |
p03775 | u974792613 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['def f(a,b):\n digit_a = digit_b=0\n \n while a:\n digit_a+=1\n a//=10\n \n while b:\n digit_b+=1\n b//=10\n \n return max(digit_a, digit_b)\n\nn = int(input())\n\nans = n\nfor i in range(1, int((n+1)**0.5)):\n for n%i==0:\n n = min(n, f(i, n//i))\n \nprint(ans)\n ', 'def f(a, b):\n digit_a = digit_b = 0\n\n while a:\n digit_a += 1\n a //= 10\n\n while b:\n digit_b += 1\n b //= 10\n\n return max(digit_a, digit_b)\n\n\nn = int(input())\n\nans = n\n\nfor i in range(1, int(n ** 0.5) + 1):\n if n % i == 0:\n ans = min(ans, f(i, n // i))\n\nprint(ans)\n\n'] | ['Runtime Error', 'Accepted'] | ['s588937566', 's930706198'] | [2940.0, 3188.0] | [17.0, 31.0] | [276, 313] |
p03775 | u989345508 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\nn=int(input())\nl=math.floor(math.sqrt(n))\n\nfor i in range(l,1,-1):\n if n%i==0:\n a,b=i,n//i\n x=max(math.floor(math.log10(a))+1,math.floor(math.log10(b))+1)\n break\nprint(k)\n', 'from sys import exit\nimport math\nn=int(input())\nl=math.floor(math.sqrt(n))\n\nfor i in range(l+1,0,-1):\n if n%i==0:\n a,b=i,n//i\n h=max(a,b)\n k=math.floor(math.log10(h))+1\n print(k)\n exit()\n'] | ['Runtime Error', 'Accepted'] | ['s707430777', 's168655940'] | [3060.0, 3060.0] | [30.0, 29.0] | [207, 225] |
p03775 | u989654188 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\n\nn = int(input())\n\ndef f(a,b):\n return len(str(a)) if len(str(a)) > len(str(b)) else len(str(b))\n\nmin = 10\n\nfor i in range(1,int(math.sqrt(n))):\n if n%i==0 and min > f(i,n//i):\n min = f(i,n//i)\n\nif len(str(n))<10:\n min=1\n\nprint(min)', 'import math\n\nn = int(input())\n\ndef f(a,b):\n return len(str(a)) if len(str(a)) > len(str(b)) else len(str(b))\n\nmin = 10\n\nfor i in range(1,int(math.sqrt(n))+1):\n if n%i==0 and min > f(i,n//i):\n min = f(i,n//i)\n\nif n<10:\n min=1\n\nprint(min)'] | ['Wrong Answer', 'Accepted'] | ['s651671374', 's330820210'] | [3064.0, 3064.0] | [30.0, 30.0] | [260, 252] |
p03775 | u990896548 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ["import math\n\nif __name__ == '__main__':\n N = int(input())\n root_N_int = math.floor(math.sqrt(N))\n for A in range(root_N_int, 0, -1):\n if N % A == 0:\n B = int(N / A)\n print(B)\n break\n digit = len(str(B))\n print(digit)", "import math\n\nif __name__ == '__main__':\n N = int(input())\n root_N_int = math.floor(math.sqrt(N))\n for A in range(root_N_int, 0, -1):\n if N % A == 0:\n B = int(N / A)\n break\n digit = len(str(B))\n print(digit)"] | ['Wrong Answer', 'Accepted'] | ['s778897861', 's241641037'] | [3060.0, 3316.0] | [30.0, 30.0] | [271, 250] |
p03775 | u996996256 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ["n = int(input())\nans = float('inf')\ntemp = 0\nfor i in range(1,(n/2)+1):\n if n%i == 0:\n temp = max(len(str(i)), len(str(n//i)))\n ans = min(temp, ans)\nprint(ans)", "n = int(input())\nans = float('inf')\ntemp = 0\nfor i in range(1,n/2+1):\n if n%i == 0:\n temp = max(len(str(i)), len(str(n//i)))\n ans = min(temp, ans)\nprint(ans)", "n = int(input())\nans = float('inf')\ntemp = 0\nfor i in range(1,n**(1/2)):\n if n%i == 0:\n temp = max(i, n//i)\n ans = min(temp, ans)\nprint(len(str(ans)))", "n = int(input())\nans = float('inf')\ntemp = 0\nfor i in range(1,int(n**(1/2))+1):\n if n%i == 0:\n temp = max(i, n//i)\n ans = min(temp, ans)\nprint(len(str(ans)))"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s169573555', 's341681771', 's657209835', 's479480667'] | [3060.0, 3060.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0, 31.0] | [176, 174, 167, 174] |
p03775 | u998262711 | 2,000 | 262,144 | You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B. | ['import math\nN=int(input())\na=0\nfor i in range(1,1+math.ceil(math.sqrt(N))):\n if N%i==0 and i>a:\n a=i\nb=int(N/a)\nprint(max([len(str(a)),len(str(b))]))9876543210', 'import math\nN=int(input())\na=0\nfor i in range(1,1+math.ceil(math.sqrt(N))):\n if N%i==0 and i>a:\n a=i\nb=int(N/a)\nprint(max([len(str(a)),len(str(b))]))'] | ['Runtime Error', 'Accepted'] | ['s889561577', 's731599314'] | [3060.0, 3060.0] | [17.0, 30.0] | [169, 159] |
p03776 | u057916330 | 2,000 | 262,144 | You are given N items. The _value_ of the i-th item (1 \leq i \leq N) is v_i. Your have to select at least A and at most B of these items. Under this condition, find the maximum possible arithmetic mean of the values of selected items. Additionally, find the number of ways to select items so that the mean of the values of selected items is maximized. | ["import operator\nimport functools\n\n\ndef main():\n N, A, B = map(int, input().split())\n v = list(map(int, input().split()))\n # use list.sort() or sorted(list)\n v.sort(reverse=True)\n # use slice to sum first A elements\n # use '{:f}'.format to format float\n print('{:.6f}'.format((sum(v[:A]) / A)))\n\n va = v[A - 1]\n # use list.count instead of (sum(list(map(lambda x: 1 if ... else 0, v))))\n pool = v.count(va)\n # ...and for comprehension and boolean sum\n head = sum(x > va for x in v)\n print(pool, head)\n # 5 4 3 3 3 2 1, A = 3, B = 5, pool = 3, pick = 1\n # 5 4 3 3 3 2 1, A = 4, B = 5, pool = 3, pick = 2\n # 3 3 3 3 3 2 1, A = 3, B = 6, pool = 5, pick = 3, 4, 5\n # 3 3 3 3 3 2 1, A = 3, B = 4, pool = 5, pick = 3, 4\n if head == 0:\n # for comprehension again, instead of a for loop that modifies variable\n ans = sum([_nCr(pool, pick) for pick in range(A, min(B, pool) + 1)])\n else:\n pick = A - head\n ans = _nCr(pool, pick)\n print(ans)\n\n\ndef _nCr(n, r):\n r = min(r, n-r)\n if r == 0:\n return 1\n # reduce and xrange are for python2\n numer = functools.reduce(operator.mul, range(n, n-r, -1))\n denom = functools.reduce(operator.mul, range(1, r+1))\n return numer//denom\n\n\nif __name__ == '__main__':\n main()\n", "import operator\nimport functools\n\n\ndef main():\n N, A, B = map(int, input().split())\n v = list(map(int, input().split()))\n # use list.sort() or sorted(list)\n v.sort(reverse=True)\n # use slice to sum first A elements\n # use '{:f}'.format to format float\n print('{:.6f}'.format((sum(v[:A]) / A)))\n\n va = v[A - 1]\n # use list.count instead of (sum(list(map(lambda x: 1 if ... else 0, v))))\n pool = v.count(va)\n # ...and for comprehension and boolean sum\n head = sum(x > va for x in v)\n # 5 4 3 3 3 2 1, A = 3, B = 5, pool = 3, pick = 1\n # 5 4 3 3 3 2 1, A = 4, B = 5, pool = 3, pick = 2\n # 3 3 3 3 3 2 1, A = 3, B = 6, pool = 5, pick = 3, 4, 5\n # 3 3 3 3 3 2 1, A = 3, B = 4, pool = 5, pick = 3, 4\n if head == 0:\n # for comprehension again, instead of a for loop that modifies variable\n ans = sum([_nCr(pool, pick) for pick in range(A, min(B, pool) + 1)])\n else:\n pick = A - head\n ans = _nCr(pool, pick)\n print(ans)\n\n\ndef _nCr(n, r):\n r = min(r, n-r)\n if r == 0:\n return 1\n # reduce and xrange are for python2\n numer = functools.reduce(operator.mul, range(n, n-r, -1))\n denom = functools.reduce(operator.mul, range(1, r+1))\n return numer//denom\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s451201211', 's356258564'] | [3572.0, 3572.0] | [24.0, 23.0] | [1313, 1291] |
p03776 | u202619899 | 2,000 | 262,144 | You are given N items. The _value_ of the i-th item (1 \leq i \leq N) is v_i. Your have to select at least A and at most B of these items. Under this condition, find the maximum possible arithmetic mean of the values of selected items. Additionally, find the number of ways to select items so that the mean of the values of selected items is maximized. | ["from math import factorial\n\n\nclass Frac(object):\n def __init__(self, a, b):\n self.a = a\n self.b = b\n\n def eq(self, f):\n return self.a * f.b == f.a * self.b\n\n def lt(self, f):\n return self.a * f.b > f.a * self.b\n\n def __repr__(self):\n return '%.6f' % (self.a / self.b)\n\n\ndef nCr(n, r):\n return factorial(n) // factorial(r) // factorial(n - r)\n\n\nN, A, B = map(int, input().split())\nV = list(map(int, input().split()))\nV.sort(reverse=True)\n\nres = None\nfor i in range(A, B+1):\n now = Frac(sum(V[:i]), i)\n if res is None or now.lt(res[0]):\n res = [now]\n elif now.eq(res[0]):\n res.append(now)\n\ncnt = 0\nfor now in res:\n p = V[:now.b]\n n = len(list(filter(lambda x: x == p[-1], V)))\n r = len(list(filter(lambda x: x == p[-1], p)))\n cnt += nCr(n, r)\n\nprint(res[0])\nprint(cnt)\n~", "class Frac(object):\n def __init__(self, a, b):\n self.a = a\n self.b = b\n\n def eq(self, f):\n return self.a * f.b == f.a * self.b\n\n def lt(self, f):\n return self.a * f.b > f.a * self.b\n\n def __repr__(self):\n return '%.6f' % (self.a / self.b)\n\n\ndef factorial(n):\n res = 1\n for i in range(n):\n res *= i+1\n return res\n\n\ndef nCr(n, r):\n return factorial(n) // factorial(r) // factorial(n - r)\n\n\nN, A, B = map(int, input().split())\nV = list(map(int, input().split()))\nV.sort(reverse=True)\n\nres = None\nfor i in range(A, B+1):\n now = Frac(sum(V[:i]), i)\n if res is None or now.lt(res[0]):\n res = [now]\n elif now.eq(res[0]):\n res.append(now)\n\ncnt = 0\nfor now in res:\n p = V[:now.b]\n n = len(list(filter(lambda x: x == p[-1], V)))\n r = len(list(filter(lambda x: x == p[-1], p)))\n cnt += nCr(n, r)\n\nprint(res[0])\nprint(cnt)"] | ['Runtime Error', 'Accepted'] | ['s320776698', 's684091937'] | [3064.0, 3064.0] | [17.0, 18.0] | [853, 911] |
p03776 | u556160473 | 2,000 | 262,144 | You are given N items. The _value_ of the i-th item (1 \leq i \leq N) is v_i. Your have to select at least A and at most B of these items. Under this condition, find the maximum possible arithmetic mean of the values of selected items. Additionally, find the number of ways to select items so that the mean of the values of selected items is maximized. | ["import collections\nfrom scipy.misc import comb\n\nn,a,b = map(int, input().split(' '))\nv = map(int, input().split(' '))\n\nv = sorted(v, reverse=True)\nselect = v[:a]\nresult1 = sum(select)/len(select)\n\nresult2 = 0\nv_cnt = collections.Counter(v)\nfor i in range(a,b+1):\n select = v[:i]\n if result1 == sum(select)/len(select):\n select = collections.Counter(select)\n buf = 1\n for v_ in v_cnt:\n buf *= comb(v_cnt[v_],select[v_])\n result2 += buf\nprint('%.6f'%result1)\nprint(int(round(result2)))", "import collections\nfrom scipy.misc import comb\n\nn,a,b = map(int, input().split(' '))\nv = map(int, input().split(' '))\n\nv = sorted(v, reverse=True)\nselect = v[:a]\nresult1 = sum(select)/len(select)\n\nresult2 = 0\nv_cnt = collections.Counter(v)\nfor i in range(a,b+1):\n select = v[:i]\n if result1 == sum(select)/len(select):\n select = collections.Counter(select)\n buf = 1\n for v_ in v_cnt:\n buf *= comb(v_cnt[v_],select[v_])\n result2 += buf\nprint('%.6f'%result1)\nprint(int(result2))", 'import collections\n\n# Iterative Algorithm (xgcd)\ndef iterative_egcd(a, b):\n x,y, u,v = 0,1, 1,0\n while a != 0:\n q,r = b//a,b%a; m,n = x-u*q,y-v*q \n b,a, x,y, u,v = a,r, u,v, m,n\n return b, x, y\n \n# Recursive Algorithm\ndef recursive_egcd(a, b):\n """Returns a triple (g, x, y), such that ax + by = g = gcd(a,b).\n Assumes a, b >= 0, and that at least one of them is > 0.\n Bounds on output values: |x|, |y| <= max(a, b)."""\n if a == 0:\n return (b, 0, 1)\n else:\n g, y, x = recursive_egcd(b % a, a)\n return (g, x - (b // a) * y, y)\n \negcd = iterative_egcd # or recursive_egcd(a, m)\n \ndef modinv(a, m):\n g, x, y = egcd(a, m) \n if g != 1:\n return None\n else:\n return x % m\n \ndef conv(n,a):\n ret = 1\n for i in range(1,a+1):\n ret *= n-a+i\n ret //= i\n return ret\n \n#n,a,b = map(int, input().split(\' \'))\n#v = map(int, input().split(\' \'))\nn,a,b = 50,1,50\nv = [1]*50\n\nv = sorted(v, reverse=True)\nselect = v[:a]\nresult1 = sum(select)/len(select)\n\nresult2 = 0\nv_cnt = collections.Counter(v)\nfor i in range(a,b+1):\n select = v[:i]\n if result1 == sum(select)/len(select):\n select = collections.Counter(select)\n buf = 1\n for v_ in v_cnt:\n buf *= conv(v_cnt[v_],select[v_])\n result2 += buf\nprint(\'%.6f\'%result1)\nprint(result2)', "import collections\nfrom scipy.misc import comb\n\nn,a,b = map(int, input().split(' '))\nv = map(int, input().split(' '))\n\nv = sorted(v, reverse=True)\nselect = v[:a]\nresult1 = sum(select)/len(select)\n\nresult2 = 0\nv_cnt = collections.Counter(v)\nfor i in range(a,b+1):\n select = v[:i]\n if result1 == sum(select)/len(select):\n select = collections.Counter(select)\n buf = 1\n for v_ in v_cnt:\n buf *= comb(v_cnt[v_],select[v_])\n result2 += buf\nprint(result1)\nprint(int(result2))", 'import collections\n\n# Iterative Algorithm (xgcd)\ndef iterative_egcd(a, b):\n x,y, u,v = 0,1, 1,0\n while a != 0:\n q,r = b//a,b%a; m,n = x-u*q,y-v*q \n b,a, x,y, u,v = a,r, u,v, m,n\n return b, x, y\n \n# Recursive Algorithm\ndef recursive_egcd(a, b):\n """Returns a triple (g, x, y), such that ax + by = g = gcd(a,b).\n Assumes a, b >= 0, and that at least one of them is > 0.\n Bounds on output values: |x|, |y| <= max(a, b)."""\n if a == 0:\n return (b, 0, 1)\n else:\n g, y, x = recursive_egcd(b % a, a)\n return (g, x - (b // a) * y, y)\n \negcd = iterative_egcd # or recursive_egcd(a, m)\n \ndef modinv(a, m):\n g, x, y = egcd(a, m) \n if g != 1:\n return None\n else:\n return x % m\n \ndef conv(n,a):\n ret = 1\n for i in range(1,a+1):\n ret *= n-a+i\n ret //= i\n return ret\n \nn,a,b = map(int, input().split(\' \'))\nv = map(int, input().split(\' \'))\n\nv = sorted(v, reverse=True)\nselect = v[:a]\nresult1 = sum(select)/len(select)\n\nresult2 = 0\nv_cnt = collections.Counter(v)\nfor i in range(a,b+1):\n select = v[:i]\n if result1 == sum(select)/len(select):\n select = collections.Counter(select)\n buf = 1\n for v_ in v_cnt:\n buf *= conv(v_cnt[v_],select[v_])\n result2 += buf\nprint(\'%.6f\'%result1)\nprint(result2)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s180634866', 's311239368', 's713743484', 's791644596', 's707801054'] | [16876.0, 27388.0, 3316.0, 16972.0, 3316.0] | [239.0, 454.0, 21.0, 226.0, 21.0] | [528, 521, 1407, 514, 1378] |
p03776 | u584355711 | 2,000 | 262,144 | You are given N items. The _value_ of the i-th item (1 \leq i \leq N) is v_i. Your have to select at least A and at most B of these items. Under this condition, find the maximum possible arithmetic mean of the values of selected items. Additionally, find the number of ways to select items so that the mean of the values of selected items is maximized. | ['# -*- coding: utf-8 -*-\nINF=10**10\nfrom collections import Counter\nimport scipy.misc as scm\n\ndef main():\n N,A,B=list(map(int,input().split()))\n v=list(map(int,input().split()))\n cnt=Counter(v)\n ary=[]\n first=True\n \n for num,count in sorted(cnt.items(),reverse=True):\n if count>A:\n if first:\n a2=0\n print(num)\n for k in range(A,min(B,count)+1):\n a2+=scm.comb(count,k)\n print(int(a2))\n return 0\n \n ary+=[num]*A\n print(sum(ary)/len(ary))\n print(int(scm.comb(count,A)))\n return 0\n elif A==0:\n print(sum(ary)/len(ary))\n print(1)\n else:\n ary+=[num]*count\n A-=count\n first=False\n \n \n \nif __name__=="__main__":\n main()\n ', '# -*- coding: utf-8 -*-\nINF=10**10\nfrom collections import Counter\nimport scipy.misc as scm\n\ndef main():\n N,A,B=list(map(int,input().split()))\n v=list(map(int,input().split()))\n cnt=Counter(v)\n ary=[]\n first=True\n \n for num,count in sorted(cnt.items(),reverse=True):\n if count>A:\n if first:\n a2=0\n print("{:.6f}".format(float(num)))\n for k in range(A,min(B,count)+1):\n a2+=scm.comb(count,k)\n print(int(a2))\n return 0\n \n ary+=[num]*A\n print("{:.6f}".format(sum(ary)/len(ary)))\n print(int(scm.comb(count,A)))\n return 0\n elif A==0:\n print("{:.6f}".format(sum(ary)/len(ary)))\n print(1)\n else:\n ary+=[num]*count\n A-=count\n first=False\n \n \n \nif __name__=="__main__":\n main()\n ', '# -*- coding: utf-8 -*-\nINF=10**10\nfrom collections import Counter\nimport scipy.misc as scm\n\ndef ncr(n, r):\n r = min(r, n - r)\n if r == 0: return 1;\n if r == 1: return n;\n numerator = [n - r + i + 1 for i in range(r)]\n denominator = [i + 1 for i in range(r)]\n for p in range(2, r + 1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p - 1, r, p):\n numerator[k - offset] //= pivot\n denominator[k] //= pivot\n result = 1\n for k in range(r):\n if numerator[k] > 1: \n result *= numerator[k]\n return result\n\ndef main():\n N,A,B=list(map(int,input().split()))\n v=list(map(int,input().split()))\n cnt=Counter(v)\n ary=[]\n first=True\n \n for num,count in sorted(cnt.items(),reverse=True):\n if count>A:\n if first:\n a2=0\n print("{:.6f}".format(float(num)))\n for k in range(A,min(B,count)+1):\n a2+=ncr(count,k)\n print(a2)\n return 0\n \n ary+=[num]*A\n print("{:.6f}".format(sum(ary)/len(ary)))\n print(ncr(count,A))\n return 0\n elif A==0:\n print("{:.6f}".format(sum(ary)/len(ary)))\n print(1)\n else:\n ary+=[num]*count\n A-=count\n first=False\n \n \n \nif __name__=="__main__":\n main()\n '] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s325498530', 's724945888', 's977328384'] | [20656.0, 25128.0, 13276.0] | [306.0, 433.0, 165.0] | [886, 944, 1478] |
p03776 | u633450100 | 2,000 | 262,144 | You are given N items. The _value_ of the i-th item (1 \leq i \leq N) is v_i. Your have to select at least A and at most B of these items. Under this condition, find the maximum possible arithmetic mean of the values of selected items. Additionally, find the number of ways to select items so that the mean of the values of selected items is maximized. | ['if __name__ == \'__main__\':\n from collections import Counter\n from scipy.misc import comb\n\n N,A,B = [int(i) for i in input().split()]\n V = [int(i) for i in input().split()]\n\n V.sort(reverse = True)\n max_list = V[0:A]\n max = sum(V[0:A]) / A\n\n for i in range(A+1,B+1):\n a = sum(V[0:i]) / i\n if max < a:\n max_list = V[0:i]\n max = a\n print("{:.6f}".format(max))\n\n ans = 1\n max_list = Counter(max_list).most_common()\n for i in range(len(max_list)):\n ans *= comb(V.count(max_list[i][0]),max_list[i][1])\n print(int(ans))\n', 'if __name__ == \'__main__\':\n from collections import Counter\n from scipy.misc import comb\n\n N,A,B = [int(i) for i in input().split()]\n V = [int(i) for i in input().split()]\n\n V.sort(reverse = True)\n max_list = [V[0:A]]\n max = sum(V[0:A]) / A\n\n for i in range(A+1,B+1):\n a = sum(V[0:i]) / i\n if max <= a:\n max_list.append(V[0:i])\n max = a\n print("{:.6f}".format(max))\n \n ans = 0\n for x in max_list:\n ans_sub = 1\n try:\n x = Counter(x).most_common()\n except TypeError:\n ans += ans_sub\n continue\n for i in range(len(x)):\n ans_sub *= comb(V.count(x[i][0]),x[i][1])\n ans += ans_sub\n print(int(ans))\n', 'if __name__ == \'__main__\':\n from collections import Counter\n from scipy.mist import comb\n\n N,A,B = [int(i) for i in input().split()]\n V = [int(i) for i in input().split()]\n\n V.sort(reverse = True)\n max_list = [V[0:A]]\n max = sum(V[0:A]) / A\n\n for i in range(A+1,B+1):\n a = sum(V[0:i]) / i\n if max <= a:\n max_list.append(V[0:i])\n max = a\n print("{:.6f}".format(max))\n \n ans = 0\n for x in max_list:\n ans_sub = 1\n try:\n x = Counter(x).most_common()\n except TypeError:\n ans += ans_sub\n continue\n for i in range(len(x)):\n ans_sub *= comb(V.count(x[i][0]),x[i][1])\n ans += ans_sub\n print(int(ans))\n', 'if __name__ == \'__main__\':\n from collections import Counter\n from mist.special import comb\n\n N,A,B = [int(i) for i in input().split()]\n V = [int(i) for i in input().split()]\n\n V.sort(reverse = True)\n max_list = [V[0:A]]\n max = sum(V[0:A]) / A\n\n for i in range(A+1,B+1):\n a = sum(V[0:i]) / i\n if max <= a:\n max_list.append(V[0:i])\n max = a\n print("{:.6f}".format(max))\n \n ans = 0\n for x in max_list:\n ans_sub = 1\n try:\n x = Counter(x).most_common()\n except TypeError:\n ans += ans_sub\n continue\n for i in range(len(x)):\n ans_sub *= comb(V.count(x[i][0]),x[i][1])\n ans += ans_sub\n print(int(ans))\n', 'def comb(n, k):\n return factorial(n) // (factorial(k) * factorial(n-k))\n \nif __name__ == \'__main__\':\n from collections import Counter\n from math import factorial\n\n N,A,B = [int(i) for i in input().split()]\n V = [int(i) for i in input().split()]\n\n V.sort(reverse = True)\n max_list = [V[0:A]]\n max = sum(V[0:A]) / A\n\n for i in range(A+1,B+1):\n a = sum(V[0:i]) / i\n if max <= a:\n max_list.append(V[0:i])\n max = a\n print("{:.6f}".format(max))\n\n ans = 0\n for x in max_list:\n ans_sub = 1\n try:\n x = Counter(x).most_common()\n except TypeError:\n ans += ans_sub\n continue\n for i in range(len(x)):\n ans_sub *= comb(V.count(x[i][0]),x[i][1])\n ans += ans_sub\n print(int(ans))\n'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s106604624', 's161784100', 's636139620', 's853085645', 's532345128'] | [13576.0, 15940.0, 13172.0, 3316.0, 3316.0] | [163.0, 207.0, 158.0, 20.0, 22.0] | [595, 746, 746, 748, 819] |
p03776 | u841623074 | 2,000 | 262,144 | You are given N items. The _value_ of the i-th item (1 \leq i \leq N) is v_i. Your have to select at least A and at most B of these items. Under this condition, find the maximum possible arithmetic mean of the values of selected items. Additionally, find the number of ways to select items so that the mean of the values of selected items is maximized. | ['N,A,B=map(int,input().split())\nv=[int(x)for x in input().split()]\nv.sort(reverse=True)\na=sum(v[:A])/A\nm=min(v[:A])\nk=v.count(m)\nl=v.index(m)\nans=0\nimport math\nfor i in range(A,B+1):\n if i==A:\n ans+=(math.factorial(k)/math.factorial(i-l))/math.factorial(k-i+l)\n else:\n if k-i+l>=0 and a==m:\n ans+=(math.factorial(k)//math.factorial(i-l))//math.factorial(k-i+l)\n else:\n break\n \n \nprint("{:.1f}".format(a))\nprint(int(ans)) ', 'N,A,B=map(int,input().split())\nv=[int(x)for x in input().split()]\nv.sort(reverse=True)\na=sum(v[:A])/A\nm=min(v[:A])\nk=v.count(m)\nl=v.index(m)\nans=0\nprint(m)\nprint(v)\nprint(k)\nprint(l)\nimport math\nfor i in range(A,B+1):\n if i==A:\n ans+=(math.factorial(k)/math.factorial(i-l))/math.factorial(k-i+l)\n else:\n if k-i+l>=0 and a==m:\n ans+=(math.factorial(k)//math.factorial(i-l))//math.factorial(k-i+l)\n else:\n break\n \n \nprint("{:.6f}".format(a))\nprint(int(ans)) ', 'N,A,B=map(int,input().split())\nv=[int(x)for x in input().split()]\nv.sort(reverse=True)\na=sum(v[:A])/A\nm=min(v[:A])\nk=v.count(m)\nl=v.index(m)\nans=0\nimport math\nfor i in range(A,B+1):\n if i==A:\n ans+=(math.factorial(k)//math.factorial(i-l))//math.factorial(k-i+l)\n else:\n if k-i+l>=0 and a==m:\n ans+=(math.factorial(k)//math.factorial(i-l))//math.factorial(k-i+l)\n else:\n break\n \n \nprint("{:.6f}".format(a))\nprint(int(ans)) '] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s090319550', 's785559356', 's707187628'] | [3064.0, 3188.0, 3064.0] | [17.0, 18.0, 18.0] | [491, 528, 494] |
p03781 | u018679195 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['n=int(input())\nans=0\nfor i in range(n+1):\n if i*(i+1)/2>n:\n ans=i\n break\nprint(ans)\n', 'nest = int(input())\n\nmax = 0\ni = 0\n\nwhile max < nest:\n\ti += 1\n\tmax += i\n\nprint(i)'] | ['Wrong Answer', 'Accepted'] | ['s137102816', 's398261010'] | [2940.0, 3060.0] | [30.0, 30.0] | [101, 81] |
p03781 | u131634965 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['x=int(input())\n\njump_count=0\nfor i in range(x+1):\n if x-i > i+1:\n x-=i\n jump_count+=1\n elif x-i == i+1:\n exit()\n jump_count+=1\nprint(jump_count)', 'x=int(input())\ndis_sum=0\nfor i in range(1,x+1):\n dis_sum+=i\n if dis_sum>=x:\n print(i)\n break'] | ['Wrong Answer', 'Accepted'] | ['s013757724', 's083418259'] | [2940.0, 2940.0] | [2104.0, 25.0] | [178, 112] |
p03781 | u140806166 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['x = input()\nd = 0\nfor i in range(1, 10 ** 6):\n d += i\n if x <= d:\n print(i)\n break\n\n\n', 'x = int(input())\nd = 0\nfor i in range(1, 10 ** 6):\n d += i\n if x <= d:\n print(i)\n break\n'] | ['Runtime Error', 'Accepted'] | ['s940151159', 's732466781'] | [2940.0, 2940.0] | [18.0, 25.0] | [93, 108] |
p03781 | u163320134 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['n=int(input())\ntmp=0\nfor i in range(100000):\n tmp+=i\n if tmp>=n:\n print(i)', 'n=int(input())\ntmp=0\nfor i in range(100000):\n tmp+=i\n if tmp>=n:\n print(i)\n break'] | ['Wrong Answer', 'Accepted'] | ['s904787398', 's636877532'] | [3920.0, 2940.0] | [111.0, 25.0] | [79, 89] |
p03781 | u271456715 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['import sys\n[n, k] = [int(x) for x in input().strip().split()]\na = [int(x) for x in input().strip().split()]\n\na.sort()\n\nif sum(a) < k:\n print(n)\n sys.exit()\n\ns = 0\nfor i in range(len(a)):\n s += a[i]\n if s >= k:\n break\n\naa = [x for x in a if x < a[i]]\nbb = [x for x in a if x < k]\n\ncc = []\nfor i in range(len(aa)):\n c = bb[:i] + bb[i+1:]\n t = k - bb[i]\n c.reverse()\n #print(c)\n flg = 0\n j = 0\n s = 0\n f = [0 for x in range(len(c))]\n while True:\n f[j] = 1\n #print(c)\n #print(f)\n s += c[j]\n if s >= t and s < k:\n flg = 1\n #print(c)\n #print(f)\n break\n if s >= k:\n f[j] = 0\n s -= c[j]\n j += 1\n if j == len(c):\n ii = -1\n for jj in range(len(c) - 1):\n if f[jj] == 1:\n ii = jj\n if ii == -1:\n break\n else:\n for l in range(ii, len(c)):\n f[l] = 0\n j = ii + 1\n s = sum([c[l] * f[l] for l in range(len(c))])\n if flg== 0:\n cc.append(bb[i])\n#print(cc)\nprint(len(cc))\n', 'x = int(input().strip())\n\ny = 0\ni = 0\nwhile y<x:\n i += 1\n y += i\n\nprint(i)'] | ['Runtime Error', 'Accepted'] | ['s880964668', 's310817890'] | [3064.0, 2940.0] | [18.0, 28.0] | [994, 76] |
p03781 | u273010357 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['import itertools\nimport numpy as np\n\nX = int(input())\nL = np.array(list(range(int(X**.5)+1)),dtype=np.float32)\nL = np.array(list(itertools.accumulate(L)),dtype=np.float32)\n\ndef getNearestValue(list, num):\n idx = np.abs(np.asarray(list) - num).argmin()\n return list[idx]\n\ntmp = getNearestValue(L, X)\ntmp1 = abs(X-tmp)\nprint(int((np.argwhere(L==tmp)+tmp1)[0]))', 'X=int(input())\nres=0\nfor i in range(X+1):\n if i*(i+1)//2>=X:\n res=i\n break\nprint(res)'] | ['Wrong Answer', 'Accepted'] | ['s942344380', 's517873872'] | [21680.0, 2940.0] | [293.0, 28.0] | [364, 92] |
p03781 | u329865314 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['x=int(input())\nfor i in range(100000):\n if i * i+1 >= 2 * x:\n print(i)\n quit()', 'x=int(input())\nfor i in range(100000):\n if i * (i+1) >= 2 * x:\n print(i)\n quit()'] | ['Wrong Answer', 'Accepted'] | ['s313432466', 's857889672'] | [3064.0, 2940.0] | [26.0, 25.0] | [85, 87] |
p03781 | u397531548 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['N=int(input())\na=0\ni=1\nwhile a<N:\n a+=i\n i+=1\nprint(i)\n ', 'N=int(input())\na=0\ni=0\nwhile a<N:\n i+=1\n a+=i\nprint(i)'] | ['Wrong Answer', 'Accepted'] | ['s092795756', 's220862859'] | [3060.0, 2940.0] | [28.0, 28.0] | [59, 56] |
p03781 | u463655976 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['x = int(input())\n\nt = (-1 + math.sqrt(1 + 8 * x))\nif t % 2 == 0:\n print(t//2)\nelse:\n print(t//2+1)\n', 'import math\nx = int(input())\n\nt = (-1 + math.sqrt(1 + 8 * x))\nif t % 2 == 0:\n print(int(t)//2)\nelse:\n print(int(t)//2+1)\n'] | ['Runtime Error', 'Accepted'] | ['s600510772', 's555896833'] | [2940.0, 2940.0] | [18.0, 17.0] | [101, 123] |
p03781 | u468972478 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['n = int(input())\ni = 1\nwhile n > 0:\n n -= i\n i += 1\nprint(i)', 'n = int(input())\ni = 1\nwhile n > 0:\n n -= i\n i += 1\nprint(i-1)'] | ['Wrong Answer', 'Accepted'] | ['s296106620', 's639054901'] | [9028.0, 9116.0] | [37.0, 37.0] | [62, 64] |
p03781 | u488127128 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['import math\nx = int(input())\nprint(-(-((x*2+1/4)**0.5-1/2)//1))', 'import math\nx = int(input())\nprint(-int(-((x*2+1/4)**0.5-1/2)//1))'] | ['Wrong Answer', 'Accepted'] | ['s486469260', 's679553698'] | [2940.0, 3060.0] | [18.0, 17.0] | [63, 66] |
p03781 | u813174766 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['n=int(input())\ni=int(sqrt(n))//2\nwhile(i*(i+1)//2<n):\n i+=1\nprint(i)', 'n=int(input())\ni=int(n**0.5)//2\nwhile(i*(i+1)//2<n):\n i+=1\nprint(i)'] | ['Runtime Error', 'Accepted'] | ['s802034625', 's220714568'] | [2940.0, 2940.0] | [17.0, 25.0] | [69, 68] |
p03781 | u985443069 | 2,000 | 262,144 | There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i. The kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible. Find the earliest possible time to reach coordinate X. | ['# import sys\n\n\nn, k = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\n\nprefix = [set() for _ in range(n + 1)]\nsuffix = [set() for _2 in range(n + 1)]\n\nprefix[0] = {0}\nfor i in range(n):\n for v in prefix[i]:\n if v + a[i] <= k:\n prefix[i+1].add(v + a[i])\n\nsuffix[n] = {0}\nfor i in range(n - 1, -1, -1):\n suffix[i] = set(suffix[i + 1])\n for v in suffix[i + 1]:\n if v + a[i] <= k:\n suffix[i].add(v + a[i])\n\n\nc_suffix = [[0] * (k+1) for _3 in range(n + 1)]\nfor i in range(n + 1):\n for j in range(k):\n c_suffix[i][j + 1] = c_suffix[i][j] + (j in suffix[i])\n\n\ndef find(i):\n if k <= a[i]:\n return 0\n for s in prefix[i]:\n start = max(0, k - a[i] - s)\n stop = k - s\n if c_suffix[i + 1][stop] - c_suffix[i + 1][start] > 0:\n return 0\n return 1\n\n\nres = 0\nfor i in range(n):\n res += find(i)\nprint(res)\n', "import sys\nsys.stdin = open('d3.in')\n\nn, k = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\n\nprefix = [set() for _ in range(n + 1)]\n# suffix = [set() for _2 in range(n + 1)]\n\nprefix[0] = {0}\nfor i in range(n):\n for v in prefix[i]:\n prefix[i+1].add(v)\n if v + a[i] <= k:\n prefix[i+1].add(v + a[i])\n\nsuffix_i = {0}\n\n\nc_suffix = [[0] * (k+1) for _3 in range(n + 1)]\n\nfor j in range(k):\n c_suffix[n][j + 1] = c_suffix[n][j] + (j in suffix_i)\n\nfor i in range(n - 1, -1, -1):\n to_add = set()\n for v in suffix_i:\n if v + a[i] <= k:\n to_add.add(v + a[i])\n suffix_i.update(to_add)\n for j in range(k):\n c_suffix[i][j + 1] = c_suffix[i][j] + (j in suffix_i)\n\n\ndef find(i):\n if k <= a[i]:\n return 0\n for s in prefix[i]:\n start = max(0, k - a[i] - s)\n stop = k - s\n if c_suffix[i + 1][stop] - c_suffix[i + 1][start] > 0:\n return 0\n return 1\n\n\nres = 0\nfor i in range(n):\n res += find(i)\nprint(res)\n", 'from math import sqrt\n\nx = int(input())\nn = int(sqrt(2 * x)) - 10\nwhile not (n - 1) * n // 2 < x <= n * (n + 1) // 2:\n n += 1\nprint(n)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s185730275', 's353755267', 's712755093'] | [3316.0, 3064.0, 2940.0] | [19.0, 18.0, 17.0] | [961, 1044, 138] |
p03783 | u823871776 | 2,000 | 262,144 | AtCoDeer the deer found N rectangle lying on the table, each with height 1. If we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical range of AtCoDeer will move these rectangles horizontally so that all the rectangles are connected. For each rectangle, the cost to move it horizontally by a distance of x, is x. Find the minimum cost to achieve connectivity. It can be proved that this value is always an integer under the constraints of the problem. | ['n = int(input())\n\nl = [0]*n\nr = [0]*n\n\nfor i in range(n):\n l[i], r[i] = list(map(int, input().split()))\n\nN = 10**9+1\ndp = [[0 for i in range(N)] for j in range(n)]\n\n\nfor i in range(N):\n if r[0] < i: d = i-r[0]\n elif i < l[0]: d = l[0]-i\n else: d = 0\n dp[0][i] = d\n\n\nfor ni in range(1,n):\n for i in range(N):\n if r[ni] < i: d = i-r[ni]\n elif i < l[ni]: d = l[ni]-i\n else: d = 0\n dp[ni][i] = d + dp[ni-1][i]\nprint(min(dp[n-1]))', 'import math\nn = int(input())\nN = 400\nif n > N: exit()\n\nl = [0]*n\nr = [0]*n\nfor i in range(n): \n l[i], r[i] = list(map(int, input().split()))\ndp = [[1000 for i in range(N)] for j in range(n)]\n\nfor i in range(N): \n dp[0][i] = abs(l[ni]-i)\n if i < l[ni]: \n d = l[ni] - i\n elif r[ni] < i: \n d = i - r[ni]\n else: \n d = 0\n dp[0][i] = d\n \nfor ni in range(1,n): \n for xj in range(N): \n \n if xj < l[ni]: \n d = l[ni] - xj\n elif r[ni] < xj:\n d = xj - r[ni]\n else: \n d = 0 \n \n min_cost = 1000\n for xk in range(N):\n d2 = 0\n if xk < xj:\n if xj <= xk+r[ni-1]:\n min_cost = min(min_cost, dp[ni-1][xj] + d2 )\n elif xj < xk:\n if xk <= xj+r[ni]:\n min_cost = min(min_cost, dp[ni-1][xj] + d2 ) \n else:\n min_cost = min(min_cost, dp[ni-1][xj] + d2)\n dp[ni][xj] = min_cost+d\nprint(min(dp[n-1]))', 'n = int(input())\n\nif n>400: exit()\n\nl = [0]*n\nr = [0]*n\n\nfor i in range(n):\n l[i], r[i] = list(map(int, input().split()))\n\nN = 400+1\ndp = [[0 for i in range(N)] for j in range(n)]\n\n\nfor i in range(N):\n if r[0] < i: d = i-r[0]\n elif i < l[0]: d = l[0]-i\n else: d = 0\n dp[0][i] = d\n\n\nfor ni in range(1,n+1):\n for i in range(N):\n if r[ni] < i: d = i-r[ni]\n elif i < l[ni]: d = l[ni]-i\n else: d = 0\n dp[ni][i] = d + dp[ni-1][i]\nprint(min(dp[n-1]))', 'N = int(input())\nP = [list(map(int, input().split())) for i in range(N)]\n \nINF = 10**18\n \nfrom heapq import heappush, heappop\n \nl0, r0 = P[0]\n \nL = [-l0+1]\nR = [l0-1]\ns = t = 0\n \nres = 0\nfor i in range(N-1):\n l0, r0 = P[i]\n l1, r1 = P[i+1]\n s += (r1 - l1); t += (r0 - l0)\n if -s-L[0] <= l1-1 <= t+R[0]:\n heappush(L, -l1+1-s)\n heappush(R, l1-1-t)\n elif l1-1 < -s-L[0]:\n heappush(L, -l1+1-s)\n heappush(L, -l1+1-s)\n p = -heappop(L)-s\n heappush(R, p-t)\n res += (p - (l1-1))\n elif t+R[0] < l1-1:\n heappush(R, l1-1-t)\n heappush(R, l1-1-t)\n p = heappop(R) + t\n heappush(L, -p-s)\n res += (l1-1 - p)\nprint(res)'] | ['Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s116683642', 's144645404', 's911515682', 's109930251'] | [530200.0, 4340.0, 9332.0, 36336.0] | [2145.0, 27.0, 113.0, 623.0] | [568, 1283, 586, 703] |
p03785 | u001024152 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N,C,K = map(int, input().split())\nT = [int(input()) for _ in range(N)]\nT.sort()\ntmp = T[0]\nans = 0\ncnt = 1\nfor i in range(1, N):\n cnt += 1\n if T[i]-tmp>K:\n ans += 1\n cnt = 1\n tmp = T[i]\n elif cnt>C:\n ans += 1\n cnt = 1\n tmp = T[i]\nprint(ans)', 'N,C,K = map(int, input().split())\nans = 0\nt = [int(input()) for _ in range(N)]\nt.sort()\nfor i in range(N):\n if i==0:\n tmp = t[i]+K\n cnt = 1\n else:\n cnt += 1\n if t[i] > tmp or i==N-1 or cnt==C:\n ans += cnt//C if cnt%C==0 else cnt//C+1\n tmp = t[i]+K\n cnt = 1\n # print(i,cnt, ans)\nprint(ans)', 'N,C,K = map(int, input().split())\nT = [int(input()) for _ in range(N)]\nT.sort()\ntmp = T[0]\nans = 0\ncnt = 1\nfor i in range(1, N):\n cnt += 1\n if T[i]-tmp>K:\n ans += 1\n cnt = 1\n tmp = T[i]\n elif cnt>C:\n ans += 1\n cnt = 1\n tmp = T[i]\nprint(ans+1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s199915055', 's841804456', 's321810192'] | [7384.0, 7384.0, 7384.0] | [239.0, 271.0, 242.0] | [291, 358, 293] |
p03785 | u001687078 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['n, c, k = map(int, input().split())\nt = []\nfor i in range(n):\n t.append(int(input()))\nt.sort()\nresult = 1\nj = 0\n\nfor i in range(n):\n if (t[j] - t[0]) > k or c == count:\n result += 1\n t = t[j:]\n j = 1\n else:\n j += 1\nprint(result)', 'n, c, k = map(int, input().split())\nt = [int(input()) for i in range(n)]\nt.sort()\n\nresult = 1\ncount = 0\nf = 0\n\nfor i in range(n):\n if (t[i] - t[f]) > k or c == count:\n result += 1\n count = 1\n f = i\n else:\n count += 1\nprint(result)'] | ['Runtime Error', 'Accepted'] | ['s705304685', 's084762238'] | [7384.0, 7384.0] | [222.0, 242.0] | [243, 244] |
p03785 | u001769145 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['# AGC011 A Airport Bus\nimport bisect\nfrom collections import deque\n\nn, c, k = map(int, input().split())\nt_list = [int(input()) for _ in range(n)]\n\nt_list.sort()\nt_list = deque(t_list)\nans = 0\n\nwhile len(t_list) > 0:\n _tmp = t_list.popleft() + k\n _idx = bisect.bisect_right(t_list, _tmp)\n if c <= _idx + 1:\n for _ in range(c):\n t_list.popleft()\n else:\n for _ in range(_idx):\n t_list.popleft()\n ans += 1\n\nprint(ans)', '# AGC011 A Airport Bus\nimport bisect\nfrom collections import deque\n\nn, c, k = map(int, input().split())\nt_list = [int(input()) for _ in range(n)]\n\nt_list.sort()\nt_list = deque(t_list)\nans = 0\n\nwhile len(t_list) > 0:\n _tmp = t_list.popleft() + k\n _idx = bisect.bisect_right(t_list, _tmp)\n if c-1 <= _idx:\n for _ in range(c-1):\n t_list.popleft()\n else:\n for _ in range(_idx):\n t_list.popleft()\n ans += 1\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s597581617', 's181685996'] | [8120.0, 8116.0] | [611.0, 609.0] | [464, 464] |
p03785 | u004423772 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['T = [int(input()) for _ in range(N)]\nT.sort()\n\ndef init_bus():\n global bus, min_t, ans\n bus = []\n bus.append(t)\n min_t = t\n ans += 1\n\nmin_t = 0\nfor t in T:\n if len(bus) == 0:\n init_bus()\n continue\n if t - min_t < K and len(bus) < C:\n bus.append(t)\n else:\n init_bus()\nprint(ans)', "N, C, K = map(int, input().split(' '))\nbus = []\nans = 0\nT = [int(input()) for _ in range(N)]\nT.sort()\n\ndef init_bus():\n global bus, min_t, ans\n bus = []\n bus.append(t)\n min_t = t\n ans += 1\n\nmin_t = 0\nfor t in T:\n if len(bus) == 0:\n init_bus()\n continue\n if t - min_t < K and len(bus) < C:\n bus.append(t)", "N, C, K = map(int, input().split(' '))\nbus = []\nans = 0\nT = [int(input()) for _ in range(N)]\nT.sort()\n\nmin_t = 0\ni = 0\nwhile i < N:\n ans += 1\n start = i\n while i < N and T[i] - T[start] <= K and i - start < C:\n i += 1\nprint(ans)"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s010338295', 's919462118', 's748065433'] | [3060.0, 7384.0, 7420.0] | [17.0, 229.0, 290.0] | [329, 345, 244] |
p03785 | u029169777 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N,C,K=map(int,input().split())\nT=[int(input()) for _ in range(N)]\nT.sort()\n\nans=0\nnexttime=0\npeople=0\nfor t in T:\n if t>nexttime:\n nexttime=t+K\n ans+=1\n people=0\n people+=1\n if people==C:\n nexttime=0', 'N,C,K=map(int,input().split())\nT=[int(input()) for _ in range(N)]\nT.sort()\n\nans=0\nnexttime=0\npeople=0\nfor t in T:\n if t>nexttime:\n nexttime=t+K\n ans+=1\n people=0\n people+=1\n if people==C:\n nexttime=0\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s523793023', 's199678274'] | [7384.0, 7488.0] | [241.0, 233.0] | [214, 225] |
p03785 | u033606236 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['nums ,limit ,wait = map(int, input().split())\nnums_ary = [0 for i in range(nums)]\n\nfor i in range(nums):\n nums_ary[i] = int(input())\n\nnums_ary.sort()\nnums_ary.append(10000000000000)\ncount = 0\ni = 0\nwhile i < nums:\n time = nums_ary[i]\n for x in range(limit):\n print(i,count,nums_ary[i])\n if not time <= nums_ary[i] <= time + wait:\n count += 1\n break\n i += 1\n else:\n count += 1\nprint(count)', 'nums ,limit ,wait = map(int, input().split())\nnums_ary = [0 for i in range(nums)]\n\nfor i in range(nums):\n nums_ary[i] = int(input())\n\nnums_ary.sort()\nnums_ary.append(10000000000000)\ncount = 0\ni = 0\nwhile i < nums:\n time = nums_ary[i]\n for x in range(limit):\n if not time <= nums_ary[i] <= time + wait:\n count += 1\n break\n i += 1\n else:\n count += 1\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s153719966', 's718718165'] | [11464.0, 7392.0] | [632.0, 300.0] | [450, 415] |
p03785 | u062189367 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['import sys\nN, C, K = list(map(int, input().split()))\nlistT = [int(input()) for _ in range(N)]\n\nlistT.sort()\n\ndef func(listT,bus):\n if len(listT)<2:\n print(bus+1)\n sys.exit()\n\n elif len(listT)>=2:\n for i in range(1,max(C,len(listT))):\n\n if listT[i]-listT[0]>K:\n bus += 1\n return func(listT[i:],bus)\n\n bus += 1\n\n if len(listT)<C:\n print(bus)\n sys.exit()\n\n\n return func(listT[C:],bus)\n\nfunc(listT,0)\n', 'N, C, K = list(map(int,input().split()))\nlistT = [int(input()) for _ in range(N)]\n\nlistT.sort()\n\ncount=0\nwhile listT != []:\n bus = []\n time = listT[0]\n count += 1\n while len(bus) != C and time+K>=listT[0]:\n bus.append(listT.pop(0))\n if listT==[]:\n break\n\nprint(count) \n'] | ['Runtime Error', 'Accepted'] | ['s092329737', 's291078776'] | [669648.0, 7384.0] | [2144.0, 1753.0] | [516, 317] |
p03785 | u064408584 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['n,c,k=map(int, input().split())\nt=[int(input()) for i in range(n)]\nt.sort()\nans=0\ns=0\ng=10**9\nfor i in range(n):\n if s==0:\n g=t[i]+k\n s+=1\n elif g>t[i]:\n ans+=1\n g=t[i]+s\n s+=1\n else:\n s+=1\n if s==c:\n ans+=1\n g=10**8\n s=0\nprint(ans)', 'n,c,k=map(int,input().split())\nt=sorted(map(int,input().split()))\nans=0\nj=0\ne=0\nfor i in t:\n if j==0:\n j=1\n e=i+k\n elif e<=i:\n j=1\n e=i+k\n ans+=1\n else:\n j+=1\n if j==c:\n j=0\n ans+=1\n e=0\nif j>0:ans+=1\nprint(ans)\n', 'n,c,k=map(int,input().split())\nt=sorted([int(input()) for i in range(n)])\nans=0\nj=0\ne=0\nfor i in t:\n if j==0:\n j=1\n e=i+k\n ans+=1\n elif e<i:\n j=1\n e=i+k\n ans+=1\n else:\n j+=1\n if j==c:\n j=0\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s293042724', 's778409269', 's433055347'] | [7488.0, 3064.0, 8280.0] | [253.0, 18.0, 234.0] | [307, 287, 268] |
p03785 | u070187104 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ["if __name__ == '__main__':\n [N, C, K] = [int(i) for i in input().split()]\n\n T = []\n for i in range(N):\n T.append(int(input()))\n T.sort()\n\n counter = 1\n\n num_people = 0\n\n flag = False\n\n for num in T:\n num_people += 1\n if flag:\n if num - first_time <= K and num_people <= C:\n continue\n else:\n counter += 1\n num_people = 1\n flag = False\n else:\n first_time = num\n flag = True\n\n\n print(counter)\n", "if __name__ == '__main__':\n [N, C, K] = [int(i) for i in input().split()]\n\n T = []\n for i in range(K):\n T.append(int(input()))\n T.sort()\n\n counter = 1\n\n num_people = 0\n\n flag = False\n\n for num in T:\n print(num)\n print(flag)\n num_people += 1\n if flag:\n if num - first_time <= K and num_people <= C:\n continue\n else:\n counter += 1\n num_people = 1\n flag = False\n print('inc')\n else:\n first_time = num\n flag = True\n \n\n print(counter)\n", "if __name__ == '__main__':\n [N, C, K] = [int(i) for i in input().split()]\n\n T = []\n for i in range(N):\n T.append(int(input()))\n T.sort()\n\n counter = 1\n\n num_people = 0\n\n flag = False\n\n for num in T:\n print(num)\n print(flag)\n num_people += 1\n if flag:\n if num - first_time <= K and num_people <= C:\n continue\n else:\n counter += 1\n num_people = 1\n flag = False\n print('inc')\n else:\n first_time = num\n flag = True\n\n\n print(counter)\n", "if __name__ == '__main__':\n [N, C, K] = [int(i) for i in input().split()]\n\n T = []\n for i in range(N):\n T.append(int(input()))\n T.sort()\n\n counter = 1\n\n num_people = 0\n\n flag = False\n\n for time in T:\n num_people += 1\n if flag:\n if time - first_time <= K and num_people <= C:\n continue\n else:\n counter += 1\n num_people = 1\n first_time = time\n\n else:\n first_time = time\n flag = True\n\n print(counter)\n"] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s199238746', 's390548089', 's476723093', 's840083280'] | [7384.0, 7068.0, 8908.0, 7444.0] | [240.0, 182.0, 405.0, 248.0] | [549, 625, 617, 557] |
p03785 | u075303794 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['import bisect\n\nN,C,K=map(int,input().split())\nT=[int(input()) for _ in range(N)]\nT.sort()\nans=0\ni=0\n\nif T[0]+K>=T[-1]:\n print(1)\nelse:\n while True:\n if i==N-1:\n ans+=1\n break\n i=bisect.bisect_right(T,T[i]+K)\n print(T,i)\n ans+=1\n print(ans)', 'import bisect\nimport sys\n\nN,C,K=map(int,input().split())\nT=[int(input()) for _ in range(N)]\nT.sort()\nans=0\ni=0\n\nif T[0]+K>=T[-1]:\n if N%C==0:\n print(N//C)\n else:\n print(N//C+1)\n sys.exit()\nelse:\n while True:\n t=bisect.bisect_right(T,T[i]+K)\n if t-i>C:\n i+=C\n else:\n i=t\n ans+=1\n if i==N-1:\n ans+=1\n break\n if i>N-1:\n i=N-1\n break\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s710051888', 's200610760'] | [143776.0, 13400.0] | [1498.0, 217.0] | [264, 398] |
p03785 | u102960641 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['n = int(input())\na = input()\nb = input()\n\nfor i in range(n):\n if i == 1:\n if a == b:\n print(n)\n exit()\n if a[i:] == b[:-i]:\n print(n+i)\n exit()\nprint(n*2)', 'n,c,k = map(int, input().split())\nt = [int(input()) for i in range(n)]\nt.sort()\nnow = t[0]\npeople = 1\nans = 1\nfor i in t[1:]:\n if i - now > k or people >= c:\n now = i\n people = 1\n ans += 1\n else:\n people += 1\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s939013857', 's634162686'] | [3060.0, 7888.0] | [18.0, 235.0] | [175, 234] |
p03785 | u105302073 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N, C, K = [int(i) for i in input().split()]\nT = list(sorted([int(i) for i in input().split()]))\nans = 1\nlimit = 0\nti = T[0]\nfor i in range(N - 1):\n limit += 1\n if ti + K < T[i + 1] or limit == C:\n ti = T[i + 1]\n ans += 1\n limit = 0\nprint(ans)\n', 'N, C, K = [int(i) for i in input().split()]\nT = sorted([int(input())] for i in range(N))\nans = 1\nlimit = 0\nti = T[0]\nfor i in range(N - 1):\n limit += 1\n if ti + K < T[i + 1] or limit == C:\n ti = T[i + 1]\n ans += 1\n limit = 0\nprint(ans)\n', 'N, C, K = [int(i) for i in input().split()]\nT = list(sorted([int(i) for i in input().split()]))\nans = 1\nlimit = 0\nti = T[0]\nfor i in range(N - 1):\n limit += 1\n if ti + K < T[i + 1] or limit == C:\n ti = T[i + 1]\n ans += 1\n limit = 0\nprint(ans)\n', 'N, C, K = [int(i) for i in input().split()]\nT = sorted([int(input()) for i in range(N)])\nans = 1\nlimit = 0\nti = T[0]\nfor i in range(N - 1):\n limit += 1\n if ti + K < T[i + 1] or limit == C:\n ti = T[i + 1]\n ans += 1\n limit = 0\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s345064087', 's415293443', 's430716279', 's915191863'] | [3060.0, 16876.0, 3060.0, 8280.0] | [17.0, 335.0, 17.0, 247.0] | [270, 263, 270, 263] |
p03785 | u107915058 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N, C, K = map(int, input().split())\nT = list(int(input()) for i in range(N))\nT.sort()\nbus = 1\npassenger = 0\nlimit = T[0] + K\nfor i in range(N):\n if T[i] <= limit and passenger < c:\n passenger += 1\n else:\n bus += 1\n limit = T[i]+K\n passenger = 1\nprint(bus)', 'bus = 1\ntime = 0\nfor i in range(N):\n if T[i]-time > K:\n bus +=1\n time = T[i]\n else:\n time = time\nprint(bus)', 'N, C, K = map(int, input().split())\nT = list(int(input()) for i in range(N))\nT.sort()\nbus = 1\npassenger = 0\nlimit = T[0] + K\nfor i in range(N):\n if T[i] <= limit and passenger < C:\n passenger += 1\n else:\n bus += 1\n limit = T[i]+K\n passenger = 1\nprint(bus)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s777102471', 's870986915', 's667867837'] | [13336.0, 8908.0, 13248.0] | [157.0, 24.0, 180.0] | [289, 134, 289] |
p03785 | u112007848 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['import bisect\nkyaku, teiin, jikan = map(int, input().split(" "))\na=sorted([(int)(input()) for i in range(kyaku)])\nprint(a)\ncount = 0\nwhile(True):\n print(a)\n if len(a) > teiin:\n if a[0] + jikan >= a[teiin]:\n a = a[teiin:]\n else:\n a = a[bisect.bisect_left(a, a[0] + jikan):]\n else:\n if a[0] + jikan >= a[-1]:\n count += 1\n break\n else:\n a = a[bisect.bisect_left(a, a[0] + jikan):]\n count += 1\nprint(count)', 'n,c,k = map(int ,input().split(" "))\nt = sorted([int(input()) for i in range(n)])\ntotal = 0\ncount = 0\nwhile(count != n):\n temp = 0\n \n for i in range(c):\n if count + i >= n:\n \n if t[-1] - t[count] <= k:\n \n count = n\n total += 1\n break\n else:\n temp = 0\n while(count != n):\n \n if t[count + temp] - t[count] <= k:\n temp += 1\n else:\n count += temp + 1\n total += 1\n break\n break\n if t[count + i] - t[count] > k:\n \n count += i\n total += 1\n break\n else:\n \n count += c\n total += 1\n if count == n:\n break\nprint(total)'] | ['Runtime Error', 'Accepted'] | ['s328308324', 's645627991'] | [144504.0, 14060.0] | [1593.0, 224.0] | [443, 892] |
p03785 | u118642796 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N,C,K = map(int,input().split())\nT = [int(input()) for _ in range(N)].sort()\n\ntime=T[0]\ncount = 1\nans = 0\n\nfor i in range(1,N):\n if T[i]-time>K or count==C:\n time = T[i]\n count = 1\n ans += 1\n else:\n count += 1\nif count>0:\n ans += 1\nprint(ans)\n \n', 'N,C,K = map(int,input().split())\nT = [int(input()) for _ in range(N)]\nT.sort()\n\ntime=T[0]\ncount = 1\nans = 0\n\nfor i in range(1,N):\n if T[i]-time>K or count==C:\n time = T[i]\n count = 1\n ans += 1\n else:\n count += 1\nif count>0:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s006973017', 's832351349'] | [7444.0, 7384.0] | [210.0, 228.0] | [261, 259] |
p03785 | u124605948 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['n, c, k = map(int, input().split())\nT = sorted([int(input()) for _ in range(n)])\n\nlimit = T[0] + k\nbus = [0]\nans = 0\nfor t in T:\n if t <= limit:\n if bus[-1] <= c:\n bus[-1] += 1\n else:\n bus.append(1)\n else:\n limit = t + k\n ans += len(bus)\n bus = [1]\n\nans += len(bus)\n\nprint(ans)', 'n, c, k = map(int, input().split())\nT = sorted([int(input()) for _ in range(n)])\n\nlimit = T[0] + k\nbus = [0]\nans = 0\nfor t in T:\n if t <= limit:\n if bus[-1] < c:\n bus[-1] += 1\n else:\n bus.append(1)\n limit = t + k\n\n else:\n limit = t + k\n ans += len(bus)\n bus = [1]\n\nans += len(bus)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s393182877', 's500012192'] | [14032.0, 13996.0] | [181.0, 182.0] | [340, 366] |
p03785 | u125205981 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['def main():\n N = int(input())\n A = list(map(int, input().split()))\n\n A.sort()\n i = 1\n j = N - 1\n x = sum(A)\n while j > 0:\n if (x - A[j]) * 2 >= A[j]:\n i += 1\n else:\n break\n x -= A[j]\n j -= 1\n print(str(i))\n\nmain()', 'def main():\n N, C, K = map(int, input().split())\n i = 0\n T = []\n while i < N:\n T.append(int(input()))\n i += 1\n T.sort()\n T.reverse()\n\n c = 1\n i = 1\n bus = 0\n time = T[0]\n while i < N:\n if time - T[i] <= K:\n c += 1\n if time - T[i] > K or c == C:\n bus += 1\n c = 1\n time = T[i]\n i += 1\n\n print(str(bus))\n\nmain()', 'def main():\n N, C, K = map(int, input().split())\n i = 0\n T = []\n while i < N:\n T.append(int(input()))\n i += 1\n T.sort()\n T.reverse()\n\n c = 1\n i = 1\n bus = 1\n time = T[0]\n while i < N:\n if time - T[i] > K or c == C:\n bus += 1\n c = 1\n time = T[i]\n elif time - T[i] <= K:\n c += 1\n i += 1\n\n print(str(bus))\n\nmain()'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s355109237', 's811920110', 's065479863'] | [3060.0, 7384.0, 7384.0] | [17.0, 256.0, 245.0] | [287, 423, 425] |
p03785 | u127499732 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ["def main():\n n, c, k, *t = map(int, open(0).read().split())\n t = sorted(t)\n u = tuple(t)\n\n count = 1\n i = 0\n p = 1\n lim = u[i] + k\n while i < n:\n if u[i] <= lim or p < c:\n i += 1\n p += 1\n else:\n count += 1\n lim = u[i] + k\n p = 1\n print(count)\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n n, c, k, *t = map(int, open(0).read().split())\n t.sort()\n u = tuple(t)\n\n cnt = 1\n p, l = 0, u[0] + k\n for v in t:\n if v <= l and p < c:\n p += 1\n else:\n cnt += 1\n p = 1\n l = v + k\n print(cnt)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s173919577', 's964579917'] | [14052.0, 14052.0] | [108.0, 87.0] | [379, 323] |
p03785 | u151625340 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N,C,K = map(int,input().split())\nT = [int(input()) for i in range(N)]\nT.sort()\ns = 0\ne = T[0]+K\np = 0\nans = 0\nflag = False\nfor i in range(N):\n if p == C or e < T[i]:\n ans += 1\n s = T[i]\n e = T[i]+K\n p = 0\n if i == N-1:\n flag = True\n s = max(s,T[i])\n e = min(e,T[i]+K)\n p += 1\nif not flag:\n ans += 1\nprint(ans)\n', 'N,C,K = map(int,input().split())\nT = [int(input()) for i in range(N)]\ns = 0\ne = 0\np = 0\nans = 0\nfor i in range(N):\n if p == C or e < T[i]:\n ans += 1\n s = T[i]\n e = T[i]+K\n p = 0\n s = max(s,T[i])\n e = min(e,T[i]+K)\n p += 1\nif p > 0:\n ans += 1\nprint(ans)\n', 'N,C,K = map(int,input().split())\nT = [int(input()) for i in range(N)]\nT.sort()\ns = 0\ne = T[0]+K\np = 0\nans = 0\nfor i in range(N):\n if p == C or e < T[i]:\n ans += 1\n s = T[i]\n e = T[i]+K\n p = 0\n s = max(s,T[i])\n e = min(e,T[i]+K)\n p += 1\nprint(ans+1)\n\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s279516381', 's654793391', 's345579064'] | [7384.0, 7104.0, 7488.0] | [315.0, 282.0, 320.0] | [371, 296, 290] |
p03785 | u185424824 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N,C,K = map(int,input().split())\n\nT = sorted([int(input()) for _ in range(N)])\nprint(T)\nans = 0\ncount = 0\ntime = 0\nfor i in range(N):\n if T[i] > time + K:\n ans += 1\n count = 0\n if count == 0:\n time = T[i]\n count += 1\n if count == C:\n ans += 1\n count = 0\nif count > 0:\n ans += 1\nprint(ans)', 'N,C,K = map(int,input().split())\n\nT = sorted([int(input()) for _ in range(N)])\nans = 1\ncount = 0\ntime = 0\nstart = -1\nfor i in range(N):\n if start == -1:\n start = i\n if i != N-1:\n if T[i] > T[start] + K or i+1 -start == C:\n ans += 1\n start = -1\n \nprint(ans)', 'N,C,K = map(int,input().split())\n\nT = sorted([int(input()) for _ in range(N)])\nans = 1\ncount = 0\ntime = 0\nstart = -1\nfor i in range(N):\n if start == -1:\n start = i\n if i != N-1:\n if T[i+1] > T[start] + K or i+1 -start == C:\n ans += 1\n start = -1\n \nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s643861439', 's966657437', 's759662182'] | [15852.0, 14020.0, 14164.0] | [202.0, 188.0, 195.0] | [308, 275, 277] |
p03785 | u187109555 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N, C, K = map(int, input().split())\nsorted_Ts = sorted([int(x) for x in input().split()])\n\nbus_num = 1\nbus_i = [1]\nbus_t = sorted_Ts[0]\nfor t in sorted_Ts:\n if (t<=(bus_t+K)) & (len(bus_i) <= C):\n bus_i.append(1)\n else:\n print("add bus")\n bus_i = []\n bus_t = t\n bus_num +=1\nprint(bus_num)', 'N, C, K = map(int, input().split())\nsorted_Ts = sorted([int(x) for x in input().split()])\n\nbus_num = 1\nbus_i = [1]\nbus_t = sorted_Ts[0]\nfor t in sorted_Ts:\n if (t<=(bus_t+K)) & (len(bus_i) <= C):\n bus_i.append(1)\n else:\n# print("add bus")\n bus_i = []\n bus_t = t\n bus_num +=1\nprint(bus_num)', 'N, C, K = map(int, input().split())\nsorted_Ts = sorted([int(x) for x in input().split()])\n\nbus_num = 1\nbus_i = [1]\nbus_t = sorted_Ts[0]\nfor t in sorted_Ts:\n if (t<=(bus_t+K)) & (len(bus_i) <= C):\n bus_i.append(1)\n else:\n #print("add bus")\n bus_i = []\n bus_t = t\n bus_num +=1\nprint(bus_num)', 'N, C, K = map(int, input().split())\nTs = [0]*N\nfor i in range(N):\n Ts[i] = int(input())\n\nTs = sorted(Ts)\nbus_num = 1\nbus_i = [1]\nbus_t = Ts[0]\nfor t in Ts[1:]:\n if (t<=(bus_t+K)) & (len(bus_i) < C):\n bus_i.append(1)\n else:\n bus_i = [1]\n bus_t = t\n bus_num +=1\nprint(bus_num)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s044339038', 's412635407', 's507398537', 's738355906'] | [3064.0, 3064.0, 3064.0, 8240.0] | [17.0, 17.0, 18.0, 251.0] | [329, 331, 330, 311] |
p03785 | u190866453 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['n, c, k = map(int, input().split())\nl = list(int(input()) for i in range(n))\n\ncount = 1\ncount_m = 0\nl.sort()\n\nwhile len(l) > 0:\n for i in range(1, c):\n try:\n if l[i] > l[0] + k:\n l = l[count_m + 1:]\n count += 1\n\n else:\n count_m += 1\n if count_m == c - 1:\n l = l = l[count_m + 1:]\n count += 1\n \n except IndexError:\n print(count)\n exit()\n\nprint(count)', 'n, c, k = map(int, input().split())\nt = sorted([int(input()) for _ in range(n)])\nans = 1\npassenger = 0\nlimit = t[0] + k\n \nfor p in t:\n if passenger < c and p <= limit:\n passenger += 1\n else:\n ans += 1\n passenger = 1\n limit = p + k\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s196557473', 's241807964'] | [13564.0, 13996.0] | [2206.0, 174.0] | [511, 275] |
p03785 | u191423660 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['def solve():\n\n N, C, K = map(int, input().split())\n T = [int(input()) for i in range(N)]\n\n T = sorted(T)\n i = 0\n k = 0\n\n ans = 0\n\n print(T)\n\n while i < N:\n n = 0\n while k < N and n < C and T[i] <= T[k] <= T[i]+K:\n n += 1\n k += 1\n if n == C:\n ans += 1\n break\n\n if n != C:\n ans += 1\n\n i = k\n\n\n\n print(ans) \n\n\nif __name__ == "__main__":\n solve()\n', 'def solve():\n\n N, C, K = map(int, input().split())\n T = [int(input()) for i in range(N)]\n\n T = sorted(T)\n i = 0\n k = 0\n\n ans = 0\n\n #print(T)\n\n while i < N:\n n = 0\n while k < N and n < C and T[i] <= T[k] <= T[i]+K:\n n += 1\n k += 1\n if n == C:\n ans += 1\n break\n\n if n != C:\n ans += 1\n\n i = k\n\n\n\n print(ans) \n\n\nif __name__ == "__main__":\n solve()\n'] | ['Wrong Answer', 'Accepted'] | ['s859989336', 's397240002'] | [15984.0, 14092.0] | [205.0, 194.0] | [486, 487] |
p03785 | u193927973 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N, C, K=map(int, input().split())\nX=[]\nfor _ in range(N):\n X.append(int(input()))\nX.sort()\nX.append(10**19)\nans=0\ntamatta=0\nhayaihito=X[0]\nfor i in range(N):\n if tamatta<C and hayaihito+K>=X[i+1]:\n tamatta+=1\n else:\n tamatta=0\n hayaihito=X[i+1]\n ans+=1\nprint(ans)', 'N, C, K=map(int, input().split())\nX=[]\nfor _ in range(N):\n X.append(int(input()))\nX.sort()\nX.append(10**19)\nans=0\ntamatta=0\nhayaihito=X[0]\nfor i in range(N+1):\n if tamatta<C and hayaihito+K>=X[i]:\n tamatta+=1\n else:\n ans+=1\n tamatta=1\n hayaihito=X[i]\n \nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s176020190', 's910548346'] | [13216.0, 13272.0] | [196.0, 195.0] | [278, 281] |
p03785 | u202634017 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['n,c,k = map(int,input().split())\nt = []\ncnt,ans = 0,0\nbt = 10**10\nbtl = []\nfor i in range(n):\n t.append(int(input()))\n\nt.sort()\n\nfor i in range(n):\n if (t[i] >= bt)&(cnt == c):\n ans += 1\n cnt,bt = 0,10**10\n if (bt == 10**10):\n bt = t[i]+k\n cnt += 1\n else:\n cnt += 1\n \nif (cnt != 0):\n ans += 1\n\nprint(ans)', 'n,c,k = map(int,input().split())\nt = []\ncnt,ans = 0,0\nbt = 10**10\nbtl = []\nfor i in range(n):\n t.append(int(input()))\n\nt.sort()\n\nfor i in range(n):\n if (t[i] >= bt):\n ans += 1\n btl.append(bt)\n cnt,bt = 0,10**10\n if (bt == 10**10):\n bt = t[i]+k\n cnt += 1\n else:\n cnt += 1\n if (cnt == c):\n btl.append(t[i])\n ans += 1\n cnt,bt = 0,10**9+1\n\nif (cnt != 0):\n ans += 1\n\nprint(ans)', 'n,c,k = map(int,input().split())\nt = []\ncnt,ans = 0,0\nbt = 10**10\nbtl = []\nfor i in range(n):\n t.append(int(input()))\n\nt.sort()\n\nfor i in range(n):\n if (t[i] > bt)|(cnt == c):\n ans += 1\n cnt,bt = 0,10**10\n if (bt == 10**10):\n bt = t[i]+k\n cnt += 1\n else:\n cnt += 1\n \nif (cnt != 0):\n ans += 1\n\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s031180184', 's248076085', 's943578966'] | [7384.0, 11212.0, 7388.0] | [249.0, 275.0, 272.0] | [361, 453, 360] |
p03785 | u210827208 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['n,c,k=map(int,input().split())\n\nx=[]\nfor i in range(n):\n x.append(int(input()))\n \n \nx.sort()\n\ncount=1\n\nbus_count=0\n\nfor j in range(n-1):\n bus_count+=1\n if(x[j]+k<=x[j+1] or bus_count==c):\n count+=1\n bus_count=0\n ', 'n,c,k=map(int,input().split())\n\nx=[]\nfor i in range(n):\n x.append(int(input()))\n \n \nx.sort()\n\ncount=1\n\nbus_count=0\n\nfor j in range(n-1):\n bus_count+=1\n if(x[j]+k<x[j+1] or bus_count==c):\n count+=1\n bus_count=0\n ', 'n,c,k=map(int,input().split())\n\nx=[]\nfor i in range(n):\n x.append(int(input()))\n \n \nx.sort()\n\ncount=1\n\nbus_count=0\n\nfor j in range(n-1):\n bus_count+=1\n if(x[j+1-bus_count]+k<x[j+1] or bus_count==c):\n count+=1\n bus_count=0\n \nprint(count)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s416061352', 's751290479', 's037518023'] | [7384.0, 7444.0, 7384.0] | [258.0, 258.0, 267.0] | [252, 251, 276] |
p03785 | u213854484 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N,C,K = map(int,input().split())\nT = []\nfor i in range(N):\n L.append(int(input()))\n \nans = 1\nT = sorted(T)\nind = 0\n\nfor i in range(T):\n if T[i] > T[ind]+K:\n ans += 1\n ind = i\n elif i >= ind + C:\n ans += 1\n ind = i\n \nprint(ans)', 'N,C,K = map(int,input().split())\nT = []\nfor i in range(N):\n T.append(int(input()))\n \nans = 1\nT = sorted(T)\nind = 0\n\nfor i in range(T):\n if T[i] > T[ind]+K:\n ans += 1\n ind = i\n elif i >= ind + C:\n ans += 1\n ind = i\n \nprint(ans)', 'N,C,K=map(int,input().split())\nT=[]\nfor i in range(N):\n p=int(input())\n T.append(p)\n \nans = 1\nT = sorted(T)\nind = 0\n \nfor i in range(len(T)):\n if T[i] > T[ind]+K:\n ans += 1\n ind = i\n elif i >= ind + C:\n ans += 1', 'N,C,K = map(int, input().split())\nT = [int(input()) for i in range(N)]\n\n \nans = 1\nT = sorted(T)\nind = 0\n\nfor i in range(T):\n if T[i] > T[ind]+K:\n ans += 1\n ind = i\n elif i >= ind + C:\n ans += 1\n ind = i\n \nprint(ans)', 'N,C,K=map(int,input().split())\nT=[]\nfor i in range(N):\n p=int(input())\n T.append(p)\n \nans = 1\nT = sorted(T)\nind = 0\n\nfor i in range(T):\n if T[i] > T[ind]+K:\n ans += 1\n ind = i\n elif i >= ind + C:\n ans += 1\n ind = i\n \nprint(ans)', 'N,C,K=map(int,input().split())\nT=[]\nfor i in range(N):\n p=int(input())\n T.append(p)\n \nans = 1\nT = sorted(T)\nind = 0\n \nfor i in range(len(T)):\n if T[i] > T[ind]+K:\n ans += 1\n ind = i\n elif i >= ind + C:\n ans += 1\n ind = i\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s229734386', 's656929293', 's738285414', 's910330106', 's948621944', 's663543525'] | [3064.0, 8280.0, 8280.0, 8276.0, 8280.0, 8280.0] | [17.0, 222.0, 255.0, 208.0, 224.0, 248.0] | [265, 265, 245, 253, 271, 272] |
p03785 | u215315599 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N,C,K = map(int,input().split())\nT = [int(input()) for _ in range(N)]\nT.sort()\ntime = T.pop(0)+K\npeople = 1\nans = 1\nfor t in T:\n if t <= time and people < C:\n people += 1\n else:\n if people == C:\n time += t\n else:\n time += K\n people = 0\n ans += 1\nprint(ans)', 'N,C,K = map(int,input().split())\nT = [int(input()) for _ in range(N)]\nT.sort()\ntime = T.pop(0)\npeople = 1\nans = 1\nfor t in T:\n if t <= time + K and people < C:\n people += 1\n else:\n time = t\n people = 1\n ans += 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s350356796', 's558713890'] | [7384.0, 7488.0] | [237.0, 232.0] | [319, 256] |
p03785 | u223646582 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N,C,K=map(int,input().split())\nT=sorted([int(input()) for _ in range(N)])\n\nans=0\nc=0\nt=0\n\nfor i in range(N):\n if c==C or T[i]>t+K:\n ans+=1\n c=0\n\n if c==0:\n t=T[i]\n\n c+=1\n\nif c>=2:\n print(ans+1)\nelse:\n print(ans)\n', 'N,C,K=map(int,input().split())\nT=sorted([int(input()) for _ in range(N)]) + [10000000]\n\nans=0\nc=0\nt=0\n\nfor i in range(N):\n if c==0:\n ans+=1\n t=T[i]\n\n c+=1\n\n if c==C or T[i+1]>t+K:\n c=0\n\nprint(ans)\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s747972721', 's368701497'] | [8280.0, 8280.0] | [258.0, 258.0] | [248, 229] |
p03785 | u226108478 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ["# -*- coding: utf-8 -*-\n\n\ndef main():\n n, c, k = list(map(int, input().split()))\n t = [0] * n\n\n for i in range(n):\n ti = int(input())\n t[i] = (ti, ti + k)\n\n sorted_t = sorted(t, key=lambda x: x[1])\n current_pos = sorted_t[0][1]\n remain = c - 1\n bus_count = 1\n\n for i in range(1, n):\n if remain >= 1 and current_pos <= sorted_t[i][1]:\n remain -= 1\n else:\n bus_count += 1\n current_pos = sorted_t[i][1]\n remain = c - 1\n\n print(bus_count)\n\n\nif __name__ == '__main__':\n main()\n", "# -*- coding: utf-8 -*-\n\n\ndef main():\n n, c, k = list(map(int, input().split()))\n t = [0] * n\n\n for i in range(n):\n ti = int(input())\n t[i] = (ti, ti + k)\n\n sorted_t = sorted(t, key=lambda x: x[1])\n pos = sorted_t[0][1]\n remain = c - 1\n bus_count = 1\n\n for i in range(1, n):\n if remain >= 1 and sorted_t[i][0] <= pos:\n remain -= 1\n else:\n bus_count += 1\n pos = sorted_t[i][1]\n remain = c - 1\n\n print(bus_count)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s507246973', 's677426115'] | [19032.0, 19032.0] | [279.0, 282.0] | [574, 550] |
p03785 | u233437481 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N,C,K = [int(s) for s in input().split()]\nT = []\nfor i in range(N):\n T.append(int(input()))\nT.sort()\n\npas = 0\nleave = T[0]\nans = 1\n\nfor t in T:\n if pas == C and K < t - leave:\n pas += 1\n else:\n leave = t\n ans += 1\n pas = 0\nprint(ans)', 'N,C,K = [int(s) for s in input().split()]\nT = []\nfor i in range(N):\n T.append(int(input()))\nT.sort()\n \npas = 0\nleave = T[0]\nans = 1\n \nfor t in T:\n if pas == C or K < t - leave:\n leave = t\n ans += 1\n pas = 0\n pas += 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s295072750', 's522958967'] | [7384.0, 7488.0] | [238.0, 247.0] | [270, 257] |
p03785 | u255898796 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['a = [int(s) for s in input().split()]\nN = a[0]\nsi = a[1]\nti = a[2]\ns = [int(input()) for i in range(N)]\ns = sorted(s)\nX = int(0)\nans = int(0)\n\n\nwhile N != X:\n \n X += 1 \n ans += 1\n \n if N == X:\n break\n \n \n print(N-X)\n temp = X\n for i in range(min([si-1,N-X])):\n if s[temp + i] <= s[temp-1] + ti:\n X += 1\n else:\n break\n\nprint(ans)', 'a = [int(s) for s in input().split()]\nN = a[0]\nsi = a[1]\nti = a[2]\ns = [int(input()) for i in range(N)]\ns = sorted(s)\nX = int(0)\nans = int(0)\n\n\nwhile N != X:\n \n X += 1 \n ans += 1\n \n if N == X:\n break\n \n \n temp = X\n for i in range(min([si-1,N-X])):\n if s[temp + i] <= s[temp-1] + ti:\n X += 1\n else:\n break\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s541478282', 's620673609'] | [14056.0, 14080.0] | [285.0, 241.0] | [654, 639] |
p03785 | u277429554 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['n = int(input())\nl = list(map(int,input().split()))\nl.sort(reverse=True)\nans = 1\nnum = sum(l)\nfor i in range(0,n-1):\n num -= l[i]\n if num*2<l[i]:\n break\n ans += 1\nprint(ans)', 'n = int(input())\na = sorted(list(map(int, input().split())))\n \nans = -1\nfor i in range(n-1):\n if a[i]*2 < a[i+1]:\n ans = i\n a[i+1] += a[i]\nprint(n-ans-1)', 'n, c, k = map(int, input().split())\nT = [0] * n\nfor i in range(n):\n T[i] = int(input())\n \nT.sort()\nans, s, m = 0, 0, 0\n\nfor t in T:\n if m == 0:\n s = t\n m = 1\n ans += 1\n else:\n if t <= s + k:\n m += 1\n else:\n s = t\n m = 1\n ans += 1\n if m == c:\n m = 0\n \nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s443578483', 's837256506', 's737232870'] | [9116.0, 9084.0, 13288.0] | [24.0, 27.0, 187.0] | [189, 166, 359] |
p03785 | u292810930 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N, C, K = map(int, input().split())\nT = [int(input()) for i in range(N)]\nT.sort()\nanswer = 0\nwhile len(T) >0:\n limit = T[0] + K\n counter = 0\n while counter < C:\n if len(T) == 0:\n break\n t = T.pop(0)\n if t > limit:\n break\n counter += 1\n answer += 1\nprint(answer)\n', 'N, C, K = map(int, input().split())\nT = [int(input()) for i in range(N)]\nT.sort()\nanswer = 0\nwhile len(T) >\u30000:\n limit = T[0] + K\n counter = 0\n while counter < C:\n if len(T) == 0:\n break\n if T[0] > limit:\n break\n del T[0]\n counter += 1\n answer += 1\nprint(answer)', 'N, C, K = map(int, input().split())\nT = [int(input()) for i in range(N)]\nT.sort()\nlimit = T[0]\nanswer = 1\ncounter = 1\nfor i in range(1,N):\n if T[i] - limit > K or counter == C:\n limit = T[i]\n counter = 1\n answer += 1\n else:\n counter += 1\nprint(answer)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s089920162', 's954110942', 's341685076'] | [7420.0, 3188.0, 7384.0] | [1779.0, 19.0, 234.0] | [324, 325, 285] |
p03785 | u293579463 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['N, C, K = map(int, input().split())\nT = [int(input()) for _ in range(N)]\nfirst = 0\nsum_v = 0\ncount = 0\nd = {}\n\nfor t in T:\n print("t", t)\n if t in d:\n d[t] += 1\n else:\n d[t] = 1\nd = sorted(d.items())\n\nfor i in range(len(d)):\n\n if K <= d[i][0] - first and first != 0:\n \n first = 0\n sum_v = 0\n count += 1\n\n if first == 0:\n \n first = d[i][0]\n sum_v += d[i][1]\n else:\n \n sum_v += d[i][1]\n \n if sum_v >= C:\n \n count += sum_v // C\n sum_v = sum_v % C\n first = 0\n\nif sum_v != 0:\n \n count += 1\n\nprint(count)\n', 'N, C, K = map(int, input().split())\nT = [int(input()) for _ in range(N)]\ntime = 0\npassenger = 0\ncount = 0\n\nT.sort()\n\nfor t in T:\n\n if passenger == 0:\n \n time = t\n passenger = 1\n count += 1\n\n \n elif 1 <= passenger < C:\n if t - time <= K:\n \n passenger += 1\n else: \n \n count += 1\n passenger = 1\n time = t\n \n \n else:\n \n count += 1\n passenger = 1\n time = t\n \nprint(count)\n'] | ['Wrong Answer', 'Accepted'] | ['s863839183', 's380507962'] | [21864.0, 7508.0] | [479.0, 243.0] | [894, 872] |
p03785 | u306950978 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['n , c , k = map(int,input().split())\nt = [int(input()) for i in range(n)]\nt.sort()\n\nans = 0\ncou = 0\nlim = 0\nprint(t)\nfor i in range(n):\n if lim == 0:\n lim = t[i] + k\n cou = 1\n if c == 1:\n lim = 0\n cou = 0\n ans += 1\n elif lim > t[i]:\n if cou == c - 1:\n ans += 1\n cou = 0\n lim = 0\n elif cou < c - 1:\n cou += 1\n elif lim == t[i]:\n ans += 1\n cou = 0\n lim = 0\n elif lim < t[i]:\n ans += 1\n cou = 1\n lim = t[i] + k\n\nif cou > 0:\n ans += 1\n\nprint(ans)', 'n , c , k = map(int,input().split())\nt = [int(input()) for i in range(n)]\nt.sort()\n\nans = 0\ncou = 0\nlim = 0\n\nfor i in range(n):\n if lim == 0:\n lim = t[i] + k\n cou = 1\n if c == 1:\n lim = 0\n cou = 0\n ans += 1\n elif lim > t[i]:\n if cou == c - 1:\n ans += 1\n cou = 0\n lim = 0\n elif cou < c - 1:\n cou += 1\n elif lim == t[i]:\n ans += 1\n cou = 0\n lim = 0\n elif lim < t[i]:\n ans += 1\n cou = 1\n lim = t[i] + k\n\nif cou > 0:\n ans += 1\n\nprint(ans)\n '] | ['Wrong Answer', 'Accepted'] | ['s045952493', 's166150907'] | [10444.0, 7512.0] | [261.0, 263.0] | [611, 612] |
p03785 | u314089899 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['from collections import deque\n\nN,C,K = map(int, input().split())\n\nT_list = list() \n\nfor i in range(N):\n T = int(input())\n T_list.append(T)\n\nT_list.sort(reverse=False)\n\nwaiting_deque = deque(T_list)\nans = 0\n\nwhile 1:\n if len(waiting_deque) != 0:\n ans += 1\n bus_passenger = list()\n bus_passenger.append(waiting_deque.popleft())\n while 1:\n if len(waiting_deque)!=0 and len(bus_passenger) < C and bus_passenger[0] + K => waiting_deque[0]:\n bus_passenger.append(waiting_deque.popleft())\n else:\n \n break\n else:\n break\n\nprint(ans)', 'from collections import deque\n\nN,C,K = map(int, input().split())\n\nT_list = list() \n\nfor i in range(N):\n T = int(input())\n T_list.append(T)\n\nT_list.sort(reverse=False)\n\nwaiting_deque = deque(T_list)\nans = 0\n\nwhile 1:\n if len(waiting_deque) != 0:\n ans += 1\n bus_passenger = list()\n bus_passenger.append(waiting_deque.popleft())\n while 1:\n if len(waiting_deque)!=0 and len(bus_passenger) < C and bus_passenger[0] + K > waiting_deque[0]:\n bus_passenger.append(waiting_deque.popleft())\n else:\n print(bus_passenger)\n break\n else:\n break\n\nprint(ans)', 'from collections import deque\n\nN,C,K = map(int, input().split())\n\nT_list = list() \n\nfor i in range(N):\n T = int(input())\n T_list.append(T)\n\nT_list.sort(reverse=False)\n\nwaiting_deque = deque(T_list)\nans = 0\n\nwhile 1:\n if len(waiting_deque) != 0:\n ans += 1\n bus_passenger = list()\n bus_passenger.append(waiting_deque.popleft())\n while 1:\n if len(waiting_deque)!=0 and len(bus_passenger) < C and bus_passenger[0] + K >= waiting_deque[0]:\n bus_passenger.append(waiting_deque.popleft())\n else:\n \n break\n else:\n break\n\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s543842657', 's644964550', 's745072168'] | [2940.0, 9476.0, 8120.0] | [17.0, 411.0, 306.0] | [695, 693, 695] |
p03785 | u321035578 | 2,000 | 262,144 | Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport. Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane. For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive). When setting the departure times for buses under this condition, find the minimum required number of buses. Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time. | ['from collections import deque\nn,c,k = map(int,input().split())\nt = []\nfor _ in range(n):\n tt = int(input())\n t.append(tt)\nt.sort()\nans = deque([])\ncnt = 0\nfor i, tt in enumerate(t):\n if i == 0:\n ans.append([tt+k,1])\n cnt += 1\n else:\n flg = False\n for i in range(len(ans)):\n tmp = ans.popleft()\n if tmp[0] < tt or tmp[1] == c:\n\n continue\n else:\n flg = True\n break\n if flg :\n tmp[1] += 1\n if tmp[1] != c:\n a.append(tmp)\n ans.appendleft(tmp)\n else:\n tmp = [tt+k,1]\n ans.append(tmp)\n cnt += 1\nprint(cnt)\n', 'from collections import deque\nn,c,k = map(int,input().split())\nt = []\nfor _ in range(n):\n tt = int(input())\n t.append(tt)\nt.sort()\nans = deque([])\ncnt = 0\nfor i, tt in enumerate(t):\n if i == 0:\n ans.append([tt+k,1])\n cnt += 1\n else:\n flg = False\n for i in range(len(ans)):\n tmp = ans.popleft()\n if tmp[0] < tt or tmp[1] == c:\n\n continue\n else:\n flg = True\n break\n if flg :\n tmp[1] += 1\n if tmp[1] != c:\n ans.appendleft(tmp)\n else:\n tmp = [tt+k,1]\n ans.append(tmp)\n cnt += 1\nprint(cnt)\n'] | ['Runtime Error', 'Accepted'] | ['s808761309', 's721877411'] | [7744.0, 7744.0] | [313.0, 343.0] | [717, 687] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.