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
|
---|---|---|---|---|---|---|---|---|---|---|
p02696 | u932868243 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,n=map(int,input().split())\nif b==0:\n print(0)\nelse:\n print(int(a*(b-1)/b)-a*int((b-1)/b))', 'a,b,n=map(int(input().split())\nif b-1<=n:\n x=b-1\n print(int(a*x/b)-a*int(x/b))\nelse:\n x=n\n print(int(a*x/b)-a*int(x/b))\n\n \n ', 'a,b,n=map(int,input().split())\nprint(int(a*(b-1)/b)-a*int((b-1)/b))', 'a,b,n=map(int,input().split())\nif b==1:\n print(0)\nelse:\n print(int(a*(b-1)/b)-a*int((b-1)/b))', 'a,b,n=map(int,input().split())\nif b-1<=n:\n x=b-1\n print(int(a*x/b)-a*int(x/b))\nelse:\n x=n\n print(int(a*x/b)-a*int(x/b))\n \n '] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s082733786', 's416790287', 's720624131', 's804143059', 's751469014'] | [9156.0, 9020.0, 9128.0, 9100.0, 9108.0] | [23.0, 25.0, 23.0, 20.0, 21.0] | [95, 146, 67, 95, 136] |
p02696 | u935642171 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ["a,b,n = map(int, input().split())\nans = 0\n\nyuka = lambda a,b: (a-(a%b))//b\n\nc = yuka(a,b)\n'''\nfor x in range(b):\n score = (x%b)*c\n ans = max(ans,score)\n'''\nans = (b-1)*c\nprint(ans)", 'a,b,n = map(int, input().split())\nyuka = lambda a,b: (a-(a%b))//b\n\nx = min(n,b-1)\nscore = yuka(a*(x%b),b)\nans = score\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s992686526', 's043557076'] | [9108.0, 9112.0] | [24.0, 24.0] | [182, 129] |
p02696 | u937642029 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import sys, bisect, math, itertools, string, queue, copy\n# import numpy as np\n\nfrom collections import Counter,defaultdict,deque\nfrom itertools import permutations, combinations\nfrom heapq import heappop, heappush\nfrom fractions import gcd\n# input = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\ndef inp(): return int(input())\ndef inpm(): return map(int,input().split())\ndef inpl(): return list(map(int, input().split()))\ndef inpls(): return list(input().split())\ndef inplm(n): return list(int(input()) for _ in range(n))\ndef inplL(n): return [list(input()) for _ in range(n)]\ndef inplT(n): return [tuple(input()) for _ in range(n)]\ndef inpll(n): return [list(map(int, input().split())) for _ in range(n)]\ndef inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])\n\ndef main():\n a,b,n = inpm()\n print(max(int(a*(b-1)/b),int(a*n/b)))\n\nif __name__ == "__main__":\n main()', 'import sys, bisect, math, itertools, string, queue, copy\n# import numpy as np\n\nfrom collections import Counter,defaultdict,deque\nfrom itertools import permutations, combinations\nfrom heapq import heappop, heappush\nfrom fractions import gcd\n# input = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\ndef inp(): return int(input())\ndef inpm(): return map(int,input().split())\ndef inpl(): return list(map(int, input().split()))\ndef inpls(): return list(input().split())\ndef inplm(n): return list(int(input()) for _ in range(n))\ndef inplL(n): return [list(input()) for _ in range(n)]\ndef inplT(n): return [tuple(input()) for _ in range(n)]\ndef inpll(n): return [list(map(int, input().split())) for _ in range(n)]\ndef inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])\n\ndef main():\n a,b,n = inpm()\n ans = 0\n for i in range(min(b+1,n+1)):\n ans = max(ans,int(a*i/b)-a*int(i/b))\n print(ans)\n\nif __name__ == "__main__":\n main()', 'import sys, bisect, math, itertools, string, queue, copy\n# import numpy as np\n\nfrom collections import Counter,defaultdict,deque\nfrom itertools import permutations, combinations\nfrom heapq import heappop, heappush\nfrom fractions import gcd\n# input = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\ndef inp(): return int(input())\ndef inpm(): return map(int,input().split())\ndef inpl(): return list(map(int, input().split()))\ndef inpls(): return list(input().split())\ndef inplm(n): return list(int(input()) for _ in range(n))\ndef inplL(n): return [list(input()) for _ in range(n)]\ndef inplT(n): return [tuple(input()) for _ in range(n)]\ndef inpll(n): return [list(map(int, input().split())) for _ in range(n)]\ndef inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])\n\ndef main():\n a,b,n = inpm()\n ans = 0\n for i in range(min(10**6+10,n+1)):\n ans = max(ans,int(a*i/b)-a*int(i/b))\n print(ans)\n\nif __name__ == "__main__":\n main()', 'def main():\n a,b,n = map(int,input().split())\n print(int(a*min((b-1),n)/b) - a*int(min((b-1),n)/b))\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s382560916', 's467110449', 's660974840', 's846393840'] | [10832.0, 10716.0, 10856.0, 9068.0] | [33.0, 2206.0, 438.0, 20.0] | [930, 994, 999, 144] |
p02696 | u938350027 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\nA, B, N = map(int,input().split(\' \'))\n\ndef f(x):\n print(math.floor(A*x/B), A*math.floor(x/B))\n return math.floor(A*x/B)-A*math.floor(x/B)\n\n\ndef main():\n \n ans = 0\n i = 0\n while B > i and i <= N:\n fi = f(i)\n ans = f(i) if ans < fi else ans\n i += 1 \n \n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'import math\nA, B, N = map(int,input().split(\' \'))\n\ndef f(x):\n return math.floor(A*x/B)-A*math.floor(x/B)\n\n\ndef main():\n if N >= B:\n print(f(B-1))\n else:\n print(f(N))\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s533083495', 's279312864'] | [10900.0, 9072.0] | [2217.0, 20.0] | [359, 228] |
p02696 | u940780117 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\nA,B,N=map(float,input().split())\nif N = B:\n N = N-1\nans = math.floor((A*N/B)) - A*math.floor(N/B)\nprint(int(ans))', 'A,B,N=map(int,input().split())\nif B==1 or A==1:\n ans = 0\nelif A==10**6 and B ==10**12\n ans = 10**6\nelse:\n while N%B==0:\n N = N-1\n ans = (A*N)//B - A*(N//B)\nprint(ans)', 'A,B,N=map(float,input().split())\nif B==1 or A==1:\n ans = 0\nelse:\n while N%B==0:\n N = N-1\n ans = (A*N)//B - A*(N//B)\nprint(ans)', 'import math\nA,B,N=map(int,input().split())\nif N >= B:\n N = B-1\nans = math.floor(A*N/B) - A*math.floor(N/B)\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s637462976', 's710186743', 's868047670', 's111115907'] | [8940.0, 8956.0, 9004.0, 9060.0] | [19.0, 24.0, 22.0, 23.0] | [128, 185, 142, 121] |
p02696 | u941022948 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,c=map(int,input().split())\nif c+1>=b:\n ans=int(a*(b-1)/b)\nelse:\n ans=(a*c/b)\nprint(ans)', 'a,b,c=map(int,input().split())\nif c+1>=b:\n ans=int(a*(b-1)/b)\nelse:\n ans=int(a*c/b)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s922146621', 's385754834'] | [9168.0, 8980.0] | [23.0, 22.0] | [97, 100] |
p02696 | u944325914 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,n=map(int,input().split())\nimport math\nif b==1:\n print(0)\nelse:\n print(math.floor(a*(b-1)/b))', 'a,b,n=map(int,input().split())\nimport math\nprint(math.floor(a*(b-1)/b))', 'a,b,n=map(int,input().split())\nimport math\nprint(math.floor(a*(min(n,(b-1)))/b))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s134642727', 's678702791', 's071361757'] | [9108.0, 9040.0, 9068.0] | [26.0, 26.0, 30.0] | [99, 71, 80] |
p02696 | u947047288 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math \nA, B, N = map(int, input().split())\n\n# A, B, N = 11, 10, 9\n\nmaxR = -1\nmaxX = 0\nfor x in range(0, N+1):\n R = math.floor(A*x/B) - A * math.floor(x/B)\n if R >= maxR:\n maxR = R\n maxX = x\nprint (maxX)', 'import math \nA, B, N = map(int, input().split())\n\n# A, B, N = 11, 10, 9\n\nmaxR = -1\nmaxX = 0\nfor x in range(1, N+1):\n R = math.floor(A*x/B) - A * math.floor(x/B)\n if R > maxR:\n maxR = R\n maxX = x\nprint (maxX)', 'import math \nA, B, N = map(int, input().split())\n\n# A, B, N = 11, 10, 9\n\nmaxR = -1\nmaxX = 0\nfor x in range(1, N+1):\n R = math.floor(A*x/B) - A * math.floor(x/B)\n if R >= maxR:\n maxR = R\n maxX = x\nprint (maxX)', 'import math \nA, B, N = map(int, input().split())\n\n# A, B, N = 11, 10, 9\nT = N//B\nmaxR = -1\nmaxT = 0\n# for x in range(1, T+2):\n # t = min(x*B-1,N)\n \n # if R >= maxR:\n # maxR = R\n # maxT = t\nt = min(B-1,N)\nmaxR = math.floor(A*t/B) - A * math.floor(t/B)\nprint (maxR)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s294451783', 's409238687', 's901809464', 's685974266'] | [9188.0, 9184.0, 9140.0, 9088.0] | [2205.0, 2205.0, 2205.0, 21.0] | [282, 281, 282, 385] |
p02696 | u948521599 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['A,B,N = map(int,input().split())\nmaxn =0\nif A<B:\n if B/2 <N:\n t = math.ceil(B/2)-1\n ans = tmp = math.floor((A*t)/B)-A*(math.floor(t/B))\n else:\n ans = tmp = math.floor((A*N)/B)-A*(math.floor(N/B))\nelse:\n for x in range(1,B+1):\n tmp = math.floor((A*x)/B)-A*(math.floor(x/B))\n if maxn < tmp:\n maxn = tmp\n ans =maxn\nprint(ans)', 'import math\nA,B,N = map(int,input().split())\nmaxn = 0\nsec =False\nfor x in range(1,N+1):\n tmp = math.floor((A*x)/B)-A*(math.floor(x/B))\n print(tmp)\n if maxn < tmp:\n maxn = tmp\n if tmp == 0:\n if sec ==True:\n break\n else:\n sec =True\n \nprint(maxn)', 'import math\nA,B,N = map(int,input().split())\ns = min(B-1,N)\nprint(math.floor((A*s)/B)-A*(math.floor(s/B)))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s250451109', 's432195271', 's063269233'] | [9144.0, 9228.0, 9164.0] | [19.0, 27.0, 22.0] | [380, 301, 106] |
p02696 | u952669998 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['A,B,N = list(map(int,input().split()))\n\ndef f(n):\n d = int(A*n/B) - A*int(n/B)\n return d\n\nif N < B==0:\n ans = int(A*N/B)\nelse:\n ans = A-1', 'A,B,N = list(map(int,input().split()))\n\ndef f(n):\n d = int(A*n/B) - A*int(n/B)\n return d\n\nprint(f(min(B-1,N)))\n'] | ['Wrong Answer', 'Accepted'] | ['s977759373', 's634325018'] | [9172.0, 9136.0] | [23.0, 20.0] | [149, 117] |
p02696 | u952968889 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\na, b, n = map(int, input().split())\nif b>n:\n print(math.floor(a*n/b))\nelse:\n \tx = b-1\n print(math.floor(a*x/b))', 'import math\na, b, n = map(int, input().split())\nif b>n:\n print(math.floor(a*n/b))\nelse:\n x = b-1\n print(math.floor(a*x/b))'] | ['Runtime Error', 'Accepted'] | ['s800140376', 's432837071'] | [9028.0, 9112.0] | [21.0, 23.0] | [130, 131] |
p02696 | u953379577 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a , b , n = map(int,input().split())\nx = n - 1\nprint(int((a*x)/b)-a*(x/b))', 'a , b , n = map(int,input().split())\nx = b - 1\n\ndef fnc(x):\n return int((a*x)/b)-a*int((x/b))\n\nans = []\n\nfor i in range(x):\n ans.append(fnc(i))\n\nprint(max(ans))', 'a,b,n = map(int,input().split())\nx = min(b-1,n)\nprint(int(a*x/b)-a*int(x/b))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s452846390', 's706503790', 's149223229'] | [9020.0, 50280.0, 8992.0] | [22.0, 2207.0, 25.0] | [74, 166, 76] |
p02696 | u955474478 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a, b, n = map(int, input().split())\nans1 = 0\nfor i in range(n+1):\n ans2 = int(a * i / b) - a * int(i / b)\n ans1 = max(ans1, ans2)\n if ans1 == ans2:\n x = i\nprint(x)', 'a, b, n = map(int, input().split())\nif b > n:\n x = n\nelse:\n x = b - 1\nprint(int(a * x / b) - a * int(x / b))'] | ['Wrong Answer', 'Accepted'] | ['s964040635', 's150091794'] | [9084.0, 9168.0] | [2206.0, 22.0] | [169, 110] |
p02696 | u957198490 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['A,B,X = map(int,input().split())\nprint(min(B-1,N))', 'A,B,N = map(int,input().split())\nx = min(B-1,N)\nans = int(A*x/B) - A*int(x/B)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s995755901', 's886066994'] | [9056.0, 9168.0] | [20.0, 20.0] | [50, 88] |
p02696 | u961945062 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\nA, B, N = map(int, input().split())\n\nd = 0\nans = 0\nfor i in range(1, N+1):\n d = math.floor((A*i)/B) - A*math.floor(i/B)\n if ans <= d:\n ans = d\n else:\n print(ans)\n exit()\n', 'import math\n\nA, B, N = map(int, input().split())\nprint(math.floor((A * min(B-1, N)) / B) - A * math.floor(min(B-1, N) / B))'] | ['Wrong Answer', 'Accepted'] | ['s492008238', 's621993831'] | [9112.0, 9108.0] | [2205.0, 25.0] | [212, 123] |
p02696 | u969211566 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,n = map(int,input().split())\ni = max(b-1,n)\nans = a*i//b - a*(i//b)\nprint(ans)', 'a,b,n = map(int,input().split())\nans = 0\n\nif a <= n:\n print(a-1)\nelse:\n for i in range(n+1,n-a,-1):\n ans = max(ans,(a*i)//b - a*(i//b))\n print(ans)', 'a,b,n = map(int,input().split())\nans = 0\n \nfor i in range(n+1,n-4*a,-1):\n ans = max(ans,(a*i)//b - a*(i//b))\n \nprint(ans)', '\n\na,b,n = map(int,input().split())\nans = 0\n\nfor i in range(n+1,n-a,-1):\n ans = max(ans,(a*i)//b - a*(i//b))\n\nprint(ans)', '\n\na,b,n = map(int,input().split())\nans = 0\n\nfor i in range(n+1,n-10*a,-1):\n ans = max(ans,(a*i)//b - a*(i//b))\n\nprint(ans)', '\n\na,b,n = map(int,input().split())\nans = 0\n\nfor i in range(n+1,n-a,-1):\n ans = max(ans,(a*i)//b) - a*(i//b))\n\nprint(ans)', 'a,b,n = map(int,input().split())\nans = 0\n\n\nfor i in range(2*a):\n ans = max(ans,int((a*i)/b) - a*int(i/b))\n\nprint(ans)', '\n\na,b,n = map(int,input().split())\nans = 0\nround=lambda x:(x*2+1)//2\n\nfor i in range(2*a):\n ans = max(ans,round((a*i)/b) - a * round(i/b))\n\nprint(ans)', 'a,b,n = map(int,input().split())\nans = 0\n \nfor i in range(n+1,n-2*a,-1):\n ans = max(ans,(a*i)//b - a*(i//b))\n \nprint(ans)', 'a,b,n = map(int,input().split())\ni = min(b-1,n)\nans = a*i//b - a*(i//b)\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s082639839', 's139161861', 's223749601', 's264855886', 's505684510', 's556380317', 's787453119', 's799474735', 's806905728', 's406858259'] | [8912.0, 9028.0, 9176.0, 9176.0, 9180.0, 9024.0, 9052.0, 9088.0, 9176.0, 9120.0] | [20.0, 34.0, 1903.0, 494.0, 2205.0, 21.0, 1090.0, 1819.0, 1027.0, 22.0] | [82, 163, 124, 122, 125, 123, 151, 184, 124, 82] |
p02696 | u970133396 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['n, m, q = map(int, input().strip().split())\nL = [list(map(int, input().split())) for _ in range(q)]\n\npossibleA=[[i]*n for i in range(1,m+1)]\nfor i in range(n):\n for j in range(i+1,m+1):\n \n\nimport math\na, b, n = map(int, input().strip().split())\nif b<n:\n x=n\nelif n % b <= n%(b/a):\n x=n-n%b-1\nelif (n%b-n%(b/a)+1)//(b/a)>a*b:\n x=n-n%b-1\nelse:\n x=n\nprint(math.floor(a*x/b)-a*math.floor(x/b))', 'import math\na, b, n = map(int, input().strip().split())\nif b<n:\n x=n\nelif (n % b - n%(b/a)+1)//(b/a)+1<a:\n x=n-n%b-1\n# elif (n%b-n%(b/a)+1)<a:\n# x=n-n%b-1\nelse:\n x=n\nprint(math.floor(a*x/b)-a*math.floor(x/b))', 'import math\na, b, n = map(int, input().strip().split())\nif b<n:\n x=n\nelif n % b <= n%(b/a):\n x=n-n%b-1\nelif (n%b-n%(b/a)+1)<a:\n x=n-n%b-1\nelse:\n x=n\nprint(math.floor(a*x/b)-a*math.floor(x/b))', 'import math\na, b, n = map(int, input().strip().split())\nif b<n:\n x=n\nelif n % b <= n%(b/a):\n x=n-n%b-1\nelif (n % b - n%(b/a)+1)//(b/a)+1<a:#(n%b-n%(b/a)+1)<a:\n x=n-n%b-1\nelse:\n x=n\nprint(math.floor(a*x/b)-a*math.floor(x/b))', 'import math\na, b, n = map(int, input().strip().split())\nx=min(b-1,n)\nprint(math.floor(a*x/b)-a*math.floor(x/b))'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s059772442', 's157761550', 's836092599', 's901327737', 's095418106'] | [8784.0, 9128.0, 9196.0, 9184.0, 9164.0] | [20.0, 24.0, 20.0, 20.0, 22.0] | [411, 221, 203, 235, 111] |
p02696 | u970308980 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['\nsi = lambda: input().strip()\nii = lambda: int(input())\nmii = lambda: map(int, input().split())\nmsi = lambda: map(str, input().split())\nlmii = lambda: list(map(int, input().split()))\nlmsi = lambda: list(map(str, input().split()))\nsmii = lambda: sorted(map(int, input().split()))\n\n# ----------\n\nA, B, N = mii()\n\nans = 0\nx = B\nans = max(ans, A*x//B - A*(x//B))\nif N > 1:\n x -= 1\n ans = max(ans, A*x//B - A*(x//B))\n\nprint(ans)', '\nsi = lambda: input().strip()\nii = lambda: int(input())\nmii = lambda: map(int, input().split())\nmsi = lambda: map(str, input().split())\nlmii = lambda: list(map(int, input().split()))\nlmsi = lambda: list(map(str, input().split()))\nsmii = lambda: sorted(map(int, input().split()))\n\n# ----------\n\nA, B, N = mii()\n\nans = 0\n\nx = B\nans = max(ans, A*x//B - A*(x//B))\nx -= 1\nans = max(ans, A*x//B - A*(x//B))\n\nprint(ans)', '\nsi = lambda: input().strip()\nii = lambda: int(input())\nmii = lambda: map(int, input().split())\nmsi = lambda: map(str, input().split())\nlmii = lambda: list(map(int, input().split()))\nlmsi = lambda: list(map(str, input().split()))\nsmii = lambda: sorted(map(int, input().split()))\n\n# ----------\n\nA, B, N = mii()\n\nans = 0\nx = B\nans = max(ans, A*x//B - A*(x//B))\nif B > 1:\n x -= 1\n ans = max(ans, A*x//B - A*(x//B))\n\nprint(ans)\n', '\nsi = lambda: input().strip()\nii = lambda: int(input())\nmii = lambda: map(int, input().split())\nmsi = lambda: map(str, input().split())\nlmii = lambda: list(map(int, input().split()))\nlmsi = lambda: list(map(str, input().split()))\nsmii = lambda: sorted(map(int, input().split()))\n\n# ----------\n\n\nA, B, N = mii()\n\nans = 0\nx = min(N, B)\n\n\nans = max(ans, A*x//B - A*(x//B))\n\nif x > 1:\n x -= 1\n ans = max(ans, A*x//B - A*(x//B))\n\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s015541580', 's383782399', 's804870939', 's548684013'] | [9212.0, 9192.0, 9212.0, 9220.0] | [19.0, 23.0, 19.0, 25.0] | [429, 412, 430, 441] |
p02696 | u971124021 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,n = list(map(int, input().split()))\n\nans = 0\nT = 0\nfor i in range(1,n+1)[::-1]:\n t = (a*i)//b - a*(i//b)\n if T < t:\n T = t\n ans = i\n\nprint(ans)', 'a,b,n = list(map(int, input().split()))\nt = 0\nn = min(b-1,n)\n\nprint((a*n)//b - a*(n//b))'] | ['Wrong Answer', 'Accepted'] | ['s623408282', 's738517324'] | [9040.0, 9064.0] | [2206.0, 28.0] | [155, 88] |
p02696 | u972658925 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,n = map(int,input().split())\n\nans1 = (a*n)//b - a*(n//b)\nans2 = (a*(b-1))//b - a*((b-1)//b)\n\nprint(max(ans1,ans2))', 'a,b,n = map(int,input().split())\n\nif n < b-1:\n print(a*(n%b)//b)\nelse:\n print(a*((b-1)%b)//b)'] | ['Wrong Answer', 'Accepted'] | ['s627947790', 's829845449'] | [9060.0, 9104.0] | [23.0, 23.0] | [118, 99] |
p02696 | u973900850 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,n = map(int, input().split())\nif n < b:\n x = n\nelse:\n x = b-1\nwhile x >= 0:\n val = (a*x)//b-a*(x//b)\n if val < com:\n pass\n else:\n com = val\n x -= 1\nprint(com)', 'from math import floor\na,b,n = map(int, input().split())\nx = n\ncom = 0\nwhile x >= 0:\n val = floor((a*x)/b)-a*floor(x/b)\n if val < com:\n pass\n else:\n com = val\n x-=1\n print("val = ",val," com = ",com)\nprint(com)', 'a,b,n = map(int, input().split())\ncom = 0\nif n < b:\n x = n\nelse:\n x = b-1\nval = (a*x)//b\nprint(val)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s898642335', 's916506721', 's702376604'] | [9164.0, 50252.0, 9140.0] | [21.0, 2256.0, 20.0] | [194, 241, 105] |
p02696 | u977490411 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a, b, n = map(int, input().split())\n\ntemp_prev = 0\ntemp_curr = 0\nx = b-1.0\nwhile x <= n:\n temp_prev = temp_curr\n temp_curr = int(a * x / b) - a * int(x / b)\n x += 1.0\n\n if temp_curr < temp_prev:\n break\n\nprint(max(temp_curr, temp_prev))', 'a, b, n = map(int, input().split())\n\ntemp_prev = 0\ntemp_curr = 0\nif b <= 100:\n x = 0.0\nelse:\n x = min(n, b-1)\n\nwhile x <= n:\n temp_prev = temp_curr\n temp_curr = int(a * x / b) - a * int(x / b)\n x += 1.0\n\n if temp_curr <= temp_prev:\n break\n\nprint(max(temp_curr, temp_prev))', 'a, b, n = map(int, input().split())\n\ntemp_prev = 0\ntemp_curr = 0\nx = min(n, b-1)\n\nwhile x <= n:\n temp_prev = temp_curr\n temp_curr = int(a * x / b) - a * int(x / b)\n x += 1.0\n\n if temp_curr <= temp_prev:\n break\n\nprint(max(temp_curr, temp_prev))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s411465251', 's719179015', 's230415974'] | [9184.0, 9088.0, 9052.0] | [2205.0, 22.0, 19.0] | [254, 297, 262] |
p02696 | u980205854 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['\nA,B,N = map(int,input().split())\nx = max(B-1,N)\nprint(int(A*x/B))', '\nA,B,N = map(int,input().split())\nx = min(B-1,N)\nprint(int(A*x/B))'] | ['Wrong Answer', 'Accepted'] | ['s034944034', 's372210388'] | [9052.0, 9144.0] | [25.0, 24.0] | [86, 86] |
p02696 | u983853152 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ["\ndef main():\n A, B, N = map(int, input().split())\n max = ((A*N)//B) - (A * (N//B))\n\n if B>=N:\n temp = ((A*(B-1))//B) - (A * ((B-1)//B))\n if max < temp:\n max = temp\n \n NN = N - A -1\n if NN < 0:\n NN = 0\n for index in (NN,N):\n temp = ((A*index)//B) - (A * (index//B))\n if max < temp:\n max = temp\n\n\n print(max)\n\n\n\n\nif __name__ == '__main__':\n main()\n", "\ndef main():\n A, B, N = map(int, input().split())\n max = ((A*N)//B) - (A * (N//B))\n\n if B>=N:\n temp = ((A*(B-1))//B) - (A * ((B-1)//B))\n if max > temp:\n max = temp\n \n NN = N - A -1\n if NN < 0:\n NN = 0\n for index in (NN,N):\n temp = ((A*index)//B) - (A * (index//B))\n if max > temp:\n max = temp\n\n\n print(max)\n\n\n\n\nif __name__ == '__main__':\n main()\n", "\ndef main():\n A, B, N = map(int, input().split())\n max = ((A*N)//B) - (A * (N//B))\n\n if B<=N:\n temp = ((A*(B-1))//B) - (A * ((B-1)//B))\n if max < temp:\n max = temp\n\n print(max)\n\n\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s070054281', 's175331527', 's747016724'] | [9204.0, 9052.0, 9180.0] | [21.0, 22.0, 21.0] | [430, 430, 256] |
p02696 | u989345508 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a, b, n = map(int, input().split())\nif n >= b - 1:\n print(int(a - a / b))\nelse:\n print(a * n // b - a * n // b)', 'a,b,n=map(int,input().split());print(a*min(n,b-1)//b)'] | ['Wrong Answer', 'Accepted'] | ['s255028651', 's344187129'] | [9160.0, 9088.0] | [20.0, 22.0] | [117, 53] |
p02696 | u991269553 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['import math\n\na,b,n = map(int,input().split())\n\nl = [0]\n\nfor x in reversed(range(0,n+1)):\n ans = 0\n ans = math.floor(a*x/b) - a * math.floor(x/b)\n l.append(ans)\n if max(l) > ans:\n break\nprint(l)\nprint(max(l))', 'import math\n\na,b,n = map(int,input().split())\n\nl = [0]\n\nfor x in range(1,100):\n ans = 0\n ans = math.floor(a*x/b) - a * math.floor(x/b)\n l.append(ans)\n if l[x+1] > ans:\n break\n\nprint(ans)', 'A,B,N=map(int,input().split())\ndef f(x):\n return int(A*x/B)-A*int(x/B)\n\nprint(f(min(N,B-1)))\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s528337035', 's814467279', 's259422652'] | [9644.0, 9192.0, 9156.0] | [2206.0, 22.0, 21.0] | [226, 205, 94] |
p02696 | u996665352 | 2,000 | 1,048,576 | Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non- negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. | ['a,b,n=map(int,input().split())\nnmax = (a*n)//b - a*(n//b)\nx = b-1\nxmax = (a*x)//b - a*(x//b)\nprint(max(nmax,xmax))', 'a,b,n=map(int,input().split())\ns=n//b\nnmax = (a*n)//b - a*(n//b)\n\n# x = b*i-1\n# t = (a*x)//b - a*(x//b)\n# if t > nmax:\n# nmax = t\n# b_n = b\n\n# while b_n <= n:\n# x = b_n -1\n# t = (a*x)//b - a*b_nn\n# if t > nmax:\n# nmax = t\n# b_n += b\n\nx = b*s-1\nt = (a*x)//b - a*b_nn\nif t > nmax:\n nmax = t\nprint(nmax)', 'a,b,n=map(int,input().split())\nnmax = (a*n)//b - a*(n//b)\nx = b-1\nxmax = (a*x)//b - a*(x//b)\nprint(max(nmax,xmax) if x < n else nmax)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s403930903', 's933171481', 's322848988'] | [9180.0, 9180.0, 9052.0] | [19.0, 19.0, 19.0] | [114, 395, 133] |
p02698 | u014800961 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['n = int(input())\nalist = [0]+list(map(int,input().split()))\nuv_list = []\nfor i in range(n-1):\n u,v = map(int,input().split())\n if u > v:\n u,v = v,u\n uv_list.append([u,v])\n\ntree = [[] for _ in range(n+1)]\nfor i in range(n-1):\n uv = uv_list[i]\n tree[uv[0]].append(uv[1])\n\nqueue = [1]\nused = [0]*(n+1)\nans = [0]*(n+1)\ndp = []\nstack = []\nwhile queue != []:\n cur = queue[-1]\n\n if used[cur] == 0:\n if cur == 1:\n dp.append(alist[cur])\n stack.append([len(dp)-1,None])\n else:\n if alist[cur] > dp[-1]:\n dp.append(alist[cur])\n stack.append([len(dp)-1,None])\n else:\n offset = bisect.bisect_left(dp,alist[cur])\n stack.append([offset,dp[offset]])\n dp[offset] = alist[cur]\n ans[cur] = len(dp)\n\n if tree[cur] != [] and used[cur] == 0:\n queue.extend(tree[cur])\n else:\n queue.pop()\n\n #reverse\n back = stack.pop()\n if back[1] == None:\n dp.pop()\n else:\n dp[back[0]] = back[1]\n used[cur] = 1\n\nfor i in range(n):\n print(ans[i+1])', 'n = int(input())\nalist = [0]+list(map(int,input().split()))\nuv_list = []\nfor i in range(n-1):\n u,v = map(int,input().split())\n if u > v:\n u,v = v,u\n uv_list.append([u,v])\n\ntree = [[] for _ in range(n+1)]\nfor i in range(n-1):\n uv = uv_list[i]\n tree[uv[0]].append(uv[1])\n\nqueue = [1]\nused = [0]*(n+1)\nans = [0]*(n+1)\ndp = []\nstack = []\nwhile queue != []:\n cur = queue[-1]\n\n if used[cur] == 0:\n if cur == 1:\n dp.append(alist[cur])\n stack.append([len(dp)-1,None])\n else:\n if alist[cur] > dp[-1]:\n dp.append(alist[cur])\n stack.append([len(dp)-1,None])\n else:\n offset = bisect.bisect_left(dp,alist[cur])\n stack.append([offset,dp[offset]])\n dp[offset] = alist[cur]\n ans[cur] = len(dp)\n\n if tree[cur] != [] and used[cur] == 0:\n queue.extend(tree[cur])\n else:\n queue.pop()\n\n #reverse\n back = stack.pop()\n if back[1] == None:\n dp.pop()\n else:\n dp[back[0]] = back[1]\n used[cur] = 1\n\nfor i in range(n):\n print(ans[i+1])\n', 'n = int(input())\nalist = [0]+list(map(int,input().split()))\nuv_list = []\nfor i in range(n-1):\n u,v = map(int,input().split())\n if u > v:\n u,v = v,u\n uv_list.append([u,v])\n\ntree = [[] for _ in range(n+1)]\nfor i in range(n-1):\n uv = uv_list[i]\n tree[uv[0]].append(uv[1])\n\nqueue = [1]\nused = [0]*(n+1)\nans = [0]*(n+1)\ndp = []\nstack = []\nwhile queue != []:\n cur = queue[-1]\n\n if used[cur] == 0:\n if cur == 1:\n dp.append(alist[cur])\n stack.append([len(dp)-1,None])\n else:\n if alist[cur] > dp[-1]:\n dp.append(alist[cur])\n stack.append([len(dp)-1,None])\n else:\n offset = bisect.bisect_left(dp,alist[cur])\n stack.append([offset,dp[offset]])\n dp[offset] = alist[cur]\n ans[cur] = len(dp)\n\n if tree[cur] != [] and used[cur] == 0:\n queue.extend(tree[cur])\n else:\n queue.pop()\n\n #reverse\n if stack != []:\n back = stack.pop()\n if back[1] == None:\n dp.pop()\n else:\n dp[back[0]] = back[1]\n used[cur] = 1\n\nfor i in range(n):\n print(ans[i+1])\n', '\nimport math\nimport bisect\n\nn = int(input())\nalist = [0]+list(map(int,input().split()))\nuv_list = []\nfor i in range(n-1):\n u,v = map(int,input().split())\n if u > v:\n u, v = v, u\n uv_list.append([u,v])\n\ntree = [[] for _ in range(n+1)]\nfor i in range(n-1):\n uv = uv_list[i]\n tree[uv[0]].append(uv[1])\n tree[uv[1]].append(uv[0])\n \n\nqueue = [1]\nused = [0]*(n+1)\nans = [0]*(n+1)\ndp = []\nstack = []\nwhile queue != []:\n cur = queue[-1]\n\n if used[cur] == 0:\n if cur == 1:\n dp.append(alist[cur])\n stack.append([len(dp)-1,None])\n else:\n if alist[cur] > dp[-1]:\n dp.append(alist[cur])\n stack.append([len(dp)-1,None])\n else:\n offset = bisect.bisect_left(dp,alist[cur])\n stack.append([offset,dp[offset]])\n dp[offset] = alist[cur]\n ans[cur] = len(dp)\n\n if tree[cur] != [] and used[cur] == 0:\n for child in tree[cur]:\n if used[child] == 0:\n queue.append(child)\n else:\n queue.pop()\n\n #reverse\n back = stack.pop()\n if back[1] == None:\n dp.pop()\n else:\n dp[back[0]] = back[1]\n used[cur] = 1\nfor i in range(n):\n print(ans[i+1])\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s329523057', 's624243946', 's932028734', 's911715284'] | [70404.0, 70284.0, 70112.0, 97292.0] | [656.0, 683.0, 683.0, 1514.0] | [1151, 1152, 1196, 1285] |
p02698 | u044220565 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['# coding: utf-8\nimport sys\nsysread = sys.stdin.readline\nsys.setrecursionlimit(10**7)\ndef run():\n N = int(input())\n A = [0] + list(map(int, sysread().split()))\n to = [[] for _ in range(N+1)]\n for _ in range(N-1):\n u,v = map(int, sysread().split())\n to[u].append(v)\n to[v].append(u)\n seen = [False] * (N+1)\n dp = [float(\'inf\')] * (N+1)\n dp[0] = -float(\'inf\')\n dp2 = [0] * (N+1)\n paths = []\n actions = []# (idx, pre, pro)\n def dfs(node, parent=None):\n a = A[node]\n seen[node] = True\n if parent == None:\n paths.append(node)\n actions.append((1, dp[1], a))\n dp[1] = a\n else:\n while True:\n tmp = paths.pop()\n if tmp == parent:\n paths.append(tmp)\n paths.append(node)\n break\n else:\n idx, pre, pro = actions.pop()\n dp[idx] = pre\n\n\n idx = bin_search(dp[:len(paths)], a)\n if idx == float(\'inf\'):\n actions.append((len(paths), float(\'inf\'), a))\n dp[len(paths)] = a\n else:\n actions.append((idx, dp[idx], a))\n dp[idx] = a\n print(dp.index(float(\'inf\'))-1)\n for next in to[node]:\n if not seen[next]:\n dfs(next, node)\n dfs(1)\n\n for i in range(1, N+1):\n print()\n return None\n\ndef bin_search(A, x):\n \'\'\'\n return index which is lowest in values more than or equal to x\n \'\'\'\n low = 0\n high = len(A) - 1\n c = (low + high) // 2\n if A[-1] < x: return float(\'inf\')\n while high - low > 1:\n if A[c] < x:\n low = c\n c = (low + high) // 2\n\n elif A[c] > x:\n high = c\n c = (high + low) // 2\n else:\n return c\n return high\n\nif __name__ == "__main__":\n run()', '# coding: utf-8\nimport sys\nsysread = sys.stdin.readline\nsys.setrecursionlimit(10**7)\ndef run():\n N = int(input())\n A = [0] + list(map(int, sysread().split()))\n to = [[] for _ in range(N+1)]\n for _ in range(N-1):\n u,v = map(int, sysread().split())\n to[u].append(v)\n to[v].append(u)\n seen = [False] * (N+1)\n stack = [1]\n tree_score = [-1] * (N+1)\n dp = [[float(\'inf\')] for _ in range(N+1)]\n dp2 = [0] * (N+1)\n def dfs(node, length=0, parent=None):\n seen[node] = True\n stack.append(node)\n length += 1\n\n if parent == None:\n dp[node].append(A[node])\n dp2[node] = 1\n else:\n dp2[node] = dp2[parent]\n a = A[node]\n done = False\n for i, val in enumerate(dp[parent][1:], 1):\n if val > a and not done:\n if val == float(\'inf\'):\n dp2[node] += 1\n dp[node].append(a)\n done = True\n else:\n dp[node].append(val)\n if dp[node][-1] < a:\n dp[node].append(a)\n dp2[node] += 1\n else:\n dp[node].append(float(\'inf\'))\n\n for next in to[node]:\n if not seen[next]:\n dfs(next, length, node)\n\n dfs(1)\n\n for i in range(1, N+1):\n print(dp2[i])\n\n\nif __name__ == "__main__":\n run()\n from time import time as TTT\n a = [0] * 10**5\n t1 = TTT()\n for _ in range(10**5):\n b = a.copy()\n t2 = TTT()\n print(t2-t1, \'sec\')\n for _ in range(10**5):\n\n c = a[:]\n t3 = TTT()\n print(t3 - t2, \'sec\')', '# coding: utf-8\nimport sys\n#from operator import itemgetter\nsysread = sys.stdin.readline\n#from heapq import heappop, heappush\n#from collections import defaultdict\nsys.setrecursionlimit(10**7)\n#import math\n#from itertools import combinations\ndef run():\n N = int(input())\n A = [0] + list(map(int, sysread().split()))\n to = [[] for _ in range(N+1)]\n for _ in range(N-1):\n u,v = map(int, sysread().split())\n to[u].append(v)\n to[v].append(u)\n seen = [False] * (N+1)\n dp = [float(\'inf\')] * (N+2)\n dp[0] = -float(\'inf\')\n ddp2 = [0]\n paths = []\n actions = []# (idx, pre, pro)\n ans = [0] * (N+1)\n def dfs(node, parent=None):\n\n a = A[node]\n seen[node] = True\n if parent == None:\n actions.append((1, dp[1], a, 1))\n dp[1] = a\n ddp2[0] += 1\n else:\n idx = bin_search(dp, a)\n if dp[idx] == float(\'inf\'):\n actions.append((idx, dp[idx], a, 1))\n ddp2[0] += 1\n else:\n actions.append((idx, dp[idx], a, 0))\n dp[idx] = a\n ans[node] = ddp2[0]\n for next in to[node]:\n if not seen[next]:\n dfs(next, node)\n\n idx, pre, pro, change = actions.pop()\n dp[idx] = pre\n ddp2[0] -= change\n\n dfs(1)\n for s in ans[1:]:\n print(s)\n return None\n\ndef bin_search(A, x):\n \'\'\'\n return index which is lowest in values more than or equal to x\n \'\'\'\n low = 0\n high = len(A) - 1\n c = (low + high) // 2\n if A[-1] < x: return float(\'inf\')\n while high - low > 1:\n if A[c] < x:\n low = c\n c = (low + high) // 2\n\n elif A[c] > x:\n high = c\n c = (high + low) // 2\n else:\n return c\n return high\n\nif __name__ == "__main__":\n run()'] | ['Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s154571457', 's656889712', 's513510889'] | [96704.0, 259936.0, 294208.0] | [2208.0, 2214.0, 1696.0] | [1942, 1681, 1861] |
p02698 | u169138653 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['from collections import deque\nfrom bisect import bisect_right\nfrom copy import deepcopy\nn=int(input())\na=list(map(int,input().split()))\nedge=[[] for _ in range(n)]\nfor _ in range(n-1):\n u,v=map(int,input().split())\n u-=1\n v-=1\n edge[u].append(v)\n edge[v].append(u)\nvisited=[True]*n\nlis=[[] for _ in range(n)]\ndef dfs():\n stack=deque([0])\n visited[0]=False\n lis[0]=[a[0]]\n while stack:\n x=stack.pop()\n for nx in edge[x]:\n if visited[nx]:\n if a[nx]>lis[x][-1]:\n lis[nx]=lis[x]+[a[nx]]\n else:\n idx=bisect_right(cur,a[nx])\n cur=deepcopy(lis[x])\n cur[idx]=a[nx]\n lis[nx]=cur\n visited[nx]=False\n stack.append(nx)\n return\ndfs()\nfor i in range(n):\n print(len(lis[i]))', 'from collections import deque\nfrom bisect import bisect_left\nimport sys\nsys.setrecursionlimit(10**7)\nn=int(input())\na=list(map(int,input().split()))\nedge=[[] for _ in range(n)]\nfor _ in range(n-1):\n u,v=map(int,input().split())\n u-=1\n v-=1\n edge[u].append(v)\n edge[v].append(u)\nstack=deque([])\ninf=10**18\nlis=[inf]*(n+1)\nans=[0 for _ in range(n)]\nvisited=[True]*n\n#print(edge)\ndef dfs(s):\n visited[s]=False\n idx=bisect_left(lis,a[s])\n stack.append((idx,lis[idx]))\n lis[idx]=a[s]\n ans[s]=bisect_left(lis,inf)\n for x in edge[s]:\n if visited[x]:\n dfs(x)\n idx,val=stack.pop()\n lis[idx]=val\ndfs(0)\n#print(lis)\nfor i in range(n):\n print(ans[i])'] | ['Runtime Error', 'Accepted'] | ['s971178020', 's776351030'] | [66824.0, 239396.0] | [824.0, 1452.0] | [872, 698] |
p02698 | u170201762 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['from bisect import bisect\n\nN = int(input())\na = list(map(int,input().split()))\ng = [[] for _ in range(N)]\nfor i in range(N-1):\n u,v = map(int,input().split())\n u -= 1\n v -= 1\n g[u].append(v)\n g[v].append(u)\n\nans = [0]*N\ndef dfs(t,f,l,seq):\n l = l.copy()\n seq = seq.copy()\n l.append(a[t])\n print(l,seq)\n i = bisect(seq,l[-1])\n if len(seq)==i:\n seq.append(l[-1])\n else:\n seq[i]=l[-1]\n ans[t] = len(seq)\n for v in g[t]:\n if v != f:\n dfs(v,t,l,seq)\ndfs(0,0,[],[])\nfor i in range(N):\n print(ans[i])\n', 'from bisect import bisect_left as bisect\nimport sys\nsys.setrecursionlimit(10**9)\n\nN = int(input())\na = list(map(int,input().split()))\ng = [[] for _ in range(N)]\nfor i in range(N-1):\n u,v = map(int,input().split())\n u -= 1\n v -= 1\n g[u].append(v)\n g[v].append(u)\n\nans = [0]*N\ndef dfs(t,f,l):\n res = 0\n i = bisect(l,a[t])\n if len(l)==i:\n l.append(a[t])\n else:\n res = [i,l[i]]\n l[i]=a[t]\n ans[t] = len(l)\n for v in g[t]:\n if v != f:\n back = dfs(v,t,l)\n if back:\n l[back[0]] = back[1]\n else:\n l.pop()\n return res\ndfs(0,0,[])\nfor i in range(N):\n print(ans[i])'] | ['Runtime Error', 'Accepted'] | ['s573706333', 's048543696'] | [178136.0, 237592.0] | [2014.0, 1395.0] | [571, 684] |
p02698 | u179169725 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ["import sys\nsys.setrecursionlimit(1 << 25)\nread = sys.stdin.readline\nra = range\nenu = enumerate\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_a_int():\n return int(read())\n\n\ndef read_tuple(H):\n '''\n H is number of rows\n '''\n ret = []\n for _ in range(H):\n ret.append(tuple(map(int, read().split())))\n return ret\n\n\ndef read_col(H):\n \n ret = []\n for _ in range(H):\n ret.append(list(map(int, read().split())))\n return tuple(map(list, zip(*ret)))\n\n\ndef read_matrix(H):\n '''\n H is number of rows\n '''\n ret = []\n for _ in range(H):\n ret.append(list(map(int, read().split())))\n return ret\n \n\n\nfrom bisect import bisect_left, bisect_right, insort_left\n\n\nclass BinarySearchTree:\n def __init__(self, ls: list = []):\n \n self.bst = ls \n\n def __repr__(self):\n return f'BST:{self.bst}'\n\n def __len__(self):\n return len(self.bst)\n\n def __getitem__(self, idx):\n return self.bst[idx]\n\n def size(self):\n return len(self.bst)\n\n def insert(self, x):\n insort_left(self.bst, x)\n\n def remove(self, x):\n \n del self.bst[self.find(x)]\n\n def bisect_left(self, x):\n \n return bisect_left(self.bst, x)\n\n def bisect_right(self, x):\n \n return bisect_right(self.bst, x)\n\n def find(self, x):\n \n idx = bisect_left(self.bst, x)\n if idx != len(self.bst) and self.bst[idx] == x:\n return idx\n raise ValueError\n\n def insert_replace_left(self, x):\n \n idx_del = self.bisect_left(x) - 1\n if idx_del + 1 == 0: \n self.insert(x)\n if idx_del < len(self.bst):\n self.insert(x)\n del self.bst[idx_del]\n\n def insert_replace_right(self, x):\n \n idx_del = self.bisect_left(x) + 1\n if idx_del - 1 == len(self.bst): \n self.insert(x)\n else:\n self.insert(x)\n del self.bst[idx_del]\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n\nfrom collections import defaultdict, Counter, deque\nfrom operator import itemgetter\nfrom itertools import product, permutations, combinations\nfrom bisect import bisect_left, bisect_right # , insort_left, insort_right\nfrom math import gcd\n\n\nN = read_a_int()\nA = read_ints()\nTree = [[] for _ in range(N)]\nfor _ in range(N - 1):\n u, v = read_ints()\n u -= 1\n v -= 1\n Tree[u].append(v)\n Tree[v].append(u)\n\nLIS = BinarySearchTree([-1])\n\nans = [-1] * N\n\n\n@njit\ndef dfs(u, p, LIS): \n \n LIS.insert_replace_right(A[u])\n ans[u] = len(LIS) - 1\n # print(u, LIS.bst)\n if len(Tree[u]) > 2 or u == 0: \n for nu in Tree[u]:\n if nu == p:\n continue\n dfs(nu, u, BinarySearchTree(LIS.bst.copy())) \n elif len(Tree[u]) == 2: \n for nu in Tree[u]:\n if nu == p:\n continue\n dfs(nu, u, LIS)\n\n\n# def dfs(u, p, LIS): \n# \n# LIS.insert_replace_right(A[u])\n# ans[u] = len(LIS) - 1\n# for nu in Tree[u]:\n# if nu == p:\n# continue\n# dfs(nu, u, BinarySearchTree(LIS.bst.copy()))\n\n\ndfs(0, -1, LIS)\nprint(*ans, sep='\\n')\n", "\n\nimport sys\nsys.setrecursionlimit(1 << 25)\nread = sys.stdin.readline\nra = range\nenu = enumerate\n\n\ndef mina1(x): return int(x) - 1\n\n\ndef read_ints(tozero=False):\n if tozero == False:\n return list(map(int, read().split()))\n else:\n return list(map(mina1, read().split()))\n\n\ndef read_a_int():\n return int(read())\n\n\nfrom bisect import bisect_left, bisect_right\nfrom collections import defaultdict\nN = read_a_int()\nA = read_ints()\ntree = defaultdict(lambda: [])\nfor _ in ra(N - 1):\n u, v = read_ints(True)\n tree[u].append(v)\n tree[v].append(u)\n\nLIS = []\nans = [0] * N \n\n\ndef dfs(now, p): \n a = A[now]\n \n idx = bisect_left(LIS, a)\n is_append = False\n if idx == len(LIS):\n LIS.append(a)\n is_append = True\n else:\n old = LIS[idx] \n LIS[idx] = a \n\n ans[now] = len(LIS) \n \n for to in tree[now]:\n if to == p:\n continue\n dfs(to, now)\n\n \n if is_append:\n del LIS[idx]\n else:\n LIS[idx] = old\n\n\ndfs(0, -1)\nprint(*ans, sep='\\n')\n"] | ['Runtime Error', 'Accepted'] | ['s148572581', 's969874574'] | [53720.0, 232276.0] | [501.0, 974.0] | [5363, 1352] |
p02698 | u207097826 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['from collections import deque\nimport bisect\n\n\nN = int(input())\na = list(map(int, input().split()))\nuvs = [list(map(int, input().split())) for _ in range(N-1)]\nshortest = [10e+10 for _ in range(N)]\nshortest[0] = 0\n\nroutes = [[] for _ in range(N)]\n\nfor uv in uvs:\n routes[uv[0]-1].append(uv[1]-1)\n routes[uv[1]-1].append(uv[0]-1)\n\nlis = [10e+100 for _ in range(N)]\nminimum = [10e+100 for _ in range(N)]\nseen = [False for _ in range(N)]\nseen[0] = True\n\ndef function(checking):\n insert_posi = bisect.bisect_left(lis, a[checking])\n preserved = lis[insert_posi]\n lis[insert_posi] = a[checking]\n minimum[checking] = bisect.bisect_left(lis, 10e+50)\n for route in routes[checking]:\n if seen[route] == False:\n seen[route] = True\n shortest[route] = shortest[checking]+1\n function(route)\n lis[insert_posi] = preserved\n return\n \nfunction(0)\n\nminimum = [[minimum[i],shortest[i]] for i in range(N)]\n\nminimum = sorted(minimum, key=lambda x:x[1])\n\n[print(x[0]) for x in minimum]', 'from collections import deque\nimport bisect\nimport sys\n\n\nN = int(input())\na = list(map(int, f.input().split()))\nuvs = [list(map(int, input().split())) for _ in range(N-1)]\n\nroutes = [[] for _ in range(N)]\n\nfor uv in uvs:\n routes[uv[0]-1].append(uv[1]-1)\n routes[uv[1]-1].append(uv[0]-1)\n\nlis = [10e+100 for _ in range(N)]\nshortest = [10e+100 for _ in range(N)]\nshortest[0] = 0\nminimum = [10e+100 for _ in range(N)]\nseen = [False for _ in range(N)]\nseen[0] = True\n\ndef function(checking):\n insert_posi = bisect.bisect_left(lis, a[checking])\n preserved = lis[insert_posi]\n lis[insert_posi] = a[checking]\n minimum[checking] = bisect.bisect_left(lis, 10e+50)\n for route in routes[checking]:\n if seen[route] == False:\n shortest[route] = shortest[checking]+1\n seen[route] = True\n function(route) \n lis[insert_posi] = preserved\n return\n \nfunction(0)\n\n[print(i) for i in (minimum)]', 'from collections import deque\nimport bisect\nimport sys\n\nsys.setrecursionlimit(200000)\n\nN = int(input())\na = list(map(int, input().split()))\nuvs = [list(map(int, input().split())) for _ in range(N-1)]\nshortest = [10e+10 for _ in range(N)]\nshortest[0] = 0\n\nroutes = [[] for _ in range(N)]\n\nfor uv in uvs:\n routes[uv[0]-1].append(uv[1]-1)\n routes[uv[1]-1].append(uv[0]-1)\n\nlis = [10e+100 for _ in range(N)]\nminimum = [10e+100 for _ in range(N)]\nseen = [False for _ in range(N)]\nseen[0] = True\n\ndef function(checking):\n insert_posi = bisect.bisect_left(lis, a[checking])\n preserved = lis[insert_posi]\n lis[insert_posi] = a[checking]\n minimum[checking] = bisect.bisect_left(lis, 10e+50)\n for route in routes[checking]:\n if seen[route] == False:\n seen[route] = True\n shortest[route] = shortest[checking]+1\n function(route)\n lis[insert_posi] = preserved\n return\n \nfunction(0)\n\n[print(x) for x in minimum]'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s008922122', 's360244408', 's792591371'] | [116404.0, 9484.0, 272200.0] | [1783.0, 24.0, 1662.0] | [1035, 947, 971] |
p02698 | u460375306 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['import sys\nsys.setrecursionlimit(1e6)\ndef dfs(vertex):\n visited[vertex] = True\n if vertex != 0:\n maxlen = 0\n x = a[vertex]\n for (L, z) in table:\n if z < x: # strict increasing\n maxlen = max(maxlen, L)\n table.append((maxlen+1, x))\n ans[vertex] = max(L for (L, _) in table)\n for node in adjacent[vertex]:\n if not visited[node]:\n dfs(node)\n table.pop()\n return\nn = int(input())\na = list(map(int, input().split()))\nadjacent = {i: [] for i in range(n)}\nfor _ in range(n-1):\n node1, node2 = map(int, input().split())\n node1 -= 1\n node2 -= 1\n adjacent[node1].append(node2)\n adjacent[node2].append(node1)\nvisited = [False]*n\nans = [0]*n\ntable = [(1, a[0])]\ndfs(0)\n[print(value) for value in ans]', 'def longest_subsequence(sequence):\n return 5\n\ndef true_longest_subsequence(sequence):\n table = [(1, sequence[0])]\n for x in sequence[1:]:\n maxlen = 0\n for (L, z) in table:\n if z < x: # strict increasing\n maxlen = max(maxlen, L)\n table.append((maxlen+1, x))\n return max(L for (L, _) in table)\ndef dfs(vertex):\n visited[vertex] = True\n node_sequence.append(a[vertex])\n ans[vertex] = longest_subsequence(node_sequence)\n for node in adjacent[vertex]:\n if not visited[node]:\n dfs(node)\n node_sequence.pop()\n return\nn = int(input())\na = list(map(int, input().split()))\nadjacent = {i: [] for i in range(n)}\nfor _ in range(n-1):\n node1, node2 = map(int, input().split())\n node1 -= 1\n node2 -= 1\n adjacent[node1].append(node2)\n adjacent[node2].append(node1)\nnode_sequence = list()\nvisited = [False]*n\nans = [0]*n\ndfs(0)\n[print(value) for value in ans]', 'import sys\nsys.setrecursionlimit(1000000)\nfrom bisect import bisect, bisect_left\ndef dfs(vertex):\n visited[vertex] = True\n value = a[vertex]\n j = bisect(dp, value)\n previous = dp[j]\n if dp[j-1] != value: # strict increasing\n dp[j] = value\n ans[vertex] = bisect_left(dp, float("inf"))-1\n for node in adjacent[vertex]:\n if not visited[node]:\n dfs(node)\n dp[j] = previous\n return\nn = int(input())\na = list(map(int, input().split()))\nadjacent = {i: [] for i in range(n)}\nfor _ in range(n-1):\n node1, node2 = map(int, input().split())\n node1 -= 1\n node2 -= 1\n adjacent[node1].append(node2)\n adjacent[node2].append(node1)\nvisited = [False]*n\nans = [0]*n\ndp = [float("inf") for _ in range(n+1)]\ndp[0] = float("-inf")\ndfs(0)\n[print(value) for value in ans]'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s019476721', 's784362484', 's960650455'] | [9000.0, 70432.0, 246744.0] | [22.0, 1019.0, 1553.0] | [730, 886, 773] |
p02698 | u559196406 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['n = int(input())\na = list(map(int,input().split()))\nt = [[] for _ in range(n+1)]\nfor _ in range(n-1):\n u,v = map(int,input().split())\n t[u].append(v)\n t[v].append(u)\n \nstack = [1]\ndp = [[] for _ in range(n+1)]\ndp[1] = [a[0]]\nans = [1]*(n+1)\nchecked = []\nwhile stack:\n b = stack.pop()\n if b in checked:\n continue\n checked.append(b)\n e = dp[b]\n x = len(e)\n for i in t[b]:\n if i in checked:\n continue\n stack.append(i)\n c = a[i-1]\n if e[-1] < c:\n dp[i] = e.copy()+[c]\n ans[i] = x+1\n d = dp[i][::-1][1:]\n else:\n dp[i] = e.copy()\n ans[i] = x\n d = dp[i][::-1]\n for j,k in enumerate(d):\n if j == x-1 and k > c:\n k = c\n elif j == 0:\n y = k\n elif k > c and y < c:\n k = c\n y = k\n \nfor i in ans[1:]:\n print(i)', "import bisect\nn = int(input())\na = list(map(int,input().split()))\nt = [[] for _ in range(n+1)]\nfor _ in range(n-1):\n u,v = map(int,input().split())\n t[u].append(v)\n t[v].append(u)\n\nINF = float('inf')\ndp = [INF]*(n+1)\nans = [1]*(n+1)\nchecked = [False]*(n+1)\nchecked[1] = True\nchanges = []\n\ndef search(x):\n ind = bisect.bisect_left(dp,a[x-1])\n changes.append([ind,dp[ind]])\n dp[ind] = a[x-1]\n ans[x] = bisect.bisect_left(dp,INF)\n \n for i in t[x]:\n if not checked[i]:\n checked[i] = True\n search(i)\n \n b,c = changes.pop()\n dp[b] = c\n \nsearch(1)\nfor i in a[1:]:\n print(i)", 'n = int(input())\na = list(map(int,input().split()))\nt = [[] for _ in range(n+1)]\nfor _ in range(n-1):\n u,v = map(int,input().split())\n t[u].append(v)\n t[v].append(u)\n \nstack = [1]\ndp = [[] for _ in range(n+1)]\ndp[1] = [a[0]]\nans = [1]*(n+1)\nchecked = []\nwhile stack:\n b = stack.pop()\n if b in checked:\n continue\n checked.append(b)\n e = dp[b]\n x = len(e)\n for i in t[b]:\n if i in checked:\n continue\n stack.append(i)\n c = a[i-1]\n d = dp[i]\n if e[-1] < c:\n d = e+[c]\n ans[i] = x+1\n else:\n d = e.copy()\n ans[i] = x\n for j in range(x-1,-1,-1):\n if j == 0 and d[j] > c:\n d[j] = c\n elif d[j] > c and d[j-1] < c:\n d[j] = c\n \nfor i in ans[1:]:\n print(i)', 'import bisect\nimport sys\nsys.setrecursionlimit(10**7)\n\nn = int(input())\na = [0]+list(map(int,input().split()))\nt = [[] for _ in range(n+1)]\nfor _ in range(n-1):\n u,v = map(int,input().split())\n t[u].append(v)\n t[v].append(u)\n\nm = 10**18\ndp = [m]*(n+1)\nans = [1]*(n+1)\nchecked = [False]*(n+1)\nchecked[1] = True\nchanges = []\n\ndef search(x):\n ind = bisect.bisect_left(dp,a[x])\n changes.append((ind,dp[ind]))\n dp[ind] = a[x]\n ans[x] = bisect.bisect_left(dp,m)\n \n for i in t[x]:\n if not checked[i]:\n checked[i] = True\n search(i)\n \n b,c = changes.pop()\n dp[b] = c\n \nsearch(1)\nfor i in ans[1:]:\n print(i)'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s803281191', 's804265164', 's923479748', 's234250936'] | [159908.0, 56936.0, 66264.0, 239384.0] | [2212.0, 1082.0, 866.0, 1371.0] | [960, 637, 855, 668] |
p02698 | u571969099 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['import sys\nsys.setrecursionlimit(1000000)\ndef input():\n return sys.stdin.readline()\nn = int(input())\na = [int(i) for i in input().split()]\ne = [[] for _ in range(n)]\nfor _ in range(n - 1):\n aa, bb = [int(i) - 1 for i in input().split()]\n e[aa].append(bb)\n e[bb].append(aa)\n\nans = [0] * n\nans[0] = 1\nans2 = [0] * n\nans2[0] = 1\n\n\ndef dfs(i=0, r=-1, x=[], y=[]):\n if r == -1:\n x.append(a[i])\n else:\n if x[0] >= a[i]:\n ans[i] = 1\n else:\n mi = 0\n ma = len(x) - 1\n while mi != ma:\n mm = (mi + ma) // 2+1\n if x[mm] < a[i]:\n mi = mm\n else:\n ma = mm - 1\n ans[i] = ans[y[mi]]+1\n ans2[i] = max(ans2[r], ans[i])\n x.append(max(x[-1], a[i]))\n y.append(i)\n for j in e[i]:\n if j != r:\n dfs(j, i)\n y.pop()\n x.pop()\n\n\ndfs()\nfor i in ans2:\n print(i)\n', 'import sys\nsys.setrecursionlimit(1000000)\n\n\ndef input():\n return sys.stdin.readline()\n\n\nn = int(input())\naa = [int(i) for i in input().split()]\ne = [[] for _ in range(n)]\nfor _ in range(n - 1):\n a, b = [int(i) - 1 for i in input().split()]\n e[a].append(b)\n e[b].append(a)\n\ndp = [10 ** 9] * (n + 10)\ndp[0] = 0\nans1 = [0] * n\nans2 = [0] * n\n\n\ndef dfs(i=0, r=-1):\n global dp, ans1, ans2\n mi = 0\n ma = n\n while mi != ma:\n mm = (mi + ma) // 2\n if dp[mm] >= aa[i]:\n ma = mm\n else:\n mi = mm + 1\n\n be = dp[mi]\n dp[mi] = min(dp[mi], aa[i])\n ans1[i] = mi\n ans2[i] = max(ans1[i], ans2[r])\n\n for j in e[i]:\n if j == r:\n continue\n dfs(j, i)\n\n dp[mi] = be\n\n\ndfs()\nprint("\\n".join(map(str, ans2)))\n'] | ['Wrong Answer', 'Accepted'] | ['s672156372', 's111818859'] | [267412.0, 272480.0] | [1357.0, 1564.0] | [955, 793] |
p02698 | u600402037 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ["# coding: utf-8\nimport sys\nfrom bisect import bisect_left, bisect_right, insort\nsys.setrecursionlimit(10 ** 7)\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nN = ir()\nA = [0] + lr() # 1-indexed\ngraph = [[] for _ in range(N+1)] # 1-indexed\nfor _ in range(N-1):\n a, b = lr()\n graph[a].append(b)\n graph[b].append(a)\n\nanswer = [0] * (N+1) # 1-indexed\nINF = 10 ** 10\nparent = [-1] * (N+1)\n\ndef dfs(n, arr):\n \n i = bisect_left(arr, INF)\n answer[n] = i\n print('n, i', n, i, arr[:5])\n for c in graph[n]:\n if c == parent[n]:\n continue\n parent[c] = n\n new = arr[:]\n i = bisect_left(new, A[c])\n new[i] = A[c]\n dfs(c, new)\n\nB = [INF] * (N+1)\nB[0] = A[1]\ndfs(1, B)\nfor a in answer[1:]:\n print(a)\n", '# coding: utf-8\nimport sys\nfrom bisect import bisect_left, bisect_right, insort\nsys.setrecursionlimit(10 ** 7)\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nN = ir()\nA = [0] + lr() # 1-indexed\ngraph = [[] for _ in range(N+1)] # 1-indexed\nfor _ in range(N-1):\n a, b = lr()\n graph[a].append(b)\n graph[b].append(a)\n\nanswer = [0] * (N+1) # 1-indexed\nINF = 10 ** 10\nparent = [-1] * (N+1)\n\ndef dfs(n):\n \n i = bisect_left(dp, INF)\n answer[n] = i\n for c in graph[n]:\n if c == parent[n]:\n continue\n parent[c] = n\n i = bisect_left(dp, A[c])\n old = dp[i]\n dp[i] = A[c]\n dfs(c)\n dp[i] = old\n\ndp = [INF] * (N+1)\ndp[0] = A[1]\ndfs(1)\nfor a in answer[1:]:\n print(a)\n'] | ['Wrong Answer', 'Accepted'] | ['s177613831', 's615305885'] | [1728432.0, 226364.0] | [2253.0, 1264.0] | [916, 870] |
p02698 | u608088992 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['import sys\nfrom bisect import bisect_left\nsys.setrecursionlimit(1000000)\nINF = pow(10, 10)\n\nchanged = []\ninput = sys.stdin.readline\nN = int(input())\nA = [int(a) for a in input().split()]\nEdge = [[] for _ in range(N)]\nfor _ in range(N-1):\n u, v = map(int, input().split())\n Edge[u-1].append(v-1)\n Edge[v-1].append(u-1)\nLIS = [INF] * N\n\ndef dfs(i, pre, Ans):\n changeID = bisect_left(LIS, A[i])\n changed.append((changeID, LIS[changeID]))\n LIS[changeID] = min(A[i], LIS[changeID])\n #print(i, LIS)\n print(changed)\n Ans[i] = bisect_left(LIS, N + 1)\n for nextN in Edge[i]:\n if nextN != pre: dfs(nextN, i, Ans)\n backID, backV = changed.pop()\n LIS[backID] = backV\n return 0\n\ndef solve():\n Ans = [1] * N\n dfs(0, 0, Ans)\n print("\\n".join(map(str, Ans)))\n \n return 0\n\nif __name__ == "__main__":\n solve()', 'import sys\nfrom bisect import bisect_left\nsys.setrecursionlimit(1000000)\nINF = pow(10, 10)\n\nchanged = []\ninput = sys.stdin.readline\nN = int(input())\nA = [int(a) for a in input().split()]\nEdge = [[] for _ in range(N)]\nfor _ in range(N-1):\n u, v = map(int, input().split())\n Edge[u-1].append(v-1)\n Edge[v-1].append(u-1)\nLIS = [INF] * N\n\ndef dfs(i, pre, Ans):\n changeID = bisect_left(LIS, A[i])\n changed.append((changeID, LIS[changeID]))\n LIS[changeID] = min(A[i], LIS[changeID])\n #print(i, LIS)\n #print(changed)\n Ans[i] = bisect_left(LIS, INF) + 1\n for nextN in Edge[i]:\n if nextN != pre: dfs(nextN, i, Ans)\n backID, backV = changed.pop()\n LIS[backID] = backV\n return 0\n\ndef solve():\n Ans = [1] * N\n dfs(0, 0, Ans)\n print("\\n".join(map(str, Ans)))\n \n return 0\n\nif __name__ == "__main__":\n solve()', 'import sys\nfrom collections import deque\n\ndef solve():\n input = sys.stdin.readline\n N = int(input())\n A = [int(a) for a in input().split()]\n Aorder = [(A[i], i) for i in range(N)]\n Edge = [[] for _ in range(N)]\n for _ in range(N-1):\n u, v = map(int, input().split())\n Edge[u-1].append(v-1)\n Edge[v-1].append(u-1)\n Ans = [1] * N\n q = deque()\n nd = dict()\n nd[1] = A[0]\n for nextn in Edge[0]:\n q.append((nextn, 0, nd, 1))\n \n while q:\n nn, pre, cd, mL = q.popleft()\n low, high = 0, mL + 1\n while high - low > 1:\n mid = (low + high)// 2\n if cd[mid] >= A[nn]: high = mid\n else: low = mid\n Ans[nn] = high\n cd[high] = A[nn]\n for nextn in Edge[nn]:\n if nextn != pre:\n if high == mL + 1: q.append((nextn, nn, cd, mL + 1))\n else: q.append((nextn, nn, cd, mL))\n print("\\n".join(map(str, Ans)))\n\n return 0\n\nif __name__ == "__main__":\n solve()', 'import sys\nfrom bisect import bisect_left\nsys.setrecursionlimit(1000000)\nINF = pow(10, 10)\n\nchanged = []\ninput = sys.stdin.readline\nN = int(input())\nA = [int(a) for a in input().split()]\nEdge = [[] for _ in range(N)]\nfor _ in range(N-1):\n u, v = map(int, input().split())\n Edge[u-1].append(v-1)\n Edge[v-1].append(u-1)\nLIS = [INF] * N\n\ndef dfs(i, pre, Ans):\n changeID = bisect_left(LIS, A[i])\n changed.append((changeID, LIS[changeID]))\n LIS[changeID] = min(A[i], LIS[changeID])\n #print(i, LIS)\n #print(changed)\n Ans[i] = bisect_left(LIS, INF) \n for nextN in Edge[i]:\n if nextN != pre: dfs(nextN, i, Ans)\n backID, backV = changed.pop()\n LIS[backID] = backV\n return 0\n\ndef solve():\n Ans = [1] * N\n dfs(0, 0, Ans)\n print("\\n".join(map(str, Ans)))\n \n return 0\n\nif __name__ == "__main__":\n solve()'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s087712954', 's540875112', 's952235664', 's313245605'] | [155316.0, 237980.0, 97012.0, 237776.0] | [2345.0, 1137.0, 876.0, 1128.0] | [855, 858, 1022, 855] |
p02698 | u619144316 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['from collections import defaultdict,deque\nimport bisect\n\nN = int(input())\nA = list(map(int,input().split()))\ngraph = defaultdict(deque)\nfor _ in range(0,N-1):\n u,v = map(int,input().split())\n graph[u].append(v)\n graph[v].append(u)\n\narrive = [False] * (N+1)\ndp_dict = [None] * N\ndp_dict[0] = [A[0]]\n\nans = [None] *(N+1)\ndef dfs(s):\n stack = deque([s])\n while stack:\n v = stack[-1]\n arrive[v] = True\n if graph[v]:\n w = graph[v].pop()\n if arrive[w] == False:\n tar = A[w-1]\n dp = dp_dict[v-1]\n if tar > dp[-1]:\n dp.append(tar)\n else:\n dp[bisect.bisect_left(dp, tar)] = tar\n ans[w] = len(dp)\n dp_dict[w-1] = dp\n stack.append(w)\n\n else:\n stack.pop()\n\n\ndfs(1)\nans[1] = 1\nfor i in ans[1::]:\n print(i)', 'import bisect\nimport sys\ninput = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 7)\n \nN = int(input())\nA = tuple(map(int, input().split()))\ngraph = [[] for _ in range(N + 1)]\nfor _ in range(N - 1):\n x, y = map(int, input().split())\n graph[x].append(y)\n graph[y].append(x)\n \nans = [-1] * (N + 1)\ninf = 10**18\nLIS = [inf] * (N + 1)\n \ndef DFS(s, parent=0):\n a = A[s - 1]\n i = bisect.bisect_left(LIS, a)\n v = LIS[i]\n LIS[i] = a\n ans[s] = bisect.bisect_left(LIS, inf)\n for t in graph[s]:\n if t == parent:\n continue\n DFS(t, s)\n LIS[i] = v\n return\n \nDFS(1)\nprint(*ans[1:], sep="\\n")'] | ['Wrong Answer', 'Accepted'] | ['s674581833', 's706371239'] | [176520.0, 271252.0] | [1275.0, 1100.0] | [914, 639] |
p02698 | u750990077 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['from bisect import bisect_left, bisect, insort\n\ndef dfs(v, p):\n i = bisect_left(dp, a[v])\n dp[i], old = a[v], dp[i]\n ans[v] = i\n if p != -1:\n ans[v] = max(ans[v], ans[p])\n for u in to[v]:\n if u == p:\n continue\n dfs(u, v)\n\nif __name__ == "__main__":\n n = int(input())\n a = list(map(int, input().split()))\n to = [[] for _ in range(n)]\n ans = [None]*n\n INF = 10**10\n for _ in range(n-1):\n u, v = map(int, input().split())\n u -= 1\n v -= 1\n to[u].append(v)\n to[v].append(u)\n dp = [INF]*n\n dp[0] = -INF\n dfs(0, -1)\n print("\\n".join(list(map(str, ans))))', 'from bisect import bisect_left\nimport sys\nsys.setrecursionlimit(1000000)\n\n\ndef dfs(v, p):\n i = bisect_left(dp, a[v])\n dp[i], old = a[v], dp[i]\n ans[v] = bisect_left(dp, INF)\n for u in to[v]:\n if u == p:\n continue\n dfs(u, v)\n dp[i] = old\n\nif __name__ == "__main__":\n n = int(input())\n a = list(map(int, input().split()))\n to = [[] for _ in range(n)]\n ans = [0]*n\n INF = 10**10\n for _ in range(n-1):\n u, v = map(int, input().split())\n u -= 1\n v -= 1\n to[u].append(v)\n to[v].append(u)\n dp = [INF]*n\n dp[0] = -INF\n dfs(0, -1)\n print(*ans, sep="\\n")', 'from bisect import bisect_left\nimport sys\nsys.setrecursionlimit(1000000)\n\n\ndef dfs(v, p):\n i = bisect_left(dp, a[v])\n dp[i], old = a[v], dp[i]\n ans[v] = bisect_left(dp, INF)\n for u in to[v]:\n if u == p:\n continue\n dfs(u, v)\n dp[i] = old\n\nif __name__ == "__main__":\n n = int(input())\n a = list(map(int, input().split()))\n to = [[] for _ in range(n)]\n ans = [None]*n\n INF = 10**10\n for _ in range(n-1):\n u, v = map(int, input().split())\n u -= 1\n v -= 1\n to[u].append(v)\n to[v].append(u)\n dp = [INF]*n\n dp[0] = -INF\n dfs(0, -1)\n print("\\n".join(list(map(str, ans))))', 'from bisect import bisect_left\nimport sys\nsys.setrecursionlimit(1000000)\n\n\ndef dfs(v, p):\n i = bisect_left(dp, a[v])\n dp[i], old = a[v], dp[i]\n ans[v] = bisect_left(dp, INF)-1\n for u in to[v]:\n if u == p:\n continue\n dfs(u, v)\n dp[i] = old\n\nif __name__ == "__main__":\n n = int(input())\n a = list(map(int, input().split()))\n to = [[] for _ in range(n)]\n ans = [0]*n\n INF = 10**20\n for _ in range(n-1):\n u, v = map(int, input().split())\n u -= 1\n v -= 1\n to[u].append(v)\n to[v].append(u)\n dp = [INF]*(n+1)\n dp[0] = -INF\n dfs(0, -1)\n print("\\n".join(list(map(str, ans))))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s198395633', 's387758304', 's966705805', 's673555347'] | [68916.0, 224824.0, 224840.0, 224952.0] | [960.0, 1229.0, 1234.0, 1245.0] | [659, 649, 668, 671] |
p02698 | u836311327 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['from collections import deque\nimport bisect\nimport sys\ndef input(): return sys.stdin.readline().rstrip()\n \ndef main():\n n = int(input())\n graph = [[] for _ in range(n+1)]\n \n A = [0]+list(map(int, input().split()))\n \n for i in range(n-1):\n a, b = map(int, input().split())\n graph[a].append(b)\n graph[b].append(a)\n \n dist = [-1] * (n+1)\n dist[0] = 0\n dist[1] = 1\n \n d = deque()\n d.append((1, [0, A[1]]))\n \n while d:\n v, dp = d.popleft()\n for i in graph[v]:\n if dist[i] != -1:\n continue\n if dp[-1] < A[i]:\n dp.append(A[i])\n d.append((i, dp.copy()))\n dist[i] = len(dp)-1\n dp.pop()\n else:\n bis = bisect.bisect_left(dp, A[i])\n updatetask=dp[bis]\n dp[bis] = A[i]\n dist[i] = len(dp)-1\n d.append((i, dp))\n dp[bis]=updatetask\n \n print(*dist[1:], sep="\\n")\n \nif __name__ == \'__main__\':\n main()', 'from collections import deque\nimport sys\nimport bisect\ndef input(): return sys.stdin.readline().rstrip()\n\nn=int(input())\nA=[0]+list(map(int, input().split()))\n\ngraph = [[] for _ in range(n+1)]\n\nfor i in range(n-1):\n a, b = map(int, input().split())\n graph[a].append(b)\n graph[b].append(a)\n\nvisited = [-1] * (n+1)\nvisited[0] = 0\nvisited[1] = 1\n\nd = deque()\nd.append(1)\ndp=[10**10]*(n+1)\ndp[0]=0\ndp[1]=A[1]\nupdate_task=[() for _ in range(n+1)]\nupdate_task[1]=(1,0)\nwhile d:\n v = d[-1]\n if graph[v] == []:\n d.pop()\n index,atai=update_task[v]\n dp[index]=atai\n else:\n i = graph[v].pop()\n if visited[i] != -1:\n continue\n bis = bisect.bisect_left(dp, A[i])\n update_task[i]=(bis,dp[bis])\n dp[bis] = A[i]\n visited[i] = bisect.bisect_left(dp, 10**10-100)-1\n d.append(i)\n\nprint(*visited[1:], sep="\\n")'] | ['Wrong Answer', 'Accepted'] | ['s353225049', 's032331065'] | [64884.0, 76180.0] | [2207.0, 1071.0] | [1051, 889] |
p02698 | u906501980 | 2,000 | 1,048,576 | We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i. Vertex i has an integer a_i written on it. For every integer k from 1 through N, solve the following problem: * We will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence. Here, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \leq i_1 < i_2 < ... < i_M \leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}. | ['from bisect import bisect_left\nimport sys\nsys.setrecursionlimit(1000000)\n\n\n\ndef dfs(p):\n ai = a[p]\n i = bisect_left(dp, ai)\n old = dp[i]\n dp[i] = ai\n ans[p] = bisect_left(dp, INF)-1\n for child in to[p]:\n if ans[child] is None:\n dfs(child)\n dp[i] = old\n \n \n \n\nif __name__ == "__main__":\n n = int(input())\n a = [None] + list(map(int, input().split()))\n to = [[] for _ in range(n+1)]\n for _ in range(n-1):\n u, v = map(int, input().split())\n to[u].append(v)\n to[v].append(u)\n INF = 10**20\n dp = [INF]*(n+1)\n dp[0]= -INF\n q = deque([1])\n ans = [None]*(n+1)\n dfs(1)\n print("\\n".join(list(map(str, ans[1:]))))', 'from bisect import bisect_left\nimport sys\nsys.setrecursionlimit(1000000)\n\n\n\ndef dfs(p):\n ai = a[p]\n i = bisect_left(dp, ai)\n old = dp[i]\n dp[i] = ai\n ans[p] = bisect_left(dp, INF)-1\n for child in to[p]:\n if ans[child] is None:\n dfs(child)\n dp[i] = old\n \n \n \n\nif __name__ == "__main__":\n n = int(input())\n a = [None] + list(map(int, input().split()))\n to = [[] for _ in range(n+1)]\n for _ in range(n-1):\n u, v = map(int, input().split())\n to[u].append(v)\n to[v].append(u)\n INF = 10**20\n dp = [INF]*(n+1)\n dp[0]= -INF\n ans = [None]*(n+1)\n dfs(1)\n print("\\n".join(list(map(str, ans[1:]))))'] | ['Runtime Error', 'Accepted'] | ['s332363135', 's378824458'] | [51904.0, 214624.0] | [617.0, 1277.0] | [708, 689] |
p02699 | u000037600 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['a,b=map(int,input().split())\nif a=<b:\n print("unsafe")\nelse:\n print("safe")', 'a,b=map(int,input().split())\nif a<=b:\n print("unsafe")\nelse:\n print("safe")'] | ['Runtime Error', 'Accepted'] | ['s509731296', 's669491496'] | [8944.0, 9132.0] | [25.0, 33.0] | [77, 77] |
p02699 | u001207097 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["a ,b = input().split()\n\nif a<b:\n\tprint('safe')\nelse:\n\tprint('unsafe')\n", "a ,b = input().split()\n\na=int(a)\nb=int(b)\nif a<b:\n\tprint('safe')\nelse:\n\tprint('unsafe')\n", "a , b , c , d = input().split()\n\na=int(a)\nb=int(b)\nc=int(c)\nd=int(d)\n\nwhile True:\n c -= b\n if c <= 0:\n print('Yes')\n break\n a -= d\n if a <= 0:\n print('No')\n break\n\n", "a ,b = input().split()\n\na=int(a)\nb=int(b)\nif a>b:\n\tprint('safe')\nelse:\n\tprint('unsafe')\n"] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s092425914', 's338095404', 's783221170', 's777451871'] | [9104.0, 9156.0, 9112.0, 9152.0] | [21.0, 23.0, 22.0, 22.0] | [70, 88, 180, 88] |
p02699 | u001769145 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['# A\n# Sheep and Wolves\n\ns w = map(int, input().split())\n\nif s <= w:\n print("unsafe")\nelse:\n print("safe")', '# A\n# Sheep and Wolves\n\ns, w = map(int, input().split())\n\nif s <= w:\n print("unsafe")\nelse:\n print("safe")'] | ['Runtime Error', 'Accepted'] | ['s989889862', 's746799030'] | [8896.0, 9188.0] | [22.0, 20.0] | [111, 112] |
p02699 | u002611201 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['lists = list(map(int, input().split())) \nif lists[0] <= lists[1]:\n print("unsate")\nelse:\n print(\'safe\')', 'lists = list(map(int, input().split())) \nif lists[0] <= lists[1]:\n print("unsafe")\nelse:\n print(\'safe\')'] | ['Wrong Answer', 'Accepted'] | ['s152853328', 's738555494'] | [9160.0, 9096.0] | [24.0, 23.0] | [209, 209] |
p02699 | u004062344 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['s, w = list(map(int, input("sとw入力して").split()))\n\nif w >= s:\n print("unsafe")\nelse:\n print("safe")', 's, w = list(map(int, input().split()))\n\nif w >= s:\n print("unsafe")\nelse:\n print("safe")'] | ['Wrong Answer', 'Accepted'] | ['s974827862', 's623168866'] | [9008.0, 9172.0] | [21.0, 21.0] | [113, 94] |
p02699 | u004823354 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['S = int(input())\nW = int(input())\nif S > W:\n print("safe")\nelse:\n print("unsafe")', 'S = int(input())\nW = int(input())\nif S > W:\n print("safe")\nelse:\n print("unsafe")', 'S = int(input())\nW = int(input())\nif W >= S:\n print("unsafe")\nelse:\n print("safe")', "s, w = map(int, input().split())\n \nif s <= w:\n print('unsafe')\nelse:\n print('safe')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s871122720', 's929891939', 's999074280', 's903532159'] | [9160.0, 9064.0, 8836.0, 9092.0] | [27.0, 23.0, 25.0, 28.0] | [83, 83, 84, 85] |
p02699 | u005960309 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['S = input()\n\ncount = 0\n\nfor i in len(S):\n for j in range(i, len(S)):\n if int(S[i:j]) % 2019 == 0:\n count += 1\n \n \nprint(count)', "S, W = map(int, input().split())\nif S <= W:\n print('unsafe')\nelse:\n print('safe')"] | ['Runtime Error', 'Accepted'] | ['s897601721', 's118277709'] | [9108.0, 9160.0] | [21.0, 20.0] | [157, 83] |
p02699 | u007738720 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["a,b,c,d=map(int,input().split())\nwhile True:\n c-=b\n if c<=0:\n print('Yes')\n break\n a-=d\n if a<=0:\n print('No')\n break", "S,W=map(int,input().split())\nwhile 1<=S<=100:\n while 1<=W<=100:\n if S>W:\n print('safe')\n else:\n print('unsafe')", "S,W=map(int,input().split())\n\nif S>W:\n print('safe')\nelse:\n print('unsafe')"] | ['Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s261278783', 's285719715', 's815492702'] | [9168.0, 54704.0, 9164.0] | [23.0, 2276.0, 23.0] | [133, 128, 77] |
p02699 | u008022357 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['A, B, C, D = map(int,input().split())\n\nwhile(A or C != 0):\n C = C - B\n if(C <= 0):\n print("Yes")\n break\n A = A - D\n if(A <= 0):\n print("No")\n break', 's, w = map(int,input().split())\n\nif(s <= w):\n print("unsafe")\nelse:\n print("safe")'] | ['Runtime Error', 'Accepted'] | ['s415157222', 's236642494'] | [9176.0, 9088.0] | [22.0, 20.0] | [187, 88] |
p02699 | u010576583 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['a, b = raw_input()\nif a < b:\n print(unsafe)\nelse:\n print(safe)', 'a, b = input()\nif a < b:\n print(unsafe)\nelse:\n print(safe)', "s = input()\nl = [int(item) for item in s.split()]\nif l[0] <= l[1]:\n print('unsafe')\nelse:\n print('safe')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s260233739', 's550090152', 's679248543'] | [8944.0, 8952.0, 9156.0] | [23.0, 21.0, 23.0] | [64, 60, 106] |
p02699 | u011202375 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['A,B=map(int,input().split())\nprint("safe" if S>W else "unsafe")', 'A,B=map(int,input().split())\nprint("safe" if A>B else "unsafe")'] | ['Runtime Error', 'Accepted'] | ['s995903916', 's051140590'] | [9156.0, 9052.0] | [25.0, 25.0] | [63, 63] |
p02699 | u018258333 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["s,w = map(int,input().split())\n\nif s>=w:\n print('unsafe')\nelse:\n print('safe')", "s,w = map(int,input().split())\n\nif s<=w:\n print('unsafe')\nelse:\n print('safe')"] | ['Wrong Answer', 'Accepted'] | ['s004531904', 's011590830'] | [9164.0, 9108.0] | [22.0, 24.0] | [80, 80] |
p02699 | u018846452 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["s, w = map(int, input().split())\nif s < w:\n print('safe')\nelse:\n print('unsafe')", "s, w = map(int, input().split())\nif s > w:\n print('safe')\nelse:\n print('unsafe')"] | ['Wrong Answer', 'Accepted'] | ['s748444015', 's498016302'] | [9032.0, 9080.0] | [27.0, 29.0] | [82, 82] |
p02699 | u021019433 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["s, w = map(int, input().split())\nprint('un'*(s>=w)+'safe')", "s, w = map(int, input().split())\nprint('un'*(s<=w)+'safe')"] | ['Wrong Answer', 'Accepted'] | ['s180107083', 's073667874'] | [9152.0, 9148.0] | [23.0, 22.0] | [58, 58] |
p02699 | u021387650 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["S,W = map(int,input().split())\n\nif s <= w:\n print('unsafe')\nelse:\n print('safe')", "A,B,C,D = map(int,input().split())\n \nTakahashi = A\nAoki = C\n \nwhile Takahashi >= 0 or Aoki >=0:\n Aoki -= B\n if Aoki <= 0:\n print('Yes')\n break\n Takahashi -= D\n if Takahashi <= 0:\n print('No')\n break", "A,B,C,D = map(int,input().split())\n\nTakahashi = A\nAoki = B\n\nwhile Takahashi <= 0 or Aoki <=0:\n Aoki -= B\n if Aoki <= 0:\n print('Yes')\n break\n Takahashi -= D\n if Takahashi <= 0:\n print('No')\n break", "S,W = map(int,input().split())\n \nif S <= W:\n print('unsafe')\nelse:\n print('safe')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s023559370', 's444780129', 's484719698', 's169768225'] | [9052.0, 9096.0, 9196.0, 9160.0] | [24.0, 24.0, 24.0, 21.0] | [82, 214, 212, 83] |
p02699 | u021770165 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['s = int(input())\nw = int(input())\n\nif w >= s:\n print("unsafe")\nelif w < s:\n print("safe")', 's,w = map(int,input().split())\nif w >= s:\n print("unsafe")\nelif w < s:\n print("safe")'] | ['Runtime Error', 'Accepted'] | ['s762884086', 's456267198'] | [9096.0, 9160.0] | [25.0, 28.0] | [91, 88] |
p02699 | u021851796 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['S,W = map(int, input().split())\nif S>W:\n print("safe")\nelse:\n print("unsafe)', 's,w = int(input())\nif s>w:\n print("safe")\nelse:\n print("unsafe)', 's,w = int(input())\nif s>w:\n print("safe")\nelse:\n print("unsafe")', 'S,W = map(int, input().split())\nif S>W:\n print("safe")\nelse:\n print("unsafe")'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s099366760', 's739755488', 's763613379', 's037909381'] | [8960.0, 9020.0, 9156.0, 9156.0] | [22.0, 21.0, 19.0, 22.0] | [78, 65, 66, 79] |
p02699 | u026788530 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['s,w=[int(x) for x in input().splir()]\n\nif(s>w):\n print("safe")\nelse:\n print("unsafe")', 's,w=[int(x) for x in input().split()]\n \nif(s>w):\n print("safe")\nelse:\n print("unsafe")'] | ['Runtime Error', 'Accepted'] | ['s455850225', 's344213276'] | [9096.0, 9096.0] | [23.0, 24.0] | [87, 88] |
p02699 | u032798323 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['S,W = list(map(int,input().split()))\n\nif S =< W:\n print("unsafe")\nelse:\n print("safe")', 'S,W = list(map(int,input().split()))\n\nif S <= W:\n print("unsafe")\nelse:\n print("safe")'] | ['Runtime Error', 'Accepted'] | ['s373145824', 's911841804'] | [8832.0, 9156.0] | [24.0, 21.0] | [92, 92] |
p02699 | u038408819 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["s = input()\ncnt = 0\nans = []\nfor i in range(0, len(s) - 3):\n j = i\n num = ''\n while j < len(s):\n juhuku = 0\n num += s[j]\n if int(num) % 2019 == 0 and num != '0':\n #print(i, j)\n if j not in ans:\n ans.append(j)\n juhuku = ans.count(i - 1)\n cnt += 1 + juhuku\n j += 1\nprint(cnt)", "s = input()\ncnt = 0\nans = []\nfor i in range(0, len(s) - 3):\n j = i\n num = ''\n while j < len(s):\n juhuku = 0\n num += s[j]\n if int(num) % 2019 == 0 and num != '0':\n #print(i, j)\n if j not in ans:\n ans.append(j)\n juhuku = ans.count(i - 1)\n cnt += 1 + juhuku\n j += 1\nprint(ans)\n", "s = input()\ncnt = 0\nans = []\nfor i in range(0, len(s) - 3):\n j = i\n num = ''\n while j < len(s):\n juhuku = 0\n num += s[j]\n if int(num) % 2019 == 0 and num != '0':\n print(i, j)\n if j not in ans:\n ans.append(j)\n juhuku = ans.count(i - 1)\n cnt += 1 + juhuku\n j += 1\ncnt, ans", "s, w = map(int, input().split())\nif s <= w:\n print('unsafe')\nelse:\n print('safe')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s541681832', 's950620907', 's980350538', 's452403195'] | [9076.0, 9072.0, 9144.0, 9156.0] | [23.0, 22.0, 24.0, 22.0] | [369, 370, 366, 87] |
p02699 | u039189422 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['s=input()\n\nd=[0]*2019\ndp=0\nd[0]+=1\nl=len(s)\n\nfor i in range(l-1,-1,-1):\n\tdp = (dp+int(s[i])*(10**(l-1-i)))%2019\n\td[dp]+=1\nres=0\n\nfor a in d:\n\tres+=a*(a-1)//2\n\t\nprint(res)', 's,w=map(int,input().split())\nprint("safe") if s>w else print("unsafe")'] | ['Runtime Error', 'Accepted'] | ['s617251641', 's597716793'] | [9216.0, 9088.0] | [21.0, 21.0] | [170, 70] |
p02699 | u039934639 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['import collections\n\nN = int(input())\nS = [input() for i in range(N)]\n\nans = collections.Counter(S)\nprint(len(ans))', "S, W = map(int, input().split())\nif S <= W:\n print('unsafe')\nelse:\n print('safe')\n "] | ['Runtime Error', 'Accepted'] | ['s203979480', 's298247406'] | [9404.0, 9148.0] | [26.0, 20.0] | [114, 86] |
p02699 | u040642458 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['S,W=input(),sep(",")\nS=int(S)\n\nW=int(W)\n\nif W >= S:\n print("unsafe")\n else:\n print("safe")\n', 'S=input()\nS=int(S)\n\nW=input()\nW=int(W)\n\nif W>S:\n print("unsafe")\n else:\n print("safe")', 'S=input()\nS=int(S)\n\nW=input()\nW=int(W)\n\nif W>=S:\n print("unsafe")\nelse:\n print("safe")\n', 'S,W=input().split("")\nS=int(S)\n\nW=int(W)\n\nif W >= S:\n print("unsafe")\nelse:\n print("safe")\n', 's ,w = input(). int(" ")\n\ns=int(s)\nw=int(w)\n\nif w >= s :\n print("unsafe")\nelse :\n print("safe")', 'S=input()\nS=int(S)\n\nW=input()\nW=int(W)\n\nif W>=S:\n print("unsafe")\n else:\n print("safe")', 'S,W=input(),sep(",")\nS=int(S)\n\nW=int(W)\n\nif W >= S:\n print("unsafe")\nelse:\n print("safe")\n', 'S,W=input().sep("")\nS=int(S)\n\nW=int(W)\n\nif W >= S:\n print("unsafe")\nelse:\n print("safe")\n', 'S,W=input(),sep(",")\nS=int(S)\n\nW=int(W)\n\nif W >= S:\n print("unsafe")\nelse:\n print("safe")\n', 's ,w = input(). split(" ")\n\ns=int(s)\nw=int(w)\n\nif w >= s :\n print("unsafe")\nelse :\n print("safe")\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s182484275', 's431845155', 's603565950', 's728360699', 's793474683', 's892589369', 's966044931', 's966808836', 's986729540', 's856035243'] | [8924.0, 9028.0, 9076.0, 8964.0, 9056.0, 8968.0, 9036.0, 8964.0, 9100.0, 9156.0] | [23.0, 19.0, 20.0, 21.0, 21.0, 22.0, 21.0, 22.0, 23.0, 23.0] | [96, 91, 91, 93, 97, 92, 92, 91, 94, 100] |
p02699 | u042558137 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["S, W = map(int, input().split())\nif W >= S:\n print('safe')\nelse:\n print('unsafe')", "S, W = map(int, input().split())\n\nif W >= S:\n print('unsafe')\nelse:\n print('safe')"] | ['Wrong Answer', 'Accepted'] | ['s290102707', 's989050887'] | [9160.0, 9160.0] | [23.0, 23.0] | [87, 88] |
p02699 | u044459372 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["def main():\n s, w = map(int, input().split())\n print('unsefe' if w >= s else 'safe')\n\nif __name__ == '__main__':\n main()", "def main():\n s, w = map(int, input().split())\n print('unsafe' if w >= s else 'safe')\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s115759453', 's172265899'] | [9140.0, 9112.0] | [21.0, 22.0] | [129, 129] |
p02699 | u046190224 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["W:int\nS:int\n\nif W >= S:\n print('unsafe')\nelse:\n print('safe')", 'if W >= S:\n return "unsafe"\nelse:\n return "safe"', "W,S = [int(x) for x in input().split()]\n \nif W >= S:\n print('unsafe')\nelse:\n print('safe')", 'if W >= S:\n print("unsafe")\nelse:\n print("safe")', "if W >= S:\n print('unsafe')\nelse:\n print('safe')", "for W in range(1,100):\n for S in range(1,100):\n if W >= S:\n print('unsafe')\n else:\n print('safe')", "W,S = [int(x) for x in input().split()]\n\nif W >= S:\n print('unsafe')\nelse:\n print('safe')", 'if W > S:\n return "unsafe"\nelse:\n return "safe"', "S, W = [int(x) for x in input().split()]\n \nif W >= S:\n print('unsafe')\nelse:\n print('safe')"] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s164949786', 's194763383', 's198585130', 's359569159', 's396067810', 's420247236', 's677752208', 's811019632', 's492757492'] | [9012.0, 8972.0, 9160.0, 8976.0, 9080.0, 9120.0, 9104.0, 9080.0, 9068.0] | [21.0, 23.0, 22.0, 21.0, 22.0, 27.0, 21.0, 24.0, 22.0] | [63, 50, 92, 50, 50, 136, 91, 49, 93] |
p02699 | u048546501 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["a,b=map(int,input().sprit())\nif a<=b:print('unsafe')\nelse:print('safe')", "a,b=map(int,input().sprit())\nif a>b:print('unsafe')\nelse:print('safe')", "a,b=map(int,input().split())\nif a<=b: print('unsafe')\nelse: print('safe')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s390334513', 's407919922', 's174593369'] | [9064.0, 9032.0, 9108.0] | [21.0, 24.0, 20.0] | [71, 70, 73] |
p02699 | u048872153 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['s,w = int(input().split())\nif w > s:\n print("unsafe") \nelse:\n print("safe")', 's,w = map(int,input().split())\nif w > s or w = s:\n print("unsafe") \nelse:\n print("safe")', 's,w = map(int,input().split())\nif w > s or w == s:\n print("unsafe") \nelse:\n print("safe")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s533154568', 's547324258', 's358259595'] | [8872.0, 8996.0, 9164.0] | [26.0, 20.0, 20.0] | [77, 90, 91] |
p02699 | u051298937 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['a,b,c,d = map(int,input().split())\nfor i in range(100):\n if c-b <= 0:\n print("yes")\n break\n elif a-d <= 0:\n print("No")\n break\n else:\n a = a-d\n c = c-b', 's,w = map(int,input().split())\nif s <= w:\n print("unsafe")\nelse:\n print("safe")'] | ['Runtime Error', 'Accepted'] | ['s648478983', 's071750459'] | [9200.0, 9156.0] | [22.0, 21.0] | [203, 85] |
p02699 | u053155838 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['x , y = map(int, input().split())\nif x>=y :\n print("unsafe")\nelse:\n print("safe")', 'x, y = map(int,input().split())\nif x<y:\n print("unsafe")\nelse:\n print("safe\')', 's, w = map(int,input().split())\nif w>=s:\n print("unsafe")\nelse:\n print("safe")'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s274334348', 's464968045', 's840280452'] | [9160.0, 8956.0, 9156.0] | [21.0, 24.0, 24.0] | [83, 79, 80] |
p02699 | u055668007 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["A,B,C,D = map(int,input().split())\n\nX = A // D\nY = C // B\n\nif A % D > 0:\n X += 1\n\nif C % B > 0:\n Y += 1\n\nif Y > X:\n print('No')\nelse :\n print('Yes')", "X,Y = map(int,input().split())\n\nif X > Y:\n print('safe')\nelse:\n print('unsafe')\n \n"] | ['Runtime Error', 'Accepted'] | ['s727954329', 's106279111'] | [9112.0, 9148.0] | [21.0, 20.0] | [152, 87] |
p02699 | u057993957 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['s = input()\n\ncnt = 0\nfor i in range(len(s)):\n for j in range(i+1, len(s)+1):\n if int(s[i:j]) % 2019 == 0:\n cnt += 1\nprint(cnt)', 's, w = list(map(int, input().split()))\n\nprint("unsafe" if s <= w else "safe")'] | ['Runtime Error', 'Accepted'] | ['s911758490', 's596140347'] | [9060.0, 9148.0] | [20.0, 24.0] | [147, 77] |
p02699 | u058264533 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['from sys import stdin\ninput = stdin.readline\n\nimport sys\n\nA, B, C, D= map(int, input().split())\n\nif C - B <= 0:\n print("yes")\n sys.exit()\nelif A - D <= 0:\n print("No")\n sys.exit()\n\naoki = C - B\ntaka = A - D\n\nfor i in range(1000):\n aoki -= B\n if aoki <= 0:\n print("Yes")\n break\n \n taka -= D\n if taka <= 0:\n print("No")\n break\n \n', 'from sys import stdin\ninput = stdin.readline\n\nS,W = map(int, input().split())\n\nif W >= S :\n print("unsafe")\nelse:\n print("safe")'] | ['Runtime Error', 'Accepted'] | ['s273565704', 's893271536'] | [9068.0, 9160.0] | [24.0, 24.0] | [385, 134] |
p02699 | u060012100 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['S= int(input())\nW= int(input())\nif(W>=S):\n print("unsafe")\nelse:\n print("safe")', 'S,W =map(int,input().split())\nif(W>=S):\n print("unsafe")\nelse:\n print("safe")\n'] | ['Runtime Error', 'Accepted'] | ['s869892162', 's184121013'] | [9148.0, 9108.0] | [24.0, 23.0] | [81, 80] |
p02699 | u061566631 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['import sys\ninput = sys.stdin.readline\n\n\ndef main():\n S = input().strip()\n answer = []\n for i in range(1, len(S)+1):\n [answer.append(j) for j in range(i+4, len(S)+1)\n if int(S[i-1:j]) % 2019 == 0]\n print(len(answer))\n\n\nif __name__ == "__main__":\n main()\n', 'import sys\ninput = sys.stdin.readline\n\n\ndef main():\n S, W = map(int, input().split())\n print("safe") if S > W else print("unsafe")\n\n\nif __name__ == "__main__":\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s276703431', 's082947888'] | [9168.0, 9176.0] | [24.0, 23.0] | [283, 177] |
p02699 | u065994196 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['def check(a,b,c,d):\n\twhile(a>0 and c>0):\n\t\tc-=b\n\t\tif(c==0):\n\t\t\treturn 1\n\t\ta-=d\n\t\tif(a==0):\n\t\t\treturn 0\n\tif(a<0):\n\t\treturn 0\n\tif(c < 0):\n\t\treturn 1\ninp1=list(map(int,input().strip().split()))[:4]\na,b,c,d=inp1[0],inp1[1],inp1[2],inp1[3]\nif(check(a,b,c,d)):\n\tprint("Yes")\nelse:\n\tprint("No")', 'def check(a,b,c,d):\n\twhile(a>0 and c>0):\n\t\tc-=b\n\t\tif(c==0):\n\t\t\treturn 1\n\t\ta-=d\n\t\tif(a==0):\n\t\t\treturn 0\n\tif(a<0):\n\t\treturn 0\n\tif(c < 0)\n\t\treturn 1\ninp1=list(map(int,input().strip().split()))[:4]\na,b,c,d=inp1[0],inp1[1],inp1[2],inp1[3]\nif(check(a,b,c,d)):\n\tprint("Yes")\nelse:\n\tprint("No")', 'inp1=list(map(int,input().strip().split()))[:2]\ns,w=inp1[0],inp1[1]\nif(w >= s):\n\tprint("unsafe")\nelse:\n\tprint("safe")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s076376891', 's429067177', 's488100374'] | [9148.0, 8968.0, 9168.0] | [23.0, 24.0, 22.0] | [287, 286, 117] |
p02699 | u067986264 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['S, W = map(int, input().split())\nif S =< W:\n print("unsafe")\nelse:\n print("safe")\n', 'S, W = map(int, input().split())\nif S <= W:\n print("unsafe")\nelse:\n print("safe")\n'] | ['Runtime Error', 'Accepted'] | ['s451720116', 's219494102'] | [8964.0, 9152.0] | [20.0, 23.0] | [88, 88] |
p02699 | u068727970 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["S, W = map(int, input().split())\nif W >= S:\n print('unsage')\nelse:\n print('safe')\n", "S, W = map(int, input().split())\nif W >= S:\n print('unsafe')\nelse:\n print('safe')\n"] | ['Wrong Answer', 'Accepted'] | ['s013017605', 's606875815'] | [9152.0, 9152.0] | [23.0, 24.0] | [88, 88] |
p02699 | u069479805 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['takahashi_h, takahashi_a, aoki_h, aoki_a = map(int, input().split())\n\nif takahashi_h // aoki_a < aoki_h // takahashi_a:\n print("Yes")\nelif takahashi_h // aoki_a > aoki_h // takahashi_a:\n print("No")\nelse:\n takahashi_h = takahashi_h - (aoki_a * (takahashi_h // aoki_a))\n aoki_h = aoki_h - (takahashi_a * (aoki_h // takahashi_a))\n \n if aoki_h > 0 and takahashi_h == 0:\n print("No")\n else:\n print("Yes")', 'takahashi_h, takahashi_a, aoki_h, aoki_a = map(int, input().split())\n\nif takahashi_h // aoki_a > aoki_h // takahashi_a:\n print("Yes")\nelif takahashi_h // aoki_a < aoki_h // takahashi_a:\n print("No")\nelse:\n takahashi_h = takahashi_h - (aoki_a * (takahashi_h // aoki_a))\n aoki_h = aoki_h - (takahashi_a * (aoki_h // takahashi_a))\n \n if aoki_h > 0 and takahashi_h == 0:\n print("No")\n else:\n print("Yes")', 'S, W = map(int, input().split())\nif S > W:\n print("safe")\nelse:\n print("unsafe")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s314600570', 's360660497', 's096574186'] | [9096.0, 9084.0, 9100.0] | [26.0, 21.0, 21.0] | [435, 435, 86] |
p02699 | u075303794 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nS,W = map(int, readline())\n\n\nif S > W:\n print('safe')\nelse:\n print('unsafe')", "import sys\n \nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n \nS,W = map(int, readline().split())\n \n \nif S > W:\n print('safe')\nelse:\n print('unsafe')"] | ['Runtime Error', 'Accepted'] | ['s918808932', 's351558919'] | [9172.0, 9220.0] | [24.0, 20.0] | [196, 208] |
p02699 | u075304271 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["import math\nimport collections\nimport fractions\nimport itertools\n \ndef solve():\n n = int(input())\n s = [input() for i in range(n)]\n print(len(set(s)))\n return 0\n \nif __name__ == '__main__':\n solve()", 'import itertools\n\ndef solve():\n s, w = map(int, input().split())\n if s > w:\n print("safe")\n else:\n print("unsafe")\n return 0\n \nif __name__ == "__main__":\n solve()\n'] | ['Runtime Error', 'Accepted'] | ['s704089925', 's114051414'] | [10460.0, 9108.0] | [34.0, 22.0] | [213, 174] |
p02699 | u075595666 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["s,w = map(int,input().split())\nif s>w/2 :\n print('safe')\nelse:\n print('unsafe')", "s,w = map(int,input().split())\nif s>w :\n print('safe')\nelse:\n print('unsafe')\n"] | ['Wrong Answer', 'Accepted'] | ['s010123232', 's791171150'] | [9156.0, 9148.0] | [26.0, 22.0] | [81, 80] |
p02699 | u079022116 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["s,w=map(int,input().split())\nif n <= m:\n print('unsafe')\nelse:\n print('safe')", "s,w=map(int,input().split())\nif s <= w:\n print('unsafe')\nelse:\n print('safe')"] | ['Runtime Error', 'Accepted'] | ['s957870895', 's100435573'] | [9180.0, 9184.0] | [20.0, 23.0] | [79, 79] |
p02699 | u080490408 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['a=int(input())\nb,c=[int(x) for x in input().split()]\ns=input()\nprint(a+b+c, s)\n\n', 'b,c=[int(x) for x in input().split()]\nif c>=b:\n print("unsafe")\nelse:\n print("safe")\n'] | ['Runtime Error', 'Accepted'] | ['s304255373', 's923703722'] | [9096.0, 9156.0] | [22.0, 24.0] | [80, 91] |
p02699 | u083874202 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['A, B, C, D = map(int, input().split())\n\nThit = A\nTatk = B\nAhit = C\nAatk = D\nwin = False\n\nwhile Thit < 0 or Ahit < 0:\n Ahit = Ahit - Tatk\n if Ahit < 0:\n win = True\n break\n Thit = Thit - Aatk\n if Thit < 0:\n break\n\nif win:\n print("Yes")\nelse:\n print("No")', "import math\n\n#I = int(input())\n\nN, M = map(int, input().split())\n\n#N = input()\n\n#listA = list(N)\n\n#list = list(map(int, input().split()))\n\nif N>M:\n print('unsafe')\nelse:\n print('safe')", '\nA, B, C, D = map(int, input().split())\n\nThit = A\nTatk = B\nAhit = C\nAatk = D\nwin = False\n\nwhile Thit <= 0 or Ahit <= 0:\n Ahit = Ahit - Tatk\n if Ahit <= 0:\n win = True\n break\n Thit = Thit - Aatk\n if Thit <= 0:\n break\n\nif win:\n print("Yes")\nelse:\n print("No")', "import math\n\n#I = int(input())\n\nN, M = map(int, input().split())\n\n#N = input()\n\n#listA = list(N)\n\n#list = list(map(int, input().split()))\n\nif N>M:\n print('safe')\nelse:\n print('unsafe')"] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s305182376', 's307446462', 's435413988', 's173244986'] | [9192.0, 9156.0, 9132.0, 9036.0] | [24.0, 20.0, 22.0, 23.0] | [291, 340, 296, 340] |
p02699 | u086624329 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["S=int(input())\nW=int(input())\n\nif S<=W:\n print('unsafe')\n \nelse:\n print('safe')", "if S<=W:\n print('unsafe')\n \nelse:\n print('safe')", "S,W=map(int,input().split())\n\nif S<=W:\n print('unsafe')\n \nelse:\n print('safe')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s121952153', 's889975187', 's162964578'] | [9084.0, 8932.0, 9100.0] | [20.0, 20.0, 22.0] | [88, 57, 87] |
p02699 | u088115428 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['a,b = map(int, input().split())\nif a>b:\n print("Safe")\nelse:\n print("Unsafe")', '# cook your dish here\na,b = map(int, input().split())\nif a>b:\n print("safe")\nelse:\n print("unsafe")'] | ['Wrong Answer', 'Accepted'] | ['s960677313', 's906548912'] | [9160.0, 9100.0] | [23.0, 23.0] | [80, 102] |
p02699 | u088821409 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['s , w = int(input())\n\nif s > w:\n print("safe")\nelse:\n print("unsafe")', 's , w = map(int, input().split())\n\nif s > w:\n print("safe")\nelse:\n print("unsafe")'] | ['Runtime Error', 'Accepted'] | ['s982562211', 's392831115'] | [9092.0, 9172.0] | [22.0, 22.0] | [71, 84] |
p02699 | u089504174 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["s,w=int(input().split())\nif w>=s:\n print('unsafe')\nelse:\n print('safe')", "s,w=map(int,input().split())\nif w>=s:\n print('unsafe')\nelse:\n print('safe')\n"] | ['Runtime Error', 'Accepted'] | ['s741771786', 's212000875'] | [9088.0, 9116.0] | [24.0, 20.0] | [73, 78] |
p02699 | u089786098 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['a, b, c, d = input().split()\na = int(a)\nb = int(b)\nc = int(c)\nd = int(d)\n\nx = a//d +1\ny = c//b\n\nif y == 1:\n if x <= y:\n \tprint("No")\n print("No")\nelse:\n print("Yes")', 'a, b, c, d = input().split()\na = int(a)\nb = int(b)\nc = int(c)\nd = int(d)\n\nx = a//d +1\ny = c//b\n\nif y == 1:\n if x <= y:\n \tprint("NO")\n print("No")\nelse:\n print("Yes")\nprint(x,y)', "a, b = input().split()\na = int(a)\nb = int(b)\n\nif a > b:\n print('safe')\nelse:\n print('unsafe')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s034371830', 's195687948', 's810440064'] | [9112.0, 9060.0, 9164.0] | [23.0, 21.0, 20.0] | [183, 194, 95] |
p02699 | u090068671 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["S, W = map(lambda x: int(x), input().split())\nif S > W:\n print('safe')\n else:\n print('unsafe')", "S, W = map(lambda x: int(x), input().split())\nif S > W:\n print('safe')\nelse:\n print('unsafe')"] | ['Runtime Error', 'Accepted'] | ['s387925464', 's201273007'] | [9012.0, 9164.0] | [23.0, 22.0] | [99, 95] |
p02699 | u090406054 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["if S =< W :\n print('unsafe')\n \nelse:\n print('safe')\n", "if int('S') =< int('W') :\n print('unsafe')\n \nelse:\n print('safe')", "S, W = map(int, input().split())\nif S =< W:\n print('unsafe')\n \nelse:\n print('safe')", "S = input()\nW = input()\nif int(S) =< int(W):\n print('unsafe')\n \nelse: \n print('safe)", "S, W = map(int, input().split())\nif S <= W:\n print('unsafe')\n \nelse:\n print('safe')\n"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s056969285', 's851395530', 's905525463', 's912348367', 's236477595'] | [8944.0, 9004.0, 8944.0, 9004.0, 9148.0] | [23.0, 20.0, 25.0, 21.0, 22.0] | [54, 67, 86, 87, 87] |
p02699 | u091412190 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["S,W = map(int,input().split())\nif W >= S:\n print('false')\nelse:\n print('safe')", "S,W = map(int,input().split)\nif S >= W:\n print('unsafe')\nelse:\n print('safe')", "S,W = map(int,input().split())\nif W >= S:\n print('false')\nelse:\n print('safe')", "S,W = map(int,input().split())\nif W >= S:\n print('unsafe')\nelse:\n print('safe')\n"] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s046907692', 's312008570', 's449120063', 's237268967'] | [9156.0, 8836.0, 9160.0, 9088.0] | [21.0, 20.0, 22.0, 23.0] | [80, 79, 80, 82] |
p02699 | u093522707 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['S = int(input())\nW = int(input())\nif S > W:\n print("safe")\nelse:\n print("unsafe")', 'S = input()\nW = input()\nif S > W:\n print("safe")\nelse:\n print("unsafe")', 'S, W = map(int, input().split())\nif S > W:\n print("safe")\n else:\n print("unsafe")', 'S, W = map(int, input().split())\nif S > W:\n print("safe")\nelse:\n print("unsafe")'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s319856925', 's532017390', 's624093955', 's471350826'] | [9148.0, 9088.0, 9024.0, 9164.0] | [22.0, 24.0, 21.0, 21.0] | [83, 73, 86, 82] |
p02699 | u095676321 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['import tensorflow\nS, W = map(int, input().split())\ndef f():\n if W >= S:\n return "unsafe"\n else:\n return "safe"\nprint(f())\n', 'S, W = map(int, input().split())\ndef f():\n if W >= S:\n return "unsafe"\n else:\n return "safe"\nprint(f())\n'] | ['Runtime Error', 'Accepted'] | ['s454148210', 's729717776'] | [9032.0, 9160.0] | [21.0, 24.0] | [130, 112] |
p02699 | u097069712 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['S=int(input())\nW=10\n\nif S>W:\n\tprint("safe")\nif S<W:\n\tprint("unsafe")', 'S,W=map(int, input().split())\n \nif S>W:\n\tprint("safe")\nif S<W:\n\tprint("unsafe")\nif S=W:\n\tprint("unsafe")', 'S=input()\nW=10\nif S>W:\n\tprint("safe")\nif W>S:\n\tprint("unsafe")', 'S=int(input())\nW=10\n \nif S>W:\n\tprint("safe")\nif S<W:\n\tprint("unsafe")\nif S=W:\n\tprint("unsafe")\n', 'S,W=map(int, input().split())\n \nif S>W:\n\tprint("safe")\nif S<W:\n\tprint("unsafe")\nif S==W:\n\tprint("unsafe")'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s091026857', 's227869647', 's470411534', 's671770025', 's054768145'] | [9100.0, 8964.0, 9100.0, 8756.0, 9164.0] | [22.0, 22.0, 22.0, 23.0, 23.0] | [68, 104, 62, 95, 105] |
p02699 | u098407852 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ["sheep = input()\nwolves = input()\n\nif sheep > wolves:\n print('safe')\nelse:\n print('unsafe')", "import sys\n\nsheep,wolves = (int(x) for x in input().split())\n\nif sheep > wolves:\n print('safe')\nelse:\n print('unsafe')"] | ['Runtime Error', 'Accepted'] | ['s345531304', 's403154929'] | [9024.0, 9160.0] | [23.0, 21.0] | [96, 124] |
p02699 | u099187672 | 2,000 | 1,048,576 | There are S sheep and W wolves. If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep. If the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`. | ['a,b,c,d = map(int,input().split())\n\naoki_new = (a+d-1)/d\ntaka_new1 = (a+b-1)/b\n\nif taka_new1 <= aoki_new :\n\tprint("Yes") #takahasi is loses because its heath is zero first\nelse:\n\tprint("No")\n\n\n\n\n', 'a,b,c,d = map(int,input().split())\n\naoki_new = (a+d-1)/d\ntaka_new1 = (a+b-1)/b\n\nif taka_new1 < aoki_new :\n\tprint("No") #takahasi is loses because its heath is zero first\nelse:\n\tprint("Yes")\n\n\n\n\n', 'a,b,c,d = map(int,input().split())\n\naoki_new = (a+d-1)/d\ntaka_new1 = (c+b-1)/b\n\nif aoki_new >= taka_new1:\n\tprint("Yes") #takahasi is loses because its heath is zero first\nelse:\n\tprint("No")\n\n\n\n\n', 's,w = map(int,input().split())\n\nif s<w or s==w:\n\tprint("unsafe")\nelse:\n\tprint("safe")\n\t\t\n\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s436988121', 's699827002', 's795392934', 's417944464'] | [9164.0, 9164.0, 9016.0, 9096.0] | [21.0, 20.0, 21.0, 21.0] | [195, 194, 194, 90] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.