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
|
---|---|---|---|---|---|---|---|---|---|---|
p03463 | u242031676 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['print("Borys")', 'n, a, b = map(int, input().split())\nif (b-a)%2:\n print("Borys")\nelse:\n print("Alice")'] | ['Wrong Answer', 'Accepted'] | ['s165863628', 's225638520'] | [9140.0, 9164.0] | [27.0, 30.0] | [14, 87] |
p03463 | u246366098 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n,a,b=map(int,input.split())\nif (a-b)%2==0:print('Alice')\nelse:print('Borys')", "n,a,b=map(int,input().split())\nif (a-b)%2==0:print('Alice')\nelse:print('Borys')"] | ['Runtime Error', 'Accepted'] | ['s466918629', 's107436440'] | [9064.0, 9096.0] | [29.0, 27.0] | [77, 79] |
p03463 | u263933075 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["s=input().split()\nif int(s[2])-int(s[1])==1:\n print('Borys')\nelif int(s[2])-int(s[1])%2==0:\n print('Alice')\nelse:\n print('Borys')", "s=input().split()\nif int(s[2])-int(s[1])%2==0:\n print('Alice')\nelse:\n print('Borys')", "a = input().split()\nif (int(a[2]) - int(a[1])) % 2 == 0:\n print('Alice')\nelse:\n print('Borys')"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s414270209', 's924953993', 's677948345'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [138, 90, 100] |
p03463 | u268210555 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n, a, b = list(map(int, input().split()))\nprint(['Borys','Alice'][(b-a)%2])", "n, a, b = list(map(int, input().split()))\nprint(['Alice','Borys'][(b-a)%2])"] | ['Wrong Answer', 'Accepted'] | ['s699059368', 's649852991'] | [2940.0, 2940.0] | [17.0, 17.0] | [75, 75] |
p03463 | u288430479 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['n,a,b = map(int,input().split())\nt = b-a\nif t%2==0:\n print("Borys")\nelse:\n print("Alice")', 'n,a,b = map(int,input().split())\nt = b-a\nif t%2==0:\n print("Alice")\nelse:\n print("Borys")'] | ['Wrong Answer', 'Accepted'] | ['s438752685', 's867942472'] | [2940.0, 2940.0] | [17.0, 17.0] | [91, 91] |
p03463 | u293579463 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['K = int(input())\nA = [int(i) for i in input().split()]\n\nMax, Min = 0, 0\nerror = -1\n\ndef N_max(a, Max, Min):\n if Max > a and Min%a != 0:\n return a*(Min//a + 2) - 1\n elif Max > a and Min%a == 0:\n return a*(Min//a + 1) - 1\n else:\n return a*2 -1\n \ndef N_min(a, m):\n if m > a:\n return a*(m//a + 1)\n else:\n return a\n\nfor i in range(K)[::-1]:\n\n if A[-1] == 2:\n if i == 0: \n Max = N_max(A[i], Max, Min)\n Min = N_min(A[i], Min)\n print(Min, Max)\n break\n \n elif A[i-1]/A[i] < 2: \n Max = N_max(A[i], Max, Min)\n Min = N_min(A[i], Min)\n\n else:\n print(error)\n break\n \n else:\n print(error)\n break\n', 'N, A, B = [int(i) for i in input().split()]\nprint("Alice") if (A-B)%2 == 0 else print("Borys")'] | ['Runtime Error', 'Accepted'] | ['s425031896', 's685824928'] | [3064.0, 3316.0] | [18.0, 18.0] | [861, 94] |
p03463 | u297574184 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["from math import ceil, floor\n\nK = int(input())\nAs = list(map(int, input().split()))\n\nL = 2\nR = 2\nfor A in reversed(As):\n if R // A * A < L:\n print('-1')\n exit()\n L = ceil(L / A) * A\n R = floor(R / A) * A + A - 1\n\nprint(L, R)\n", "N, A, B = map(int, input().split())\n\nif (B - A) % 2 == 0:\n print('Alice')\nelse:\n print('Borys')\n"] | ['Runtime Error', 'Accepted'] | ['s265788709', 's216792438'] | [3060.0, 2940.0] | [17.0, 17.0] | [248, 102] |
p03463 | u329058683 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['N,A,B=map(input().split())\nif A-B%2==0:\n print("Alice")\nelse:\n print("Borys")', 'N,A,B=map(int,input().split())\nif (A-B)%2==0:\n print("Alice")\nelse:\n print("Borys")'] | ['Runtime Error', 'Accepted'] | ['s837563294', 's625173833'] | [2940.0, 2940.0] | [17.0, 17.0] | [79, 85] |
p03463 | u329706129 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["N, A, B = map(int, input().split())\nfor i in range(N):\n if(B != A + 1): A += 1\n elif(A != 0): A -= 1\n else: print('Borys'); exit(0)\n if(A != B - 1): B -= 1\n elif(B != N): B += 1\n else: print('Arice'); exit(0)\nprint('Draw')\n", "N, A, B = map(int, input().split())\nfor i in range(N):\n if(B != A + 1): A += 1\n elif(A != 0): A -= 1\n else: print('Borys'); exit(0)\n if(A != B - 1): B -= 1\n elif(B != N): B += 1\n else: print('Alice'); exit(0)\nprint('Draw')\n"] | ['Wrong Answer', 'Accepted'] | ['s281708740', 's189785228'] | [3060.0, 3060.0] | [19.0, 18.0] | [241, 241] |
p03463 | u347640436 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["N, A, B = map(int, input().split())\nelif (B - A) % 2 == 0:\n print('Alice')\nelse:\n print('Borys')\n", "N, A, B = map(int, input().split())\nif (B - A) % 2 == 0:\n print('Alice')\nelse:\n print('Borys')\n"] | ['Runtime Error', 'Accepted'] | ['s144101209', 's431961658'] | [2940.0, 2940.0] | [17.0, 17.0] | [99, 97] |
p03463 | u363836311 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["N,A,B=map(int, input().split())\nwhile A!=1 and B!=N:\n if A!=B-1:\n A+=1\n else:\n A=A-1\n print(A)\n if B!=A+1:\n B=B-1\n else:\n B=B+1\n print(B)\nif A==1:\n print('Borys')\nelse:\n print('Alice')\n \n", "N,A,B=map(int, input().split())\nturn=0\nwhile A!=1 and B!=N or turn==0:\n if A!=B-1:\n A+=1\n else:\n A=A-1\n if A<1:\n A=1\n if B!=A+1:\n B=B-1\n else:\n B=B+1\n if B>N:\n B=N\n turn+=1\nif A==1:\n print('Borys')\nelse:\n print('Alice')"] | ['Wrong Answer', 'Accepted'] | ['s200494510', 's905568961'] | [3060.0, 3064.0] | [17.0, 18.0] | [212, 252] |
p03463 | u371467115 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['n,a,b=map(int,input().split())\nif abs(a-b)%1==0:\n print("Borys")\nelse:\n print("Alice")', 'n,a,b=map(int,input().split())\nif (b-a)%2==1:\n print("Borys")\nelif (b-a)%2==0: \n print("Alice")\nelse:\n print("Draw")\n'] | ['Wrong Answer', 'Accepted'] | ['s695866284', 's841606461'] | [2940.0, 2940.0] | [17.0, 18.0] | [88, 120] |
p03463 | u393512980 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["N, A, B = map(int, input().split())\nif (A-B)%2:\n print('Alice')\nelse:\n print('Borys')", "N, A, B = map(int, input().split())\nif (A-B)%2==0:\n print('Alice')\nelse:\n print('Borys')"] | ['Wrong Answer', 'Accepted'] | ['s017401702', 's653983306'] | [2940.0, 2940.0] | [17.0, 17.0] | [91, 94] |
p03463 | u401093859 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['N_A_B = list(map(int, input().split()))\n\nif N_A_B[1] - N_A_B[2] %2 == 0:\n print("Alice")\nelif N_A_B[1] - N_A_B[2] %2 == 1:\n print("Borys")', 'N_A_B = list(map(int, input().split()))\n\nif N_A_B[1] - N_A_B[2] %2 == 0:\n print("Borys")\nelif N_A_B[1] - N_A_B[2] %2 == 1:\n print("Alice")', 'N_A_B = list(map(int, input().split()))\n\nif (N_A_B[2] - N_A_B[1]) %2 == 0:\n print("Alice")\nelif (N_A_B[2] - N_A_B[1]) %2 == 1:\n print("Borys")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s894226953', 's940741797', 's891979532'] | [2940.0, 2940.0, 3068.0] | [17.0, 17.0, 17.0] | [144, 144, 148] |
p03463 | u403331159 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['N,A,B=map(int,input().split())\ndist=B-A\nif dist%2==0:\n print("Borys")\nelse:\n print("Alice")', 'N,A,B=map(int,input().split())\ndist=B-A\nif dist%2==1:\n print("Borys")\nelse:\n print("Alice")'] | ['Wrong Answer', 'Accepted'] | ['s856180180', 's795781950'] | [2940.0, 2940.0] | [17.0, 17.0] | [97, 97] |
p03463 | u408620326 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["N, A, B = [int(x) for x in input().strip().split()]\nif (A - B) % 2 == 0:\n print('Alice')\neles:\n print('Borys')", "N, A, B = [int(x) for x in input().strip().split()]\nif (A - B) % 2 == 0:\n print('Alice')\nelse:\n print('Borys')"] | ['Runtime Error', 'Accepted'] | ['s284058974', 's605655155'] | [2940.0, 2940.0] | [17.0, 17.0] | [112, 112] |
p03463 | u409064224 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['N,A,B = map(int,input().split())\n\nif A == 1 and B == 2:\n print("Borys")\n exit()\nif (A == N-2 or A == N-1) and B == N:\n print("Alice")\n exit()\n\nif (B-A)%2 == 0 and A%2 == 1:\n print("Alice")\nelse:\n print("Borys")\n\n', 'N,A,B = map(int,input().split())\n\nif (B-A)%2 == 0:\n print("Alice")\nelse:\n print("Borys")\n\n'] | ['Wrong Answer', 'Accepted'] | ['s734151727', 's279396302'] | [2940.0, 2940.0] | [21.0, 21.0] | [230, 96] |
p03463 | u426108351 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["a,b,c = map(int, input().split())\nif c - b % 2 == 0:\n print('Alice')\nelse:\n print('Borys')", "a,b,c = map(int, input().split())\nif (c-b) % 2 == 0:\n print('Alice')\nelse:\n print('Borys')\n"] | ['Wrong Answer', 'Accepted'] | ['s636876196', 's670012723'] | [2940.0, 2940.0] | [17.0, 18.0] | [92, 93] |
p03463 | u450339194 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["N, A, B = map(int, input().split())\n\ndiff = abs(A - B)\nif diff % 2 == 0:\n print('Borys')\nelse:\n print('Alice')", "N, A, B = map(int, input().split())\n\n\ndiff = abs(A - B)\nif diff % 2 == 0:\n print('Alice')\nelse:\n print('Borys')"] | ['Wrong Answer', 'Accepted'] | ['s892468364', 's171674019'] | [2940.0, 2940.0] | [18.0, 17.0] | [116, 117] |
p03463 | u454481887 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['N,A,B = int.input()\nM = A+B\nif (M%2==1):\n print("Borys")\nelse:\n print("Alice")', 'N,A,B = map(int.input())\nM = N+A+B\nif (M%2==1):\n print("Borys")\nelse:\n print("Alice")', 'N,A,B = map(int.input())\nif ((N+A+B)%2==1):\n print("Borys")\nelse:\n print("alice")', 'n, a, b = map(int,input().split())\nm = a + b\nif (m % 2==1):\n print("Borys")\nelse:\n print("Alice")'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s131869066', 's548580296', 's627367222', 's474158724'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 18.0, 18.0, 17.0] | [84, 91, 87, 103] |
p03463 | u490553751 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['print("Draw")', '#template\ndef inputlist(): return [int(j) for j in input().split()]\n#template\n\nN,A,B = inputlist()\nif (B-A-1) % 2 == 1:\n print("Alice")\nif (B-A-1) % 2 == 0:\n print("Borys")'] | ['Wrong Answer', 'Accepted'] | ['s693269924', 's143674412'] | [2940.0, 2940.0] | [17.0, 18.0] | [13, 199] |
p03463 | u505420467 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['n,a,b=map(int,input().split())\nif n==2:\n print("Draw")\nelif (b-a-1)%2==0:\n print("Alice")\nelse:\n print("Borys")\n', 'n,a,b=map(int,input().split())\nif n==2:\n print("Borys")\nelif (b-a-1)%2==0:\n print("Borys")\nelse:\n print("Alice")\n'] | ['Wrong Answer', 'Accepted'] | ['s345969889', 's178482598'] | [3064.0, 2940.0] | [18.0, 18.0] | [121, 122] |
p03463 | u509739538 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['import math\nimport queue\nfrom collections import defaultdict\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\ndef factorization(n):\n\tres = []\n\tif n%2==0:\n\t\tres.append(2)\n\tfor i in range(3,math.floor(n//2)+1,2):\n\t\tif n%i==0:\n\t\t\tc = 0\n\t\t\tfor j in res:\n\t\t\t\tif i%j==0:\n\t\t\t\t\tc=1\n\t\t\tif c==0:\n\t\t\t\tres.append(i)\n\treturn res\ndef fact2(n):\n\tp = factorization(n)\n\tres = []\n\tfor i in p:\n\t\tc=0\n\t\tz=n\n\t\twhile 1:\n\t\t\tif z%i==0:\n\t\t\t\tc+=1\n\t\t\t\tz/=i\n\t\t\telse:\n\t\t\t\tbreak\n\t\tres.append([i,c])\n\treturn res\ndef fact(n):\n\tans = 1\n\tm=n\n\tfor _i in range(n-1):\n\t\tans*=m\n\t\tm-=1\n\treturn ans\ndef comb(n,r):\n\tif n<r:\n\t\treturn 0\n\tl = min(r,n-r)\n\tm=n\n\tu=1\n\tfor _i in range(l):\n\t\tu*=m\n\t\tm-=1\n\treturn u//fact(l)\ndef printQueue(q):\n\tr=qb\n\tans=[0]*r.qsize()\n\tfor i in range(r.qsize()-1,-1,-1):\n\t\tans[i] = r.get()\n\tprint(ans)\ndef dq():\n\treturn queue.deque()\nclass UnionFind():\n\tdef __init__(self, n):\n\t\tself.n = n\n\t\tself.parents = [-1]*n\n\n\tdef find(self, x): # root\n\t\tif self.parents[x]<0:\n\t\t\treturn x\n\t\telse:\n\t\t\tself.parents[x] = self.find(self.parents[x])\n\t\t\treturn self.parents[x]\n\n\tdef union(self,x,y):\n\t\tx = self.find(x)\n\t\ty = self.find(y)\n\n\t\tif x==y:\n\t\t\treturn\n\n\t\tif self.parents[x]>self.parents[y]:\n\t\t\tx,y = y,x\n\n\t\tself.parents[x]+=self.parents[y]\n\t\tself.parents[y]=x\n\n\tdef size(self,x):\n\t\treturn -1*self.parents[self.find(x)]\n\n\tdef same(self,x,y):\n\t\treturn self.find(x)==self.find(y)\n\n\tdef members(self,x): # much time\n\t\troot = self.find(x)\n\t\treturn [i for i in range(self.n) if self.find(i)==root]\n\n\tdef roots(self):\n\t\treturn [i for i,x in enumerate(self.parents) if x<0]\n\n\tdef group_count(self):\n\t\treturn len(self.roots())\n\n\tdef all_group_members(self):\n\t\treturn {r: self.members(r) for r in self.roots()} # 1~n\ndef bitArr(n):\n\tx = 1\n\tzero = "0"*n\n\tans = []\n\tans.append([0]*n)\n\tfor i in range(2**n-1):\n\t\tans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))\n\t\tx+=1\n\treturn ans;\ndef arrsSum(a1,a2):\n\tfor i in range(len(a1)):\n\t\ta1[i]+=a2[i]\n\treturn a1\ndef maxValue(a,b,v):\n\tv2 = v\n\tfor i in range(v2,-1,-1):\n\t\tfor j in range(v2//a+1): \n\t\t\tk = i-a*j\n\t\t\tif k%b==0:\n\t\t\t\treturn i\n\treturn -1\n\nn,a,b = readInts()\n\nif b-a%2==0:\n\tprint("Alice")\nelse:\n\tprint("Borys")', 'import math\nimport queue\nfrom collections import defaultdict\n\ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\ndef factorization(n):\n\tres = []\n\tif n%2==0:\n\t\tres.append(2)\n\tfor i in range(3,math.floor(n//2)+1,2):\n\t\tif n%i==0:\n\t\t\tc = 0\n\t\t\tfor j in res:\n\t\t\t\tif i%j==0:\n\t\t\t\t\tc=1\n\t\t\tif c==0:\n\t\t\t\tres.append(i)\n\treturn res\ndef fact2(n):\n\tp = factorization(n)\n\tres = []\n\tfor i in p:\n\t\tc=0\n\t\tz=n\n\t\twhile 1:\n\t\t\tif z%i==0:\n\t\t\t\tc+=1\n\t\t\t\tz/=i\n\t\t\telse:\n\t\t\t\tbreak\n\t\tres.append([i,c])\n\treturn res\ndef fact(n):\n\tans = 1\n\tm=n\n\tfor _i in range(n-1):\n\t\tans*=m\n\t\tm-=1\n\treturn ans\ndef comb(n,r):\n\tif n<r:\n\t\treturn 0\n\tl = min(r,n-r)\n\tm=n\n\tu=1\n\tfor _i in range(l):\n\t\tu*=m\n\t\tm-=1\n\treturn u//fact(l)\ndef printQueue(q):\n\tr=qb\n\tans=[0]*r.qsize()\n\tfor i in range(r.qsize()-1,-1,-1):\n\t\tans[i] = r.get()\n\tprint(ans)\ndef dq():\n\treturn queue.deque()\nclass UnionFind():\n\tdef __init__(self, n):\n\t\tself.n = n\n\t\tself.parents = [-1]*n\n\n\tdef find(self, x): # root\n\t\tif self.parents[x]<0:\n\t\t\treturn x\n\t\telse:\n\t\t\tself.parents[x] = self.find(self.parents[x])\n\t\t\treturn self.parents[x]\n\n\tdef union(self,x,y):\n\t\tx = self.find(x)\n\t\ty = self.find(y)\n\n\t\tif x==y:\n\t\t\treturn\n\n\t\tif self.parents[x]>self.parents[y]:\n\t\t\tx,y = y,x\n\n\t\tself.parents[x]+=self.parents[y]\n\t\tself.parents[y]=x\n\n\tdef size(self,x):\n\t\treturn -1*self.parents[self.find(x)]\n\n\tdef same(self,x,y):\n\t\treturn self.find(x)==self.find(y)\n\n\tdef members(self,x): # much time\n\t\troot = self.find(x)\n\t\treturn [i for i in range(self.n) if self.find(i)==root]\n\n\tdef roots(self):\n\t\treturn [i for i,x in enumerate(self.parents) if x<0]\n\n\tdef group_count(self):\n\t\treturn len(self.roots())\n\n\tdef all_group_members(self):\n\t\treturn {r: self.members(r) for r in self.roots()} # 1~n\ndef bitArr(n):\n\tx = 1\n\tzero = "0"*n\n\tans = []\n\tans.append([0]*n)\n\tfor i in range(2**n-1):\n\t\tans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))\n\t\tx+=1\n\treturn ans;\ndef arrsSum(a1,a2):\n\tfor i in range(len(a1)):\n\t\ta1[i]+=a2[i]\n\treturn a1\ndef maxValue(a,b,v):\n\tv2 = v\n\tfor i in range(v2,-1,-1):\n\t\tfor j in range(v2//a+1): \n\t\t\tk = i-a*j\n\t\t\tif k%b==0:\n\t\t\t\treturn i\n\treturn -1\n\nn,a,b = readInts()\n\nif (b-a)%2==0:\n\tprint("Alice")\nelse:\n\tprint("Borys")'] | ['Wrong Answer', 'Accepted'] | ['s656245898', 's420056747'] | [9732.0, 9800.0] | [25.0, 28.0] | [2322, 2324] |
p03463 | u586577600 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n, a, b = map(int, input().split())\nprint('Alice' if abs(a-b)%2 == 1 else 'Borys')\n", "n, a, b = map(int, input().split())\nprint('Alice' if (abs(a-b)-1)%2 == 1 else 'Borys')\n"] | ['Wrong Answer', 'Accepted'] | ['s736370106', 's364767782'] | [2940.0, 3316.0] | [17.0, 18.0] | [83, 87] |
p03463 | u604693716 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['a = input().split(" ")\nb = list(map(int, a))\nif (b[2] - b[1]) % 2 == 0:\n print("Borys")\nelse:\n print("Alice")\n', 'a = input().split(" ")\nb = list(map(int, a))\nif (b[2] - b[1]) % 2 == 1:\n print("Borys")\nelse:\n print("Alice")\n'] | ['Wrong Answer', 'Accepted'] | ['s230051751', 's682927953'] | [2940.0, 2940.0] | [17.0, 17.0] | [116, 116] |
p03463 | u608777907 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['def solve(A):\n current_max = 2\n current_min = 2\n for a_k in reversed(A):\n if current_max < a_k:\n print(\'-1\')\n return\n\n current_max = (current_max // a_k) * a_k + (a_k - 1)\n current_min = ((current_min - 1) // a_k + 1) * a_k\n current_min = max(current_min, a_k)\n\n print("{} {}".format(current_min, current_max))\n return\n\n\nif __name__ == \'__main__\':\n K = int(input())\n A = list(map(int, input().split()))\n solve(A)\n', 'N, A, B = map(int, input().split())\nif (B - A) & 1:\n print("Borys")\nelse:\n print("Alice")'] | ['Runtime Error', 'Accepted'] | ['s957853004', 's397896151'] | [3060.0, 2940.0] | [17.0, 17.0] | [487, 95] |
p03463 | u623687794 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n,a,b=map(int,input().split())\nif a==1 and b==2:\n print('Borys')\nelif b-a%2==0:\n print('Alice')\nelse:\n print('Borys')", "n,a,b=map(int,input().split())\nif a==1 and b==2:\n print('Borys')\nelif (b-a)%2==0:\n print('Alice')\nelse:\n print('Borys')\n"] | ['Wrong Answer', 'Accepted'] | ['s783110155', 's022927294'] | [2940.0, 2940.0] | [17.0, 17.0] | [120, 123] |
p03463 | u652081898 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['n, a, b = map(int, input().split())\n\nif n == 0:\n print("Borys")\nelif (b-a)%2 == 0:\n print("Borys")\nelse:\n print("Alice")', 'n, a, b = map(int, input().split())\n\nif n == 2:\n print("Borys")\nelif (b-a-1)%2 == 0:\n print("Borys")\nelse:\n print("Alice")\n'] | ['Wrong Answer', 'Accepted'] | ['s074932162', 's505140526'] | [3060.0, 2940.0] | [20.0, 17.0] | [129, 132] |
p03463 | u664148512 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['import math\na=list(map(int, input().split()))\nprint("BAoLriycse"[math.floor((a[0]/2-a[1])%2 if a[0]%2==0 else ((a[0]/2+1)-a[1])%2)::2])\n', 'a=list(map(int, input().split()));print("ABloircyes"[(a[2]-a[1])%2::2])'] | ['Wrong Answer', 'Accepted'] | ['s135203243', 's567378725'] | [3060.0, 2940.0] | [17.0, 17.0] | [136, 71] |
p03463 | u667024514 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['a,b,c = map(int,input().split())\nif (a-b) % 2 == 1:\n print("Borys")\nelse:\n print("Alice")', 'a,b,c = map(int,input().split())\nif (b-c) % 2 == 1:\n print("Borys")\nelse:\n print("Alice")'] | ['Wrong Answer', 'Accepted'] | ['s962024282', 's273657483'] | [2940.0, 2940.0] | [17.0, 17.0] | [91, 91] |
p03463 | u670180528 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['n,a,b=map(int,input().split());print("BAolriycse"[(b-a)%2::2])', 'n,a,b=map(int,input().split());print("ABloircyes"[(b-a)%2::2])'] | ['Wrong Answer', 'Accepted'] | ['s755334640', 's520694478'] | [2940.0, 2940.0] | [17.0, 17.0] | [62, 62] |
p03463 | u692632484 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['a,b,c=[int(i) for i in input().split()] 2 flag=(abs(b-c)%2)==0\n\nif flag:\n\tprint("Alice")\nelse:\n\tprint("Borys")', 'a,b,c=[int(i) for i in input().split()]\nif abs(b-c)%2==0:\n\tprint("Alice")\nelse:\n\tprint("Borys")'] | ['Runtime Error', 'Accepted'] | ['s085161822', 's932500171'] | [2940.0, 2940.0] | [17.0, 17.0] | [175, 95] |
p03463 | u707870100 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['# -*- coding: utf-8 -*-\n#AGC020A\nimport sys\n#import collections\n\n#n= int(input())\ntmp = input().split()\nn,a,b = list(map(lambda a: int(a), tmp))\n\nif((b-a)%2==1):\n\tprint("Alice")\nelse:\n\tprint("Borys")\n\n\n', '# -*- coding: utf-8 -*-\n#AGC020A\nimport sys\n#import collections\n\n#n= int(input())\ntmp = input().split()\nn,a,b = list(map(lambda a: int(a), tmp))\n\nif((b-a)%2==0):\n\tprint("Alice")\nelse:\n\tprint("Borys")\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s033605133', 's451259476'] | [2940.0, 2940.0] | [18.0, 17.0] | [202, 202] |
p03463 | u731322489 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['n, a, b = map(int, input().split())\n\nwhile a > 1 and b < n:\n if b > a + 1:\n a += 1\n else:\n a -= 1\n\n if a < b - 1:\n b -= 1\n else:\n b += 1\n print(a, b)\n\nprint("Borys" if a == 1 else "Alice")', 'n, a, b = map(int, input().split())\nprint("Borys" if (b - a) % 2 == 1 else "Alice")'] | ['Wrong Answer', 'Accepted'] | ['s077221156', 's622140562'] | [3316.0, 2940.0] | [21.0, 17.0] | [231, 83] |
p03463 | u745997547 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["#\nN, A, B = list(map(int, input().rstpir().split()))\n\n#\nif (B-A-1)%2==0:\n print('Borys')\nelse:\n print('Alice')\n", "#\nN, A, B = list(map(int, input().split()))\n\n#\nif (B-A-1)%2==0:\n print('Borys')\nelse:\n print('Alice')\n"] | ['Runtime Error', 'Accepted'] | ['s067749466', 's784584441'] | [2940.0, 2940.0] | [17.0, 17.0] | [117, 108] |
p03463 | u772588522 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n, a, b = map(int, input().split())\n\n\n\n\nif b - a % 2:\n print('Borys')\nelse:\n print('Alice')", "n, a, b = map(int, input().split())\n\n\n\n\nif (b - a) % 2:\n print('Borys')\nelse:\n print('Alice')"] | ['Wrong Answer', 'Accepted'] | ['s843491635', 's001024622'] | [2940.0, 2940.0] | [18.0, 17.0] | [282, 284] |
p03463 | u787562674 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["N, A, B = map(int, input().split())\n\nprint('Alice' if (B - A + 1) % 2 == 0 else 'Borys')\n", "N, A, B = map(int, input().split())\n\nprint('Borys' if (B - A + 1) % 2 == 0 else 'Alice')\n"] | ['Wrong Answer', 'Accepted'] | ['s065914799', 's306618786'] | [2940.0, 2940.0] | [18.0, 17.0] | [89, 89] |
p03463 | u810735437 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['N, A, B = map(int, input().split())\nif (B - A) % 2:\n print("Alice")\nelse:\n print("Borys")\n\n', 'N, A, B = map(int, input().split())\nif (B - A) % 2:\n print("Borys")\nelse:\n print("Alice")\n\n'] | ['Wrong Answer', 'Accepted'] | ['s165092491', 's502963461'] | [2940.0, 2940.0] | [18.0, 18.0] | [97, 97] |
p03463 | u810778810 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['a=list(input())\nx=int(a[1])\ny=int(a[2])\n\nif abs(x-y)%2==0:\n print("Alice")\nelse:\n print("Borys")', 'a=list(input().split(" "))\nx=int(a[1])\ny=int(a[2])\n \nif abs(x-y)%2==0:\n print("Alice")\nelse:\n print("Borys")'] | ['Runtime Error', 'Accepted'] | ['s726410775', 's574248825'] | [2940.0, 3060.0] | [17.0, 19.0] | [98, 110] |
p03463 | u815498317 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["N,A,B = list(map(int,input().split()))\n\nif (B-A)%2 == 0:\n\tprint('Bob')\nelse:\n print('Alice')", "N,A,B = list(map(int,input().split()))\n\nif (B-A)%2 == 0:\n\tprint('Borys')\nelse:\n print('Alice')\n", "N,A,B = list(map(int,input().split()))\n\nif (B-A)%2 != 0:\n\tprint('Borys')\nelse:\n print('Alice')\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s097568906', 's607316983', 's353022146'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [95, 98, 98] |
p03463 | u819688111 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["if __name__ == '__main__':\n \n N, A, B = [int(x) for x in input().split(' ')]\n \n while True:\n \n if (A+1) == B:\n if A == 1:\n print('Borys')\n break\n else:\n A -= 1\n else:\n A += 1\n\n print(A, B)\n\n if (B-1) == A:\n if B == N:\n print('Alice')\n break\n else:\n B += 1\n else:\n B -= 1\n\n print(A, B)\n", "if __name__ == '__main__':\n \n N, A, B = [int(x) for x in input().split(' ')]\n \n while True:\n \n if (A+1) == B:\n if A == 1:\n print('Borys')\n break\n else:\n A -= 1\n else:\n A += 1\n\n if (B-1) == A:\n if B == N:\n print('Alice')\n break\n else:\n B += 1\n else:\n B -= 1\n"] | ['Wrong Answer', 'Accepted'] | ['s002959609', 's321267260'] | [3060.0, 2940.0] | [17.0, 17.0] | [502, 460] |
p03463 | u820047642 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['n,a,b=int(input().split())\nif (b-a+1)%2==0:\n print("Borys")\nelse:\n print("Alice")', 'n,a,b=map(int,input().split())\nif (b-a+1)%2==0:\n print("Borys")\nelse:\n print("Alice")'] | ['Runtime Error', 'Accepted'] | ['s181741735', 's493852738'] | [2940.0, 2940.0] | [17.0, 17.0] | [87, 91] |
p03463 | u821262411 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n,a,b=map(int,input().split())\nif abs(a-b)%2 ==0:\n print('Borys')\nelse:\n print('Alice')\n ", "n,a,b=map(int,input().split())\nif abs(a-b)%2 ==1:\n print('Borys')\nelse:\n print('Alice')\n "] | ['Wrong Answer', 'Accepted'] | ['s237337996', 's739529421'] | [2940.0, 2940.0] | [17.0, 17.0] | [98, 98] |
p03463 | u841021102 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['n, a, b = map(int, input().split())\nif (n + b) % 2 == 0:\n print("Alice")\nelif (n + b) % 2 != 0:\n print("Borys")', 'n, a, b = map(int, input().split())\nif (n + b) % 2 == 0:\n print("Alice")\nelif (n + b) % 2 != 0:\n print("Bor', 'n, a, b = map(int, input().split())\nif (a - b) % 2 == 0:\n print("Borys")\nelse:\n print("Alice")', 'n, a, b = map(int, input().split())\nif (a - b) % 2 == 0:\n print("Borys")\nelse:\n print("Borys")', 'n, a, b = map(int, input().split())\nif (a - b) % 2 == 0:\n print("Alice")\nelse:\n print("Borys")'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s050167730', 's331575266', 's375065004', 's681197597', 's767171942'] | [9076.0, 8960.0, 9108.0, 9076.0, 9108.0] | [29.0, 25.0, 30.0, 29.0, 29.0] | [113, 109, 96, 96, 96] |
p03463 | u844789719 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["import math\nK = int(input())\nA = [int(_) for _ in input().split()]\nl = r = 2\n'''\nif x children form groups consisting of y children each\n then z children are left\n=> z=y*(x//y)\n=> y*(math.ceil(z/y))<=x<y*(math.floor(z/y)+1)\n'''\n#necessary conditions\nfor a in A[::-1]:\n l = a * math.ceil(l / a)\n r = a * (math.floor(r / a) + 1) - 1\n#sufficient conditions\nfor x in [l, r]:\n for a in A:\n x = a * (x // a)\n if x != 2:\n print(-1)\n exit()\nprint(l, r)\n", "N, A, B = [int(_) for _ in input().split()]\nif (B - A) % 2:\n print('Borys')\nelse:\n print('Alice')\n"] | ['Runtime Error', 'Accepted'] | ['s851393364', 's899756330'] | [3064.0, 2940.0] | [17.0, 18.0] | [478, 104] |
p03463 | u858136677 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n,a,b = map(int,input().split())\nif n%2 == 0\n\tif a == 1:\n\t\tif b == n or b == 2:\n\t\t\tprint('Borys')\n\t\telse:\n\t\t\tprint('Alice')\n\tif b == n\n\t\tprint('Alice')\nelse:\n\tif a == 1:\n\t\tif b == n-1:\n\t\t\tprint('Borys')\n\t\telse:\n\t\t\tprint('Alice')\n\telif b == n:\n\t\tif a == n-1:\n\t\t\tprint('Alice')\n\t\telse:\n\t\t\tprint('Borys')\n\telse:\n\t\tif (b-a)%2 == 1:\n\t\t\tprint('Borys')\n\t\telse:\n\t\t\tprint('Alice')", "n,a,b = map(int,input().split())\nif n%2 == 0:\n\tif (b-a)%2 == 1:\n\t\tprint('Borys')\n\telse:\n\t\tprint('Alice')\nelse:\n\tif (b-a)%2 == 1:\n\t\tprint('Borys')\n\telse:\n\t\tprint('Alice')"] | ['Runtime Error', 'Accepted'] | ['s615299280', 's388429026'] | [2940.0, 2940.0] | [17.0, 17.0] | [371, 169] |
p03463 | u898967808 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n,a,b = map(int,input().split())\nif (b-a)%2 == 0:\n print('Borys')\nelse:\n pritn('Alice')", "n,a,b = map(int,input().split())\nif abs(b-a) % 2 == 0:\n print('Alice')\nelse:\n print('Borys') "] | ['Runtime Error', 'Accepted'] | ['s519270095', 's502678637'] | [9144.0, 8984.0] | [30.0, 29.0] | [89, 96] |
p03463 | u902151549 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['N,A,B=map(int,input().split())\nd=B-A\nif d%2==:print("Alice")\nelse:print("Borys")', 'N,A,B=map(int,input().split())\nd=B-A\nif d%2==0:print("Alice")\nelse:print("Borys")\n'] | ['Runtime Error', 'Accepted'] | ['s255837763', 's694610359'] | [2940.0, 2940.0] | [17.0, 17.0] | [80, 82] |
p03463 | u902468164 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n, a, b = [int(i) for i in input().splti(' ')]\nprint('Alice' if abs(a-b) % 2 == 0 else 'Borys')\n", "n, a, b = [int(i) for i in input().split(' ')]\nprint('Alice' if abs(a-b) % 2 == 0 else 'Borys')"] | ['Runtime Error', 'Accepted'] | ['s746587892', 's354357501'] | [2940.0, 2940.0] | [17.0, 17.0] | [96, 95] |
p03463 | u921168761 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['N, A, B = map(int, input().split())\nprint("Alice" if (B - A) % 2 == 1 else "Borys")', 'N, A, B = map(int, input().split())\nprint("Alice" if (B - A) % 2 == 0 else "Borys")'] | ['Wrong Answer', 'Accepted'] | ['s733089013', 's345672390'] | [2940.0, 2940.0] | [18.0, 17.0] | [83, 83] |
p03463 | u921773161 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["print('Draw')", "print('Draw')n, a, b = map(int, input().split())\n\nif (b-a) % 2 == 0:\n ans = 'Alice'\nelse:\n ans = 'Borys'\n\nprint(ans)", "n, a, b = map(int, input().split())\n\nif (b-a) % 2 == 0:\n ans = 'Alice'\nelse:\n ans = 'Borys'\n\nprint(ans)\n"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s053632752', 's559208902', 's717561249'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [13, 123, 111] |
p03463 | u923270446 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['n, a, b = map(int, input())\nif (b - a) % 2 == 0:\n print("Alice")\nelse:\n print("Borys")', 'n,a,b=map(int,input().split())\nprint("Borys"if (b-a)%2else "Alice")'] | ['Runtime Error', 'Accepted'] | ['s788742054', 's648731743'] | [2940.0, 9088.0] | [17.0, 28.0] | [92, 67] |
p03463 | u941753895 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n,a,b=map(int,input().split())\nif n==5 and a==2 and b==4:\n exit()\nif (b-a)%2==0:\n print('Alice')\nelse:\n print('Borys')", "import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\n\ndef LI(): return list(map(int,input().split()))\ndef I(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\ndef main():\n n,a,b=LI()\n\n if (b-a)%2==0:\n return 'Alice'\n else:\n return 'Borys'\n\nprint(main())"] | ['Wrong Answer', 'Accepted'] | ['s217247534', 's498435041'] | [2940.0, 6432.0] | [17.0, 55.0] | [121, 381] |
p03463 | u948374595 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n, a, b = map(int, input().split())\nturn = 0\nwhile True: \n if turn == 0:\n if a + 1 < b:\n a += 1\n print('a', a)\n elif 0 < a :\n a -= 1\n print('a', a)\n else:\n break\n turn = 1\n elif turn == 1:\n if a + 1 < b:\n b -= 1\n print('b', b)\n elif a + 1 == b and b != n:\n b += 1\n print('b', b)\n else:\n break\n turn = 0\n\nif turn == 0:\n print('Borys')\nelse:\n print('Alice')\n", "n, a, b = map(int, input().split())\nturn = 0\nwhile True: \n if turn == 0:\n if a + 1 < b:\n a += 1\n elif 0 < a :\n a -= 1\n else:\n break\n turn = 1\n elif turn == 1:\n if a + 1 < b:\n b -= 1\n elif a + 1 == b and b != n:\n b += 1\n else:\n break\n turn = 0\n\nif turn == 0:\n print('Borys')\nelse:\n print('Alice')\n"] | ['Wrong Answer', 'Accepted'] | ['s211594368', 's657028015'] | [3316.0, 3060.0] | [21.0, 17.0] | [434, 354] |
p03463 | u969708690 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ['N,A,B=map(int,input().split())\nif (A-B)%2==0:\n print("Borys")\nelse:\n print("Alice")', 'N,A,B=map(int,input().split())\nif (A-B)%2==1:\n print("Borys")\nelse:\n print("Alice")'] | ['Wrong Answer', 'Accepted'] | ['s074146404', 's065426357'] | [9088.0, 9168.0] | [28.0, 29.0] | [85, 85] |
p03463 | u970197315 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["N,A,B = map(int,input().split())\n\nD = B - A\n\nif N%2 == 1:\n if D%2 == 1:\n print('Borys')\n elif D%2 == 0:\n print('Draw')\nelif N%2 == 1:\n print('Alice')", "N,A,B = map(int,input().split())\n\nD = B - A\n\nif N%2 == 1:\n if D%2 == 1:\n print('Borys')\n elif D%2 == 0:\n print('Draw')\nelif N%2 == 0:\n print('Alice')", "# A - Move and Win\nn,a,b=map(int,input().split())\nif (b-a)%2==0:\n print('Alice')\nelse:\n print('Borys')"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s202433315', 's498578864', 's156573040'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0] | [173, 173, 108] |
p03463 | u970809473 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["n,a,b = map(int, input().split())\nif n == 2:\n print('Draw')\nelif (a - b) % 2 == 1:\n print('Alice')\nelse:\n print('Borys')", "n,a,b = map(int, input().split())\nif n == 2:\n print('Borys')\nelif a == 1 and b == 2:\n print('Borys')\nelif (a - b) % 2 == 0:\n print('Alice')\nelse:\n print('Borys')"] | ['Wrong Answer', 'Accepted'] | ['s361030802', 's647492321'] | [2940.0, 3064.0] | [17.0, 18.0] | [123, 165] |
p03463 | u983853152 | 1,000 | 524,288 | A game is played on a strip consisting of N cells consecutively numbered from 1 to N. Alice has her token on cell A. Borys has his token on a different cell B. Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or on the right, cell X+1. Note that it's disallowed to move the token outside the strip or to the cell with the other player's token. In one turn, the token of the moving player must be shifted exactly once. The player who can't make a move loses, and the other player wins. Both players want to win. Who wins if they play optimally? | ["\ndef main():\n N,A,B = map(int, input().split()) \n while True:\n if(A+1==B):\n print('Borys')\n return\n A = A+1\n if(B-1==A):\n print('Alicce')\n return\n B = B-1\n\n\nif __name__ == '__main__':\n main()\n", "\ndef main():\n N,A,B = map(int, input().split()) \n while True:\n if(A+1==B):\n print('Borys')\n return\n A = A+1\n if(B-1==A):\n print('Alice')\n return\n B = B-1\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s608627598', 's795174575'] | [3068.0, 2940.0] | [17.0, 17.0] | [274, 273] |
p03464 | u037430802 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['\n\n\n\nK = int(input())\n\nA = list(map(int, input().split()))\n\nif K == 1:\n print(2,3)\n exit()\n\nif A[-1] != 2:\n print(-1)\n exit()\n\nbig = 2\nsmall = 2\nfor i in reversed(range(K)):\n\n\n\n if A[i] < small:\n t_small = (small // A[i] + 1) * A[i]\n else:\n t_small = A[i]\n\n big = (big // A[i] + 1) * A[i] - 1\n \n if big < small:\n print(-1)\n exit()\n\n\nprint(small, big)\n', 'N = int(input())\nA = list(map(int, input().split()))\n\nif A[-1] > 2:\n print(-1)\n exit()\n\n\n\n\nHI = 2\nLO = 2\nfor i in range(N):\n \n if LO // A[N-i-1] > 0:\n if LO % A[N-i-1] > 0:\n nxt_LO = (LO // A[N-i-1] + 1) * A[N-i-1]\n else:\n nxt_LO = LO\n else:\n nxt_LO = A[N-i-1]\n\n \n \n nxt_HI = (HI // A[N-i-1]) * A[N-i-1] + (A[N-i-1] - 1)\n\n if HI > nxt_HI or LO > nxt_LO or nxt_HI < nxt_LO:\n print(-1)\n exit()\n\n LO = nxt_LO\n HI = nxt_HI\n\nprint(LO, HI)'] | ['Wrong Answer', 'Accepted'] | ['s089383083', 's604309102'] | [14224.0, 14228.0] | [93.0, 204.0] | [405, 1988] |
p03464 | u057079894 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['n=int(input())\nda=list(map(int ,input().split()))\nMin=2\nMax=2\nju=True\nfor i in da[::-1]:\n mi=(Min+i-1)//i\n ma=Max//i\n if mi*i>Max or ma*i<Min:\n ju=False\n break\n Min=mi*i\n Max=ma*i+i-1\nif ju:\n print(Max,Min)\nelse:\n print(-1)', 'n=int(input())\nda=list(map(int ,input().split()))\nMin=2\nMax=2\nju=True\nfor i in da[::-1]:\n mi=(Min+i-1)//i\n ma=Max//i\n if mi*i>Max or ma*i<Min:\n ju=False\n break\n Min=mi*i\n Max=ma*i+i-1\nif ju:\n print(Min,Max)\nelse:\n print(-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s912759978', 's306814386'] | [14252.0, 14252.0] | [119.0, 121.0] | [258, 259] |
p03464 | u057463552 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['import sys\nK = int(input())\nA = [int(x) for x in input().split()]\nA.reverse()\njmax, jmin = 2,2\n\nif A[0] != 2:\n print(-1)\n sys.exit()\n\n\n"""max"""\nfor i in range(0,K-1):\n drop_num = []\n for j in range(0,A[i]): \n if ( jmax + j ) % A[i+1] == 0:\n drop_num.append(j)\n\n if drop_num == []: \n print(-1)\n sys.exit()\n\n max_drop = max(drop_num)\n jmax = jmax + max_drop\n\njmax = jmax + A[K-1] -1\n\n\n"""min"""\nfor i in range(0,K-1):\n drop_num = []\n for j in range(0,A[i]): \n if ( jmin + j ) % A[i+1] == 0:\n drop_num.append(j)\n\n if drop_num == []: \n print(-1)\n sys.exit()\n\n min_drop = min(drop_num)\n jmin = jmin + min_drop\n\n\nprint(jmin, jmax)', 'import sys\nK = int(input())\nA = [int(x) for x in input().split()]\nA.reverse()\njmax, jmin = 2,2\n#print(A)\n\nfor h in range(0,K):\n if A[h] <= A[h+1]:\n print(-1)\n sys.exit()\n\nif A[0] != 2:\n print(-1)\n sys.exit()\n\n\n\nfor i in range(0,K-1): \n drop_num = []\n for j in range(0,A[i]): \n if ( jmax + j ) % A[i+1] == 0:\n drop_num.append(j)\n if ( jmin + j ) % A[i+1] == 0:\n drop_num.append(j)\n if drop_num == []: \n print(-1)\n sys.exit()\n max_drop = max(drop_num)\n jmax = jmax + max_drop\n min_drop = min(drop_num)\n jmin = jmin + min_drop\n\n\njmax = jmax + A[K-1] -1\n\nprint(jmin, jmax)\n', 'import sys\nK = int(input())\nA = [int(x) for x in input().split()]\nA.reverse()\njmax, jmin = 2,2\n#print(A)\n\nif A[0] != 2:\n print(-1)\n sys.exit()\n\n"""max"""\nfor i in range(0,K-1): \n drop_num = []\n for j in range(0,A[i]): \n if ( jmax + j ) % A[i+1] == 0:\n #print(j)\n drop_num.append(j)\n print(drop_num)\n\n if drop_num == []: \n print(-1)\n sys.exit()\n\n max_drop = max(drop_num)\n jmax = jmax + max_drop\n\n\njmax = jmax + A[K-1] -1\n\n\n"""min"""\nfor i in range(0,K-1):\n drop_num = []\n for j in range(0,A[i]): \n if ( jmin + j ) % A[i+1] == 0:\n drop_num.append(j)\n\n if drop_num == []: \n print(-1)\n sys.exit()\n\n min_drop = min(drop_num)\n jmin = jmin + min_drop\n\n\n\nprint(jmin, jmax)\n', 'from math import floor,ceil\nK = int(input())\nA = [int(x) for x in input().split()]\nA.reverse()\njmax, jmin = 2,2\n\nfor i in range(0,K):\n if jmin % A[i] != 0:\n if (jmin + (A[i] - (jmin % A[i]))) > jmin:\n print(-1)\n exit()\n\n jmin = ceil(jmin / A[i]) * A[i]\n jmax = floor(jmax / A[i]) * A[i] + A[i] -1\n\nprint(jmin, jmax)\n\n', 'import sys\nK = int(input())\nA = [int(x) for x in input().split()]\nA.reverse()\njmax, jmin = 2,2\n\nif A[0] != 2:\n print(-1)\n sys.exit()\n\nfor i in range(0,K-1): \n Round = list(range(jmin,jmax+1))\n decide = [Round[h] % A[i] for h in range(len(Round))]\n if not(0 in decide):\n print(-1)\n sys.exit()\n jmin = (int(jmin/A[i])+1)*A[i]\n jmax = (int(jmax/A[i]))*A[i] +A[i]-1\n\njmax = jmax + A[K-1] -1\n\nprint(jmin, jmax)\n', 'import sys\nimport math\nK = int(input())\nA = [int(x) for x in input().split()]\nA.reverse()\njmax, jmin = 2,2\n\nif A[0] != 2:\n print(-1)\n sys.exit()\n\nfor i in range(0,K-1): \n Round = list(range(jmin,jmax+1))\n decide = [Round[h] % A[i] for h in range(len(Round))]\n if not(0 in decide):\n print(-1)\n sys.exit()\n jmin = (math.ceil(jmin / A[i])) * A[i]\n jmax = (math.floor(jmax / A[i])) * A[i] + A[i] -1\n\njmax = jmax + A[K-1] -1\n\nprint(jmin, jmax)\n', 'import sys\nK = int(input())\nA = [int(x) for x in input().split()]\nA.reverse()\njmax, jmin = 2,2\n\nif A[0] != 2:\n print(-1)\n sys.exit()\n\nfor i in range(0,K-1): \n Round = list(range(jmin,jmax+1))\n if not(0 in Round % A[i]):\n print(-1)\n sys.exit()\n jmin = (int(jmin/A[i])+1)*A[i]\n jmax = (int(jmax/A[i]))*A[i] +A[i]-1\n\njmax = jmax + A[K-1] -1\n\nprint(jmin, jmax)\n', 'from math import floor,ceil\nK = int(input())\nA = [int(x) for x in input().split()]\nA.reverse()\njmax, jmin = 2,2\n\nfor i in range(0,K):\n if jmin % A[i] != 0:\n if (jmin + (A[i] - (jmin % A[i]))) > jmax:\n print(-1)\n exit()\n\n jmin = ceil(jmin / A[i]) * A[i]\n jmax = floor(jmax / A[i]) * A[i] + A[i] -1\n \nprint(jmin, jmax)\n\n\n '] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s044443262', 's165780116', 's226492967', 's410185160', 's414464354', 's554810574', 's687570691', 's400232007'] | [14228.0, 14868.0, 14232.0, 14252.0, 14428.0, 594748.0, 14400.0, 14252.0] | [323.0, 48.0, 2104.0, 128.0, 46.0, 2134.0, 46.0, 180.0] | [1005, 873, 1119, 389, 523, 556, 471, 398] |
p03464 | u071680334 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['from fractions import gcd\ndef calc(n, N, p, q):\n n, N = n*q//gcd(n, q), N*q//gcd(N, q)\n L, R = 0, 10**9\n while L+1 < R:\n M = (L+R)//2\n if n <= p*M:\n R = M\n else:\n L = M\n if n+(q-1) < p*R:\n n = -1\n else:\n n = p*R\n L, R = 0, 10**9\n while L+1 < R:\n M = (L+R)//2\n if N+q <= p*M:\n R = M\n else:\n L = M\n if p*L < N:\n N = -1\n else:\n N = p*L\n return n, N\n\ndef main():\n k = int(input())\n a = list(map(int, input().split()))\n f = True\n M, m = 2, 2\n if 2 < a[-1]:\n f = False\n else:\n for i in reversed(range(1, k)):\n m, M = calc(m, M, a[i-1], a[i])\n if m == -1 or M == -1:\n f = False\n break\n M += a[0]-1\n if f:\n print(m, M)\n else:\n print(-1)\n\nif __name__ == "__main__":\n main()', 'def calc(n, N, x):\n m, M = -1, -1\n L, R = 0, 10**13\n while L+1 < R:\n P = (L+R)//2\n if n <= x*P:\n R = P\n else:\n L = P\n if n <= x*R <= N:\n m = x*R\n L, R = 0, 10**13\n while L+1 < R:\n P = (L+R)//2\n if N < x*P:\n R = P\n else:\n L = P\n if n <= x*L <= N:\n M = x*L + (x-1)\n return m, M\n\ndef main():\n k = int(input())\n a = list(map(int, input().split()))\n f = True\n m, M = 2, 2\n for i in reversed(range(k)):\n m, M = calc(m, M, a[i])\n if m == -1 or M == -1:\n f = False\n break\n if f:\n print(m, M)\n else:\n print(-1)\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s506609499', 's333438749'] | [16240.0, 14428.0] | [1479.0, 1950.0] | [922, 735] |
p03464 | u077291787 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['# AGC020B - Ice Rink Game\ndef main():\n K, *A = map(int, open(0).read().split())\n l, h = 2, 2 # low, high\n for i in A[::-1]:\n l = (l + i - 1) // i * i\n h = (h / i + 1) * i - 1\n if l > h:\n print(-1)\n else:\n print(l, h)\n\n\nif __name__ == "__main__":\n main()', '# AGC020B - Ice Rink Game\ndef main():\n K, *A = map(int, open(0).read().split())\n l, h = 2, 2 # low, high\n for i in A[::-1]:\n l += -l % i\n h += i - 1 - h % i\n if l > h:\n print(-1)\n else:\n print(l, h)\n\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s684913041', 's749941888'] | [14092.0, 14092.0] | [99.0, 74.0] | [300, 282] |
p03464 | u201234972 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['K = int( input())\nA = list( map( int, input().split()))\nnowm = 2\nnowM = 2\nans = 0\nfor i in range(K-1,-1,-1):\n if nowM < A[i]:\n ans = -1\n break\n elif nowm <= A[i]:\n nowm = A[i]\n nowM = A[i]*2 - 1\n else:\n nowm = (nowm//A[i]+1)*A[i]\n if nowm > nowM:\n ans = -1\n break\n nowM += A[i] -1\n # nowM = (nowM//A[i]+1)*A[i] - 1\n # if nowm >= nowM:\n # nowM = nowm + A[i] -1\nif ans == -1:\n print( -1)\nelse:\n print("{} {}".format(nowm, nowM))\n\n', 'K = int( input())\nA = list( map( int, input().split()))\nnowm = 2\nnowM = 2\nans = 0\nfor i in range(K-1,-1,-1):\n a = A[i]\n if nowm <= ((nowm+a-1)//a)*a and ((nowm+a-1)//a)*a <= nowM:\n nowm = ((nowm+a-1)//a)*a\n nowM = (nowM//a)*a + a - 1\n else:\n ans = -1\n break\n print(nowm, nowM)\n # if nowM < A[i]:\n # ans = -1\n # break\n # elif nowm <= A[i]:\n # nowm = A[i]\n # nowM = A[i]*2 - 1\n # else:\n # M = nowM\n # nowm = (nowm//A[i]+1)*A[i]\n # if nowm > M:\n # ans = -1\n # break\n # if (nowM//A[i]+1)*A[i] <= M:\n # nowM = (nowM//A[i]+1)*A[i] - 1\n # if nowM < nowm:\n # nowM = nowm + A[i] - 1\n # else:\n # nowM = nowm + A[i] - 1\nif ans == -1:\n print( -1)\nelse:\n print("{} {}".format(nowm, nowM))\n', 'K = int( input())\nA = list( map( int, input().split()))\nnowm = 2\nnowM = 2\nans = 0\nfor i in range(K-1,-1,-1):\n if nowM < A[i]:\n ans = -1\n break\n elif nowm <= A[i]:\n nowm = A[i]\n nowM = A[i]*2 - 1\n else:\n nowm = (nowm//A[i]+1)*A[i]\n nowM = (nowM//A[i]+1)*A[i] - 1\n if nowm > nowM:\n nowM = nowm + A[i] -1\n print(nowm, nowM)\nif ans == -1:\n print( -1)\nelse:\n print("{} {}".format(nowm, nowM))\n', 'K = int( input())\nA = list( map( int, input().split()))\nnowm = 2\nnowM = 2\nans = 0\nfor i in range(K-1,-1,-1):\n a = A[i]\n if nowm <= ((nowm+a-1)//a)*a and ((nowm+a-1)//a)*a <= nowM:\n nowm = ((nowm+a-1)//a)*a\n nowM = (nowM//a)*a + a - 1\n else:\n ans = -1\n break\n # if nowM < A[i]:\n # ans = -1\n # break\n # elif nowm <= A[i]:\n # nowm = A[i]\n # nowM = A[i]*2 - 1\n # else:\n # M = nowM\n # nowm = (nowm//A[i]+1)*A[i]\n # if nowm > M:\n # ans = -1\n # break\n # if (nowM//A[i]+1)*A[i] <= M:\n # nowM = (nowM//A[i]+1)*A[i] - 1\n # if nowM < nowm:\n # nowM = nowm + A[i] - 1\n # else:\n # nowM = nowm + A[i] - 1\nif ans == -1:\n print( -1)\nelse:\n print("{} {}".format(nowm, nowM))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s123720490', 's269887924', 's933508655', 's915194730'] | [14252.0, 14224.0, 14436.0, 14224.0] | [111.0, 288.0, 269.0, 165.0] | [539, 864, 466, 841] |
p03464 | u257974487 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['N = int(input())\nP = list(reversed(list(map(int, input().split()))))\n\ns, t = 2, 2\nfor i in P:\n p = max((s + i - 1) // i, 1)\n q = t // i\n print(i)\n if q < p:\n print(-1)\n quit(0)\n s, t = p * i, q * i + i - 1\n\nprint(s, t)\n', 'N = int(input())\nops = list(input().split())\nP = []\np = 0\nx = 1\nfor s in range(N-1, -1, -1):\n P.append(int(ops[s]))\nans = int(ops[N-1])\nprint(P)\nfor i in range(N-1):\n if P[i] > P[i+1]:\n p = P[i] % P[i+1]\n ans += p\n elif (P[i] * 2) > P[i+1]:\n p = (P[i] * 2) % P[i+1]\n ans += p\n else:\n ans = -1\n break\n\nif ans != -1:\n if ans % P[N-1] != 0:\n ans -= ans % P[N-1]\n while ans < max(P):\n ans += P[N-1] \n ans2 = ans + P[N-1] -1\n print(str(ans) + " " +str(ans2))\nelse:\n print(ans)', 'N = int(input())\nP = list(reversed(list(map(int, input().split()))))\n\ns, t = 2, 2\nfor i in P:\n p = max((s + i - 1) // i, 1)\n q = t // i\n if q < p:\n print(-1)\n quit(0)\n s, t = p * i, q * i + i - 1\n\nprint(s, t)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s165632546', 's722299652', 's360158568'] | [14252.0, 18956.0, 14224.0] | [213.0, 136.0, 127.0] | [248, 565, 235] |
p03464 | u284854859 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ["k = int(input())\na = list(map(int,input().split()))\na = a[::-1]\n\nc = 2 #min\nd = 2 #max\nres = 1 \n\nfor i in range(k):\n if d > a[i]:\n res = -1\n break\n if i != k-1:\n if c % a[i] != 0 or d % a[i] != 0:\n res = -1\n break\n else:\n d = d + a[i] -1\n p = c%a[i+1]\n q = d%a[i+1]\n if p == 0:\n c2 = c\n else:\n c2 = c + a[i+1]-p\n d2 = d-q\n \n if c2 <= d2:\n c = c2\n d = d2\n else:\n res = -1\n break\n else:\n d = d + a[i] -1\n \n \n \n \nif res == -1:\n print(-1)\nelse:\n print(str(c) + ' ' + str(d))", 'k = int(input())\na = list(map(int,input().split()))\n\n\ndef g(n,a,k):\n for i in range(k):\n n = n - (n%a[i])\n return n\n\n#print(g(8,a,k))\n\ns = 0\nt = 2 + k*max(a)\nwhile t-s > 1:\n m = (s+t)//2\n if g(m,a,k)> 2:\n t = m\n else:\n s = m\n \np = 0\nq = 2+k*max(a)\nwhile q-p > 1:\n m = (p+q)//2\n if g(m,a,k) >= 2:\n q = m\n else:\n p = m\n\nc = 1\nif g(s,a,k) == 2:\n res = s\nelif g(t,a,k) == 2:\n res = t\nelse:\n c = -1\n\nif g(q,a,k) == 2:\n res2 = q\nelif g(p,a,k) == 2:\n res2 = p\nelse:\n c = -1\n\nif c == 1:\n print(res2,res)\nelse:\n print(-1)'] | ['Wrong Answer', 'Accepted'] | ['s938761345', 's061195139'] | [14428.0, 14400.0] | [171.0, 1478.0] | [762, 651] |
p03464 | u315485238 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['K = int(input())\nA = list(map(int, input().split()))\n\ndef winner_count(N, A=A):\n for a in A:\n N = a*(N//a)\n return N\n\nclass lazy_eval_list(list):\n def __init__(self, func, a):\n super().__init__(a)\n self._func = func\n \n def __getitem__(self, key):\n return self._func(super().__getitem__(key))\n\nlazy_winner_count_N = lazy_eval_list(winner_count, range(1,2+sum(A)))\n\nimport bisect\n_min = bisect.bisect_left(lazy_winner_count_N, 2)\n_max = bisect.bisect_right(lazy_winner_count_N, 2)-1\n\nif _min > _max:\n\tprint(-1)\nelse:\n\tprint(_min, _max)', 'K = int(input())\nA = list(map(int, input().split()))\n\n_min=2\n_max=2\n\nfor a in A[::-1]:\n \n if _min%a:\n if a*(_min//a) + a > _max:\n print(-1)\n break\n else:\n _min = a*(_min//a) + a\n else:\n _min = _min\n \n _max = a*(_max//a) + a-1\nelse:\n print(_min, _max)'] | ['Runtime Error', 'Accepted'] | ['s066745497', 's108621790'] | [14224.0, 14252.0] | [325.0, 129.0] | [580, 340] |
p03464 | u333945892 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ["from collections import defaultdict,deque\nimport sys,heapq,bisect,math,itertools,string,queue,datetime\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nmod = 10**9+7\ndef inpl(): return list(map(int, input().split()))\ndef inpls(): return list(input().split())\n\nK = int(input())\naa = reversed(inpl())\n\nMIN = MAX = 2\nfor a in aa:\n print(a,MIN,MAX)\n if MIN%a == 0 or MAX//a - MIN//a > 0:\n MIN = ((MIN-1)//a+1) *a\n MAX = MAX//a*a+a-1\n else:\n print(-1)\n sys.exit()\n\nprint(MIN,MAX)\n", "from collections import defaultdict,deque\nimport sys,heapq,bisect,math,itertools,string,queue,datetime\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nmod = 10**9+7\ndef inpl(): return list(map(int, input().split()))\ndef inpls(): return list(input().split())\n\nK = int(input())\naa = reversed(inpl())\n\nMIN = MAX = 2\nfor a in aa:\n if MIN%a == 0 or MAX//a - MIN//a > 0:\n MIN = ((MIN-1)//a+1) *a\n MAX = MAX//a*a+a-1\n else:\n print(-1)\n sys.exit()\n\nprint(MIN,MAX)\n"] | ['Wrong Answer', 'Accepted'] | ['s763874905', 's536464917'] | [15596.0, 15600.0] | [326.0, 143.0] | [511, 490] |
p03464 | u346308892 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['\nimport numpy as np\nimport sys\nsys.setrecursionlimit(100000)\n\n\n\ndef acinput():\n return list(map(int, input().split(" ")))\n\n\n\ndirections=np.array([[1,0],[0,1],[-1,0],[0,-1]])\ndirections = list(map(np.array, directions))\n\nmod = 10**9+7\n\n\ndef factorial(n):\n fact = 1\n for integer in range(1, n + 1):\n fact *= integer\n return fact\n\n\n\ndef serch(x, count):\n #print("top", x, count)\n \n\n for d in directions:\n nx = d+x\n #print(nx)\n if np.all(0 <= nx) and np.all(nx < (H, W)):\n if field[nx[0]][nx[1]] == "E":\n count += 1 \n field[nx[0]][nx[1]] = "V"\n count = serch(nx, count) \n continue\n if field[nx[0]][nx[1]] == "#":\n field[nx[0]][nx[1]] = "V"\n count = serch(nx, count) \n \n return count\n\ndef f(x):\n for i in range(K):\n x = x-x % A[i]\n return x\n\ndef bisect_search(f,val=0,l=0,r=10**6):\n\n #is_increase=(f(r)-f(l))>=0\n\n eps=10**(-5)\n while True:\n\n c=(l+r)//2\n print(l,c,r)\n input()\n if f(c)==val and f(c-1)!=val:\n return c\n #if f(c)-val < eps:\n # return c\n\n if f(c)>val:\n r=c\n\n else:\n l=c\n \n if l==r:\n return False\n\ndef bisect_search_int(f,val=0,l=0,r=10**6,equal=False):\n #is_increase=(f(r)-f(l))>=0\n \n eps=10**(-5)\n if not equal:\n siki = "f(c) > val"\n else:\n siki = "f(c) >= val"\n\n while r-l>1:\n\n c=(l+r)//2\n \n if eval(siki,{"c":c,"f":f,"val":val}):\n r=c \n else:\n l=c\n \n #if l==r:\n # return False\n if f(l)!= f(c) and f(r)!=f(c):\n return False\n return l,r\n\n\n\nK=int(input())\nA=acinput()\n\nr = 2+K*max(A)\n\nl,r=bisect_search_int(f, 2,0,r,equal=True)\nif f(l)==2:\n resL=l\nelif f(r)==2:\n resL=r\nelse:\n resL=False\n\nl, r = bisect_search_int(f, 2,0,r,equal=False)\nif f(l) == 2:\n resR = l\nelif f(r) == 2:\n resR = r\nelse:\n resR = False\n\nif resL and resR:\n print(resL,resR)\nelse:\n print(-1)\n\n\n#for x in range(0,20):\n# print(x,f(x))\n', '\nimport numpy as np\nimport sys\nsys.setrecursionlimit(100000)\n\n\n\ndef acinput():\n return list(map(int, input().split(" ")))\n\n\n\ndirections=np.array([[1,0],[0,1],[-1,0],[0,-1]])\ndirections = list(map(np.array, directions))\n\nmod = 10**9+7\n\n\ndef factorial(n):\n fact = 1\n for integer in range(1, n + 1):\n fact *= integer\n return fact\n\n\n\ndef serch(x, count):\n #print("top", x, count)\n \n\n for d in directions:\n nx = d+x\n #print(nx)\n if np.all(0 <= nx) and np.all(nx < (H, W)):\n if field[nx[0]][nx[1]] == "E":\n count += 1 \n field[nx[0]][nx[1]] = "V"\n count = serch(nx, count) \n continue\n if field[nx[0]][nx[1]] == "#":\n field[nx[0]][nx[1]] = "V"\n count = serch(nx, count) \n \n return count\n\ndef f(x):\n for i in range(K):\n x = x-x % A[i]\n return x\n\ndef bisect_search(f,val=0,l=0,r=10**6):\n\n #is_increase=(f(r)-f(l))>=0\n\n eps=10**(-5)\n while True:\n\n c=(l+r)//2\n print(l,c,r)\n input()\n if f(c)==val and f(c-1)!=val:\n return c\n #if f(c)-val < eps:\n # return c\n\n if f(c)>val:\n r=c\n\n else:\n l=c\n \n if l==r:\n return False\n\ndef bisect_search_int(f,val=0,l=0,r=10**6,equal=False):\n #is_increase=(f(r)-f(l))>=0\n \n eps=10**(-5)\n if not equal:\n siki = "f(c) > val"\n else:\n siki = "f(c) >= val"\n\n while r-l>1:\n\n c=(l+r)//2\n \n if eval(siki,{"c":c,"f":f,"val":val}):\n r=c \n else:\n l=c\n \n #if l==r:\n # return False\n if f(l)!= f(c) and f(r)!=f(c):\n return False\n return l,r\n\n\n\nK=int(input())\nA=acinput()\n\nR = 2+K*max(A)\n#R=10**6\n\nl,r=bisect_search_int(f, 2,0,R,equal=True)\nif f(l)==2:\n resL=l\nelif f(r)==2:\n resL=r\nelse:\n resL=-1\n\nl, r = bisect_search_int(f, 2,0,R,equal=False)\n#print(l,r,f(l),f(r))\nif f(l) == 2:\n resR = l\nelif f(r) == 2:\n resR = r\nelse:\n resR = -1\n\nif resL>=0:\n print(resL,resR)\nelse:\n print(-1)\n\n\n#for x in range(0,20):\n# print(x,f(x))\n'] | ['Wrong Answer', 'Accepted'] | ['s181222655', 's085418107'] | [23400.0, 23992.0] | [1715.0, 1789.0] | [2197, 2216] |
p03464 | u346812984 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['import sys\nimport math\n\nsys.setrecursionlimit(10 ** 6)\nINF = float("inf")\nMOD = 10 ** 9 + 7\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n K = int(input())\n A = list(map(int, input().split()))\n\n if A[-1] != 2:\n print(-1)\n return\n\n \n m = 2\n M = 2\n for i in range(K - 2, -1, -1):\n n = (m + A[i] - 1) // A[i]\n tmp_m = n * A[i]\n tmp_M = (n + 1) * A[i] - 1\n if tmp_m > M or tmp_M < m:\n print(-1)\n return\n m = tmp_m\n M = tmp_M\n\n print(m, M)\n\n\nif __name__ == "__main__":\n main()\n', 'import sys\nimport math\n\nsys.setrecursionlimit(10 ** 6)\nINF = float("inf")\nMOD = 10 ** 9 + 7\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n K = int(input())\n A = list(map(int, input().split()))\n\n \n m = 2\n M = 2\n for i in range(K - 1, -1, -1):\n n = (m + A[i] - 1) // A[i]\n tmp_m = n * A[i]\n tmp_M = (M / A[i]) * A[i] + A[i] - 1\n if tmp_m > M or tmp_M < m:\n print(-1)\n return\n m = tmp_m\n M = tmp_M\n\n print(m, M)\n\n\nif __name__ == "__main__":\n main()\n', 'import sys\nimport math\n\nsys.setrecursionlimit(10 ** 6)\nINF = float("inf")\nMOD = 10 ** 9 + 7\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n K = int(input())\n A = list(map(int, input().split()))\n\n \n m = 2\n M = 2\n for i in range(K - 1, -1, -1):\n n = (m + A[i] - 1) // A[i]\n tmp_m = n * A[i]\n tmp_M = (M // A[i]) * A[i] + A[i] - 1\n if tmp_m > M or tmp_M < m:\n print(-1)\n return\n m = tmp_m\n M = tmp_M\n\n print(m, M)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s117653891', 's182638542', 's454242174'] | [15020.0, 15020.0, 15020.0] | [65.0, 124.0, 99.0] | [645, 602, 603] |
p03464 | u375616706 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nK = int(input())\nL = list(map(int, input().split()))\n\nma = 2\nmi = 2\nL = reversed(L)\n\nfor l in L:\n if l > ma:\n print(-1)\n exit()\n else:\n mi = (mi//l)*l\n ma = (ma//l)*(l)+l-1\nprint(mi, ma)\n', 'from math import ceil\n# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nK = int(input())\nL = list(map(int, input().split()))\n\nmaxr = 2\nminr = 2\nr = 0\nfor n in reversed(L):\n if ceil(maxr//n) > minr:\n # if any(x % n == 0 for x in range(minr, maxr+1)):\n # if minr//n <= maxr//n:\n minr = ceil(minr/n)*n\n maxr = (maxr)//n*n+n-1\n else:\n n = -1\n break\n\nif n == -1:\n print(n)\nelse:\n print(int(minr), maxr)\n', 'from math import ceil\n# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nK = int(input())\nL = list(map(int, input().split()))\n\nmaxr = 2\nminr = 2\nr = 0\nfor n in reversed(L):\n if ceil(maxr//n) >= minr:\n # if any(x % n == 0 for x in range(minr, maxr+1)):\n # if minr//n <= maxr//n:\n minr = ceil(minr/n)*n\n maxr = (maxr)//n*n+n-1\n else:\n n = -1\n break\n\nif n == -1:\n print(n)\nelse:\n print(int(minr), maxr)\n', 'from math import ceil\n# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nK = int(input())\nL = list(map(int, input().split()))\n\nmaxr = 2\nminr = 2\nr = 0\nfor n in reversed(L):\n \n if ceil(maxr//n)*n >= minr:\n minr = ceil(minr/n)*n\n maxr = (maxr)//n*n+n-1\n else:\n print(-1)\n exit()\n\nprint(int(minr), maxr)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s321483885', 's396893579', 's677906646', 's762023353'] | [14252.0, 14252.0, 14252.0, 14252.0] | [86.0, 43.0, 43.0, 135.0] | [320, 501, 502, 424] |
p03464 | u391475811 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['K = int(input())\nA = [int(i) for i in input().split()]\nA.reverse()\n\nmin_A=2\nmax_A=3\ncnt=True\nif A[-1]!=2:\n print(-1)\n cnt=False\nfor i in range(1,K):\n a=(min_A+A[i]-1)//A[i]*A[i]\n b=max_A//A[i]*A[i]\n if a>b:\n print(-1)\n cnt=False\n break\n else:\n min_A=a\n max_A=b+A[i]-1\n\nif cnt:\n print(min_A,max_A)\n', 'K = int(input())\nA = [int(i) for i in input().split()]\nA.reverse()\n\nmin_A=2\nmax_A=3\njud=True\nfor i in range(1,K):\n if A[i]>max_A:\n print(-1)\n jud=False\n break\n if min_A>A[i]:\n cnt=2\n while True:\n if A[i]*cnt>=min_A:\n min_A=A[i]*cnt\n break\n cnt+=1\n while True:\n if A[i]*(cnt+1)-1>max_A:\n max_A=A[i]*cnt-1\n break\n cnt+=1\n else:\n min_A=A[i]\n max_A=A[i]*2-1\nif jud:\n print(min_A,max_A)', 'K = int(input())\nA = [int(i) for i in input().split()]\nA.reverse()\n\nmin_A=2\nmax_A=3\ncnt=True\nif A[0]!=2:\n print(-1)\n cnt=False\nfor i in range(1,K):\n a=(min_A+A[i]-1)//A[i]*A[i]\n b=max_A//A[i]*A[i]\n if a>b and cnt:\n print(-1)\n cnt=False\n break\n else:\n min_A=a\n max_A=b+A[i]-1\n\nif cnt:\n print(min_A,max_A)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s310723144', 's581291447', 's791784922'] | [14224.0, 14436.0, 14252.0] | [132.0, 2104.0, 140.0] | [319, 457, 326] |
p03464 | u451017206 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['from math import floor, ceil\nk = int(input())\na = [int(i) for i in input().split()]\nl,r = 2,2\nfor ai in a[::-1]:\n if l // ai >= 1 or r // ai >= 1:\n print(-1)\n exit()\n l = ceil(l/ai)*ai\n r = floor(r/ai) * ai + ai - 1\nprint(l,r)\n', 'from math import floor, ceil\nk = int(input())\na = [int(i) for i in input().split()]\nl,r = 2,2\nfor ai in a[::-1]:\n if not(l // ai >= 1 and r // ai >= 1):\n print(-1)\n exit()\n l = ceil(l/ai)*ai\n r = floor(r/ai) * ai + ai - 1\nprint(l,r)', 'from math import floor, ceil\nk = int(input())\na = [int(i) for i in input().split()]\nl,r = 2,2\nfor ai in a[::-1]:\n xi = ceil(l/ai)\n yi = floor(r/ai)\n if xi > yi:\n print(-1)\n exit()\n l = xi * ai\n r = yi * ai + ai - 1\nprint(l, r)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s621661750', 's912186495', 's733584242'] | [14252.0, 14252.0, 14252.0] | [47.0, 118.0, 134.0] | [250, 255, 255] |
p03464 | u497046426 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['def div_ceil(x, y): return (x + y - 1) // y\n\nN = int(input())\n*A, = map(int, input().split())\ncand_min, cand_max = 2, 2\nfor a in reversed(A):\n if a > cand_max: print(-1); break\n cand_max = (cand_max // a) * a\n cand_min = div_ceil(cand_min, a) * a\n cand_max = cand_max + a - 1\nelse:\n cand_max = (cand_max // a) * a\n print(cand_min, cand_max)', 'def div_ceil(x, y): return (x + y - 1) // y\n\nN = int(input())\n*A, = map(int, input().split())\ncand_min, cand_max = 2, 2\nfor a in reversed(A):\n if div_ceil(cand_min, a) * a > cand_max: print(-1); break\n cand_min = div_ceil(cand_min, a) * a\n cand_max = (cand_max // a) * a + a - 1\nelse:\n print(cand_min, cand_max)'] | ['Wrong Answer', 'Accepted'] | ['s265438709', 's544673463'] | [14252.0, 14252.0] | [116.0, 137.0] | [358, 323] |
p03464 | u509368316 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['K=int(input())\nA=list(map(int,input().split()))\nl,h=2,2\nfor a in A[::-1]:\n if h<a or h//a==l//a:\n l=h=-1\n break\n else:\n l=-(-l//a)*a\n h=(h//a+1)*a-1\nif l==h==-1:\n print(-1)\nelse:\n print(l,h)', 'K=int(input())\nA=list(map(int,input().split()))\nl,h=2,2\nfor a in A[::-1]:\n l=-(-l//a)*a\n h=(h//a+1)*a-1\n if l>h:\n l=h=-1\n break\nif l==h==-1:\n print(-1)\nelse:\n print(l,h)'] | ['Wrong Answer', 'Accepted'] | ['s166701034', 's475448650'] | [14252.0, 14252.0] | [42.0, 100.0] | [226, 198] |
p03464 | u545368057 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['K = int(input())\nAs = list(map(int, input().split()))\n\ndef f(n):\n for a in As:\n x,_ = divmod(n,a)\n n = x*a\n return n\n\nl,r = 1, 10**10\nwhile r-l > 1:\n m = (r+l)//2\n if f(m) < 2:\n l = m\n else:\n r = m\nmn = r\n\nl,r = 1, 10**10\nwhile r-l > 1:\n m = (r+l)//2\n if f(m) <= 3:\n l = m\n else:\n r = m\nmx = l\nif mn < mx:\n print(-1)\nelse:\n print(mn,mx)\n', 'n = int(input())\nAs = list(map(int, input().split()))\n \ndef f(m):\n debug = m\n for a in As:\n i = m // a\n m = i * a\n return m\n\n\nl = 1\nr = 10**5+1\nwhile r-l > 1:\n m = (r+l)//2\n if f(m) <= 1: l = m\n else: r = m\nans1 = r\nl = 1\nr = 10**5 + 1\nwhile r-l > 1:\n m = (r+l)//2\n if f(m) <= 2: l= m\n else: r = m\nans2 = l\n\nif ans1 >= ans2:\n print(-1)\nelse:\n print(ans1[1],ans2[0])', 'n = int(input())\nAs = list(map(int, input().split()))\n \ndef f(m):\n debug = m\n for a in As:\n i = m // a\n m = i * a\n return m\n\n\nl = 1\nr = 10**20\nwhile r-l > 1:\n m = (r+l)//2\n if f(m) <= 1: l = m\n else: r = m\nans1 = r\nl = 1\nr = 10**20\nwhile r-l > 1:\n m = (r+l)//2\n if f(m) <= 2: l= m\n else: r = m\nans2 = l\n\nif ans1 > ans2:\n print(-1)\nelse:\n print(ans1,ans2)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s252129542', 's880351896', 's023054022'] | [20264.0, 20508.0, 20492.0] | [724.0, 201.0, 1364.0] | [409, 430, 419] |
p03464 | u619819312 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['k=int(input())\na=list(map(int,input().split()))\ndef f(x):\n for i in range(k):\n x-=x%a[i]\n return x\ns=k*max(a)+3\nt=0\nwhile s-t>1:\n x=(s+t)//2\n if f(x)>2:\n s=x\n else:\n t=x\np=k*max(a)+3\nq=0\nwhile p-q>1:\n x=(p+q)//2\n if f(x)>=2:\n q=x\n else:\n p=x\nif f(t)==2:\n if f(q)==2:\n print(q,t)\n else:\n print(-1)\nelse:\n print(-1)\nprint(f(p))', 'k=int(input())\na=list(map(int,input().split()))\ns=2+k*max(a)\nl,r=s+1,0\nwhile l-r>1:\n t=(l+r)//2\n p=t\n for i in a:\n t-=t%i\n if t>=2:\n l=p\n else:\n r=p\ne=l\nl,r=s+1,0\nwhile l-r>1:\n t=(l+r)//2\n p=t\n for i in a:\n t-=t%i\n if t>2:\n l=p\n else:\n r=p\nprint(str(max(e,2))+" "+str(r)if r>e or r<2 else -1)'] | ['Wrong Answer', 'Accepted'] | ['s889631839', 's100184467'] | [14428.0, 14428.0] | [1696.0, 1836.0] | [407, 364] |
p03464 | u636684559 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ["K=int(input())\nA=input().split(' ')\nmin=2\nmax=2\nflag=0\nwhile K>0:\n K=K-1\n i=int(A[K])\n if max<i:\n print('-1')\n flag=1\n break\n else:\n min=min+i-(min%i)\n max=max+i-(max%i)-1\nif flag==0:\n print('{0} {1}'.format(min,max))", "K=int(input())\nA=input().split(' ')\nmin=2\nmax=2\nflag=0\nwhile K>0:\n K=K-1\n i=int(A[K])\n if max<i:\n print('-1')\n flag=1\n break\n elif i<min:\n if min%i!=0:min=min+i-(min%i)\n else:min=min+(min%i)\n max=max+i-(max%i)-1\n if min>max:\n print('-1')\n flag=1\n break\n else:\n min=i\n max=max+i-(max%i)-1\nif flag==0:\n print('{0} {1}'.format(min,max))"] | ['Wrong Answer', 'Accepted'] | ['s644235940', 's183307814'] | [11980.0, 13100.0] | [115.0, 151.0] | [237, 381] |
p03464 | u637175065 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ["import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**15\nmod = 10**9+7\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef I(): return int(sys.stdin.readline())\ndef F(): return float(sys.stdin.readline())\ndef S(): return input()\ndef pf(s): return print(s, flush=True)\n\n\ndef main():\n n = I()\n a = LI() + [1]\n if a[-1] != 2:\n return -1\n b = 2\n c = 4\n for i in range(n-1,-1,-1):\n t = a[i]\n if b * 2 <= t:\n return -1\n if b % t == 0:\n pass\n elif b > t:\n b += t-b%t\n if b % t != 0:\n return 1/0\n else:\n b = t\n if c % t == 0:\n pass\n elif c > t:\n c += t-c%t\n else:\n return -1\n\n return '{} {}'.format(b, c-1)\n\nprint(main())\n\n\n", "import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**15\nmod = 10**9+7\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef I(): return int(sys.stdin.readline())\ndef F(): return float(sys.stdin.readline())\ndef S(): return input()\ndef pf(s): return print(s, flush=True)\n\n\ndef bs(f, mi, ma):\n mm = -1\n while ma > mi:\n mm = (ma+mi) // 2\n if f(mm):\n mi = mm + 1\n else:\n ma = mm\n if f(mm):\n return mm + 1\n return mm\n\ndef main():\n n = I()\n a = LI()\n\n def f(i):\n for c in a:\n i -= i%c\n return i < 2\n\n def g(i):\n for c in a:\n i -= i%c\n return i <= 2\n\n mi = bs(f,0,sum(a)+3)\n ma = bs(g,0,sum(a)+3) - 1\n if mi <= ma:\n return '{} {}'.format(mi,ma)\n return -1\n\n\n\n\nprint(main())\n\n\n"] | ['Wrong Answer', 'Accepted'] | ['s344703394', 's786226372'] | [16652.0, 16644.0] | [68.0, 1073.0] | [1108, 1161] |
p03464 | u665415433 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ["K = int(input())\nA = list(map(int,input().split()))\na = K-1\np = 2\nwhile 0 <= a:\n if A[a-1] > A[a]*2:\n print('-1')\n exit()\n num = 1\n if A[a] < p:\n while A[a]*num < p:\n num += 1\n p = num*A[a]\n a -= 1\npmax = p\nwhile pmax < A[1]*2:\n pmax += A[0]\npmax -= A[0]\nprint(p,pmax)\n", "import math\nK = int(input())\nA = list(map(int,input().split()))\na = 1\nL,S = 2,2 \n\nwhile a <= K:\n if math.ceil(S/A[-a])*A[-a] < S or L < math.ceil(S/A[-a])*A[-a]:\n print('-1')\n exit()\n S = math.ceil(S/A[-a])*A[-a]\n L = math.floor(L/A[-a])*A[-a] + A[-a] -1\n a += 1\nprint(S,L)\n\n \n"] | ['Runtime Error', 'Accepted'] | ['s683596780', 's472497416'] | [14224.0, 15020.0] | [2104.0, 249.0] | [319, 306] |
p03464 | u810735437 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['\n\n\n# ...\n\nK = int(input())\nAs = list(map(int, input().split()))\nAs.reverse()\n\nfail = False\nif As[0] != 2:\n fail = True\nelse:\n mn = 2\n mx = 3\n for a in As[1:]:\n \n \n if mn % a != 0:\n mn = (mn // a) * a + a\n if mx % a != 0:\n mx = (mx // a) * a\n if mn > mx:\n fail = True\n break\n\n \n mx = mx + (a - 1)\nif fail:\n print(-1)\nelse:', '\n\n\n# ...\n\nK = int(input())\nAs = list(map(int, input().split()))\nAs.reverse()\n\nfail = False\nif As[0] != 2:\n fail = True\nelse:\n mn = 2\n mx = 3\n for a in As[1:]:\n \n \n if mn % a != 0:\n mn = (mn // a) * a + a\n if mx % a != 0:\n mx = (mx // a) * a\n if mn > mx:\n fail = True\n break\n\n \n mx = mx + (a - 1)\nif fail:\n print(-1)\nelse:\n print(mn, mx)\n'] | ['Runtime Error', 'Accepted'] | ['s341574599', 's509996958'] | [3060.0, 14252.0] | [17.0, 130.0] | [720, 739] |
p03464 | u846150137 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ["n=int(input())\na=reversed([int(i) for i in input().split()])\nmax_a=3\nmin_a=2\na0=2\nflg=0\nan=list(a)\nif an[0]!=2:\n f=1\nfor i in an:\n if i > max_a:\n flg=1\n break\n elif i !=a0: \n if i>a0:\n min_a +=i-a0\n else:\n min_a+= i - min_a % i \n max_a=min_a + i -1\n a0=i\n\nif flg==1:\n print('-1')\nelse:\n print(max_a,min_a)", "n=int(input())\na=reversed([int(i) for i in input().split()])\nmax_a=3\nmin_a=2\na0=2\nflg=0\nan=list(a)\nif an[0]!=2:\n flg=1\n\nfor i in an:\n if i > max_a:\n flg=1\n break\n elif i !=a0: \n if i>a0:\n min_a +=i-a0\n else:\n min_a+= i - min_a % i \n max_a=min_a + i -1\n a0=i\n\nif flg==1:\n print('-1')\nelse:\n print(max_a,min_a)", "n=int(input())\na=[int(i) for i in input().split()][::-1]\nmax_a=3\nmin_a=2\na0=2\nflg=0\nan=list(a)\nif an[0]!=2:\n flg=1\n\nfor i in an:\n if i > max_a:\n flg=1\n break\n elif i !=a0: \n if i>a0:\n min_a +=i-a0\n else:\n min_a+= i - min_a % i \n max_a=min_a + i -1\n a0=i\n\nif flg==1:\n print('-1')\nelse:\n print(max_a,min_a)", 'input()\nl=s=2\nfor i in map(int,input().split()[::-1]):\n s=i*(s//i+[1,0][s%i==0])\n l=i*(l//i+1)-1\nprint(-1) if s>l else print(s,l)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s107149203', 's270015149', 's494054037', 's230450836'] | [16288.0, 14224.0, 14252.0, 11132.0] | [98.0, 97.0, 105.0, 130.0] | [339, 342, 338, 131] |
p03464 | u865741247 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['import copy\ndef ketanowa(p):\n ans=0\n p=str(p)\n for i in p:\n ans+=int(i)\n return ans\n\ndef main():\n n=int(input())\n temp=input().split(" ")\n nums=list(map(int,temp))\n nums_o=copy.copy(nums)\n nums.reverse()\n for i in range(len(nums)-1):\n if nums[i]>nums[i+1]:\n p=int(nums[i]/nums[i+1])\n nums[i+1]*=(p+1)\n nums.reverse()\n imp =True\n min=nums[0]\n max=nums[0]+nums_o[0]-1\n\n test=min\n for i in range(len(nums)):\n test-=test%nums_o[i]\n if test<=0:\n imp=True\n break\n if test!=2:\n imp=True\n test=max\n for i in range(len(nums)):\n test-=test%nums_o[i]\n if test<=0:\n imp=True\n break\n if test!=2:\n imp=True\n\n\n if imp:\n print("-1")\n else:\n print(str(min)+" "+str(max)) \n\n\n\n\nif __name__ == \'__main__\':\n main()\n', 'import copy\nimport math\n\n\ndef main():\n n=int(input())\n temp=input().split(" ")\n nums=list(map(int,temp))\n nums.reverse()\n l=2 # min \n r=2 # max\n for num in nums:\n # if num<=l and num>=r:\n r=(int(r/num)+1)*(num)-1\n l= math.ceil(l/num)*num\n \n if l>r:\n print("-1")\n return 0\n print(str(l)+" "+str(r)) \n \n\n\n\nif __name__ == \'__main__\':\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s951393280', 's009159440'] | [18788.0, 14764.0] | [131.0, 102.0] | [906, 432] |
p03464 | u870262604 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['k = int(input())\na = list(map(int, input().split()))\ndef solve():\n\n if a[k-1] != 2:\n print(-1)\n return\n\n if k == 1:\n print(2, 3)\n return\n\n mi = 0\n mx = 0\n\n for i in range(k):\n\n if i==0:\n mi = 2\n mx = 2\n # elif i > 1 and i != k-1:\n # if a[k-i-1] == a[k-(i-1)-1]:\n # continue\n\n mx = mx + a[k-i-1] - 1\n print(mi, mx)\n\n if i == k-1:\n pass\n else:\n j = i+1\n if mx < a[k-j-1]:\n print(-1)\n return\n\n if mi%a[k-j-1] != 0:\n mi = mi + (a[k-j-1] - mi%a[k-j-1])\n if mx%a[k-j-1] != 0:\n mx = mx - mx % a[k-j-1]\n print(mi, mx)\n print(mi, mx)\nsolve()\n', 'k = int(input())\na = list(map(int, input().split()))\ndef solve():\n\n if a[k-1] != 2:\n print(-1)\n return\n\n mi = 2\n mx = 2\n\n for i in range(k):\n j = k-i-1\n\n mx = mx + a[j] - 1\n\n if j == 0:\n pass\n else:\n na = a[j-1]\n \n if mx % na != 0 and mi % na != 0 and ((mx % na) - (mi % na)) == (mx - mi):\n print(-1)\n return\n\n if mi%na != 0:\n mi = mi + (na - mi%na)\n\n if mx%na != 0:\n mx = mx - (mx % na)\n\n print(mi, mx)\nsolve()\n'] | ['Wrong Answer', 'Accepted'] | ['s616296289', 's736783947'] | [14428.0, 14432.0] | [425.0, 155.0] | [791, 595] |
p03464 | u925364229 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['K = int(input())\nA = list(map(int,input().split()))\n\nif A[-1] != 2:\n\tprint(-1)\n\texit(0)\n\nminval = 2\nmaxval = 3\nfor i in range(K-1,-1,-1):\n\tif maxval < A[i] or (minval > A[i] and ((maxval - (maxval % A[i]) < minval)):\n\t\tprint(-1)\n\t\texit(0)\n\n\tif minval > A[i]:\n\t\tif minval % A[i] != 0:\n\t\t\tminval = minval + (A[i] - (minval % A[i]))\n\n\t\tmaxval = (maxval - (maxval % A[i]) + A[i] - 1)\n\n\telse:\n\t\tmaxval = A[i] + (A[i] - 1)\n\t\tminval = A[i]\n\t\t\n\nprint(str(minval) + " " + str(maxval))\n', 'K = int(input())\nA = list(map(int,input().split()))\n\nif A[-1] != 2:\n\tprint(-1)\n\texit(0)\n\nminval = 2\nmaxval = 3\nfor i in range(K-1,-1,-1):\n\tif maxval < A[i] or (minval > A[i] and ((maxval - (maxval % A[i]) < minval))):\n\t\tprint(-1)\n\t\texit(0)\n\n\tif minval > A[i]:\n\t\tif minval % A[i] != 0:\n\t\t\tminval = minval + (A[i] - (minval % A[i]))\n\n\t\tmaxval = (maxval - (maxval % A[i]) + A[i] - 1)\n\n\telse:\n\t\tmaxval = A[i] + (A[i] - 1)\n\t\tminval = A[i]\n\t\t\n\nprint(str(minval) + " " + str(maxval))\n'] | ['Runtime Error', 'Accepted'] | ['s770755030', 's238374001'] | [2940.0, 14428.0] | [17.0, 168.0] | [476, 477] |
p03464 | u936985471 | 2,000 | 524,288 | An adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the i-th round, the game master announces: * Form groups consisting of A_i children each! Then the children who are still in the game form as many groups of A_i children as possible. One child may belong to at most one group. Those who are left without a group leave the game. The others proceed to the next round. Note that it's possible that nobody leaves the game in some round. In the end, after the K-th round, there are exactly two children left, and they are declared the winners. You have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it. Find the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist. | ['import sys\nreadline = sys.stdin.readline\n\nK = int(readline())\nA = list(map(int,readline().split()))[::-1] \n\n\ncur = 2\n\nif A[0] != 2: \n print(-1)\n exit(0)\n\n#print(A)\n\ndef getMinVal(c,a):\n \n return (((c- 1) // a) + 1) * a\n\ndef getMaxVal(minval,a):\n \n return minval + a - 1\n\n\nfor i in range(len(A)):\n \n minpos = getMinVal(cur,A[i])\n maxpos = getMaxVal(minpos,A[i])\n \n if A[i] < minpos or maxpos < A[i]:\n print(-1)\n exit(0)\n\n \n if i + 1 < len(A):\n if minpos % A[i + 1] != 0:\n cur = getMinVal(minpos,A[i + 1])\n else:\n cur = minpos\n else:\n cur = minpos\n \n\nans = [0] * 2\nans[0] = cur\n \ndef getNextMax(c,a):\n \n return (c // a) * a\n \ncur = 2\n\nfor i in range(len(A)):\n \n# print("i",i,"A[i]",A[i])\n minpos = getMinVal(cur,A[i])\n maxpos = getMaxVal(minpos,A[i])\n\n if cur * 2 < A[i]:\n print(-1)\n exit(0)\n \n \n if i + 1 < len(A):\n if maxpos % A[i + 1] != 0:\n cur = getNextMax(maxpos,A[i + 1])\n else:\n cur = maxpos\n else:\n cur = maxpos\n# print("cur",cur)\n \nans[1] = cur\n\nprint(*ans)\n', '\n\n\nimport sys\nreadline = sys.stdin.readline\n\nK = int(readline())\nA = list(map(int,readline().split()))[::-1] \n\nmincur = 2\nmaxcur = 2\n\ndef get_min_val(c,a): \n return ((c - 1)//a + 1) * a\n\ndef get_max_val(c,a): \n return (c // a) * a\n\nif A[0] != 2:\n print(-1)\n exit(0)\n \nfor i in range(len(A)):\n mincur = mincur\n maxcur = maxcur + A[i] - 1\n if i + 1 < len(A):\n mincur = get_min_val(mincur,A[i + 1])\n maxcur = get_max_val(maxcur,A[i + 1])\n if mincur > maxcur:\n print(-1)\n exit(0)\nprint(mincur,maxcur)\n'] | ['Wrong Answer', 'Accepted'] | ['s449755077', 's201371530'] | [14252.0, 15020.0] | [284.0, 156.0] | [1818, 967] |
p03465 | u075595666 | 2,000 | 524,288 | You are given N integers A_1, A_2, ..., A_N. Consider the sums of all non-empty subsequences of A. There are 2^N - 1 such sums, an odd number. Let the list of these sums in non-decreasing order be S_1, S_2, ..., S_{2^N - 1}. Find the median of this list, S_{2^{N-1}}. | ['n = int(input())\na = list(map(int,input().split()))\ns = sum(a)\na.sort()\nb = 1\nfor i in a:\n b |= b<<i\n \nb &= 2**(s+1)-2**((s-1)//2)\nt = b&(-b)\nprint(t.bit_length()-1)', 'n = int(input())\na = list(map(int,input().split()))\ns = sum(a)\na.sort()\nb = 1\nfor i in a:\n b |= b<<i\n \nb &= 2**(s+1)-2**((s+1)//2)\nt = b&(-b)\nprint(t.bit_length()-1)'] | ['Wrong Answer', 'Accepted'] | ['s072902179', 's487320856'] | [11388.0, 11580.0] | [430.0, 435.0] | [167, 167] |
p03465 | u340781749 | 2,000 | 524,288 | You are given N integers A_1, A_2, ..., A_N. Consider the sums of all non-empty subsequences of A. There are 2^N - 1 such sums, an odd number. Let the list of these sums in non-decreasing order be S_1, S_2, ..., S_{2^N - 1}. Find the median of this list, S_{2^{N-1}}. | ['n = int(input())\narr = list(map(int, input().split()))\ndp = 1\n\nfor a in arr:\n dp |= dp << a\n\nts = 1 << ((dp.bit_length() + 1) // 2 - 1)\nwhile not dp & ts:\n ts <<= 1\n\nprint(ts.bit_length())\n', 'n = int(input())\narr = list(map(int, input().split()))\ndp = 1\n\nfor a in arr:\n dp |= dp << a\n\nts = 1 << (dp.bit_length() - 1)\nwhile not dp & ts:\n ts <<= 1\n\nprint(ts.bit_length())\n', 'n, arr, dp = int(input()), list(map(int, input().split())), 1\nfor a in arr:\n dp |= dp << a\nofs = (sum(arr) + 1) // 2\ndp >>= ofs\nprint((dp & -dp).bit_length() + ofs - 1)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s396492605', 's763705112', 's779555302'] | [5464.0, 5456.0, 5452.0] | [651.0, 457.0, 453.0] | [195, 184, 172] |
p03466 | u144695182 | 2,000 | 524,288 | Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions: * f(A, B) has length A + B; * f(A, B) contains exactly A letters `A` and exactly B letters `B`; * The length of the longest substring of f(A, B) consisting of equal letters (ex., `AAAAA` or `BBBB`) is as small as possible under the conditions above; * f(A, B) is the lexicographically smallest string satisfying the conditions above. For example, f(2, 3) = `BABAB`, and f(6, 4) = `AABAABAABB`. Answer Q queries: find the substring of f(A_i, B_i) from position C_i to position D_i (1-based). | ['for t in range(int(input())):\n a,b,c,d=map(int,input().split(\' \'));l,x,y,o=(a+b)//(min(a,b)+1),0,0,""\n\tif a*l<=b:y=a+b\n\telif b*l<=a:x=a+b\n\telse:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)\n\tfor i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]\n\tprint(o)', 'for t in range(int(input())):\n\ta,b,c,d=map(int,input().split(\' \'));l,x,y,o=(a+b)//(min(a,b)+1),0,0,""\n\tif a*l<=b:y=a+b\n\telif b*l<=a:x=a+b\n\telse:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)\n\tfor i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]\n\tprint(o)'] | ['Runtime Error', 'Accepted'] | ['s422209750', 's510702582'] | [2940.0, 3188.0] | [17.0, 82.0] | [319, 318] |
p03466 | u545001286 | 2,000 | 524,288 | Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions: * f(A, B) has length A + B; * f(A, B) contains exactly A letters `A` and exactly B letters `B`; * The length of the longest substring of f(A, B) consisting of equal letters (ex., `AAAAA` or `BBBB`) is as small as possible under the conditions above; * f(A, B) is the lexicographically smallest string satisfying the conditions above. For example, f(2, 3) = `BABAB`, and f(6, 4) = `AABAABAABB`. Answer Q queries: find the substring of f(A_i, B_i) from position C_i to position D_i (1-based). | ['for t in range(int(input())):\n\ta,b,c,d=map(int,input().split(\' \'));l,x,y,o=(a+b)//(min(a,b)+1),(a*l-b)//(l-1),(b*l-a)//(l-1),""\n\tif a*l<=b:x,y=0,a+b\n\telif b*l<=a:x,y=a+b,0\n\tfor i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]\n\tprint(o)', 'for t in range(int(input())):\n\ta,b,c,d=map(int,input().split(\' \'));l,o=(a+b)//(min(a,b)+1),"";x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)\n\tif a*l<=b:x,y=0,a+b\n\telif b*l<=a:x,y=a+b,0\n\tfor i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]\n\tprint(o)', 'for t in range(int(input())):\n\ta,b,c,d=map(int,input().split(\' \'));l,x,y,o=(a+b)//(min(a,b)+1),a+b,0,""\n\tif a*l<=b:x,y=0,a+b\n\telif b*l>a:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)\n\tfor i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]\n\tprint(o)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s178097612', 's981183665', 's305958224'] | [3064.0, 3188.0, 3188.0] | [18.0, 80.0, 81.0] | [312, 312, 311] |
p03466 | u858748695 | 2,000 | 524,288 | Let f(A, B), where A and B are positive integers, be the string satisfying the following conditions: * f(A, B) has length A + B; * f(A, B) contains exactly A letters `A` and exactly B letters `B`; * The length of the longest substring of f(A, B) consisting of equal letters (ex., `AAAAA` or `BBBB`) is as small as possible under the conditions above; * f(A, B) is the lexicographically smallest string satisfying the conditions above. For example, f(2, 3) = `BABAB`, and f(6, 4) = `AABAABAABB`. Answer Q queries: find the substring of f(A_i, B_i) from position C_i to position D_i (1-based). | ["#!/usr/bin/env python3\nimport math\nimport bisect\nQ = int(input())\nfor _ in range(Q):\n A, B, C, D = map(int, input().split())\n K = math.ceil(max(A, B) / (min(A, B) + 1))\n xs = ((A - i + 1) * K < B - max(0, (i - 1) // K) for i in range(A + 1))\n p = bisect.bisect(list(xs), False)\n f = ''\n for i in range(C - 1, D):\n na = p\n nb = max(0, (na - 1) // K)\n if i < nb * (K + 1):\n f += ('A', 'B')[i % (K + 1) == K]\n elif i < na + nb:\n f += 'A'\n else:\n j = A + B - i - 1\n nb = B - nb\n na = max(0, (nb - 1) // K)\n if j < na * (K + 1):\n f += ('B', 'A')[j % (K + 1) == K]\n else:\n f += 'B'\n print(f)\n", "#!/usr/bin/env python3\nimport math\nQ = int(input())\nnum = lambda x: (x, max(0, (x - 1) // K))\nsub = lambda xs, ys: [x - y for (x, y) in zip(xs, ys)]\nfor _ in range(Q):\n A, B, C, D = map(int, input().split())\n K = math.ceil(max(A, B) / (min(A, B) + 1))\n l, r = 0, A + 1\n while r - l > 1:\n m = (l + r) // 2\n rA, rB = sub((A, B), num(m))\n l, r = ((m, r), (l, m))[(rA + 1) * K < rB]\n\n f = ''\n for i in range(C - 1, D):\n na, nb = num(l)\n if i < na + nb:\n f += ('A', 'B')[i % (K + 1) == K] if i < nb * (K + 1) else 'A'\n else:\n nb, na = num(B - nb)\n j = A + B - i - 1\n f += ('B', 'A')[j % (K + 1) == K] if j < na * (K + 1) else 'B'\n print(f)\n"] | ['Wrong Answer', 'Accepted'] | ['s437963317', 's811119816'] | [44732.0, 3188.0] | [2106.0, 220.0] | [749, 742] |
p03481 | u018679195 | 2,000 | 262,144 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possible length of the sequence. | ['x, y = map(int, input().split())\ncnt = 1;\nwhile x < y:\n x *= 2\n cnt += 1\nprint(cnt)', 'x, y = map(int, input().split())\ncnt = 0;\nwhile x <= y:\n cnt += 1\n x *= 2\nprint(cnt)'] | ['Wrong Answer', 'Accepted'] | ['s563438115', 's399308922'] | [3060.0, 2940.0] | [18.0, 18.0] | [89, 90] |
p03481 | u067983636 | 2,000 | 262,144 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possible length of the sequence. | ['import math\nX, Y = map(int, input().split())\nr = 0\nwhile X < Y:\n Y //= X\n r += 1\nprint(int(math.log2(r)) + 1)', 'import math\nX, Y = map(int, input().split())\nr = 0\nR = Y // X\nwhile R >= 2:\n R //= 2\n r += 1\nprint(r + 1)'] | ['Runtime Error', 'Accepted'] | ['s567173194', 's271693599'] | [2940.0, 3060.0] | [2104.0, 19.0] | [111, 107] |
p03481 | u068142202 | 2,000 | 262,144 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possible length of the sequence. | ['x, y = map(int, input().split())\ncount = 0\nans = []\nx_copy = x\nwhile x_copy < y:\n x_copy = x\n x_copy *= 2 ** count\n ans.append(x_copy)\n count += 1\nprint(len(ans))\n', 'x, y = map(int, input().split())\n\nfor i in range(1, 101):\n if x > y:\n ans = i - 1\n break\n x *= 2\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s815877191', 's742016902'] | [9084.0, 9092.0] | [32.0, 27.0] | [175, 129] |
p03481 | u089230684 | 2,000 | 262,144 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possible length of the sequence. | ['X,Y = map(int,input().split())\nans = 0\nwhile X <= Y:\n\tans += 1\n\tX * = 2\nprint(ans)', 'X,Y = map(int,input())\nans = 0\nwhile X <= Y:\n\tans += 1\n\tX *= 2\nprint(ans)', 'X,Y = map(int,input().split())\nans = 0\nwhile X <= Y:\n\tans += 1\n\tX *= 2\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s290602226', 's437290291', 's028282217'] | [2940.0, 2940.0, 2940.0] | [18.0, 18.0, 18.0] | [82, 73, 81] |
p03481 | u118642796 | 2,000 | 262,144 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possible length of the sequence. | ['X,Y = map(int,input().split())\nans = 0\nwhile True:\n X *= 2\n if X<=Y:\n ans += 1\n else:\n break\nprint(ans)', 'X,Y = map(int,input().split())\nans = 1\nwhile True:\n X *= 2\n if X<=Y:\n ans += 1\n else:\n break\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s653092291', 's222930576'] | [3064.0, 2940.0] | [17.0, 17.0] | [112, 112] |
p03481 | u168416324 | 2,000 | 262,144 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possible length of the sequence. | ['3 20', 'x,y=map(int,input().split())\ni=1\nwhile x*2<=y:\n i+=1\n x*=2\nprint(i)'] | ['Runtime Error', 'Accepted'] | ['s908569564', 's285033151'] | [2940.0, 2940.0] | [17.0, 18.0] | [4, 69] |
p03481 | u205561862 | 2,000 | 262,144 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possible length of the sequence. | ['import math;print((lambda l:math.floor(math.log2(l[1]/l[0])+1e9)+1)(list(map(int,input().split()))))', 'import math;print((lambda l:math.floor(math.log2(l[1]/l[0]))+1+1e-9)(list(map(int,input().split()))))', 'import math;print(int((lambda l:math.floor(1e-5+math.log2(l[1]/l[0]))+1))(list(map(int,input().split()))))\n', 'import math;print(int((lambda l:math.floor(1e-9+math.log2(l[1]/l[0]))+1))(list(map(int,input().split()))))', 'print(((lambda l:len([0 for i in range(0,100) if l[0]*(2**i)<=l[1]]))(list(map(int,input().split())))))'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s283388249', 's355234909', 's427233534', 's651846317', 's750893808'] | [2940.0, 3188.0, 2940.0, 2940.0, 2940.0] | [17.0, 19.0, 18.0, 18.0, 18.0] | [100, 101, 107, 106, 103] |
p03481 | u244423127 | 2,000 | 262,144 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possible length of the sequence. | ['a = list(map(int,input().split()))\nx = a[0]\ny = a[1]\n\nn = a[0]\ncount =1\n\nwhile n <= y:\n n = n * 2\n count += 1\n \nprint(str(count))', 'a = list(map(int,input().split()))\nx = a[0]\ny = a[1]\n\nn = a[0]\ncount = 0\n\nwhile n <= y:\n n = n << 1\n count += 1\n \nprint(str(count))'] | ['Wrong Answer', 'Accepted'] | ['s206503544', 's662946842'] | [3060.0, 3060.0] | [18.0, 17.0] | [132, 134] |
p03481 | u267638701 | 2,000 | 262,144 | As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below: * A consists of integers between X and Y (inclusive). * For each 1\leq i \leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i. Find the maximum possible length of the sequence. | ['# -*- coding: utf-8 -*-\n\nX, Y = map(int, raw_input().split())\ncnt = 0\nnum = X\nwhile num <= Y:\n cnt += 1\n num = num*2\n\nprint(cnt)\n', '# -*- coding: utf-8 -*-\n\nimport math\nX, Y = map(int, raw_input().split())\ncnt = 0\nnum = X\nwhile num <= Y:\n cnt += 1\n num = num*2\n\nprint(cnt)\n', '# -*- coding: utf-8 -*-\n\nX, Y = map(int, input().split())\ncnt = 0\nnum = X\nwhile num <= Y:\n cnt += 1\n num = num*2\n\nprint(cnt)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s467118232', 's997686771', 's616387654'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0] | [135, 147, 131] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.