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
|
---|---|---|---|---|---|---|---|---|---|---|
p03286 | u102960641 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\na = []\nb = 0\nwhile n != 0:\n c = (-2) ** b\n if n % (c*(-2)) != 0:\n n -= c\n a.append("1")\n else:\n a.append("0")\n b += 1\nelse:\n a.append("0")\nans = "".join(reversed(a))\nprint(ans)\n', 'n = int(input())\na = []\nb = 0\nwhile n != 0:\n c = (-2) ** b\n if n % (c*(-2)) != 0:\n n -= c\n a.append("1")\n else:\n a.append("0")\n b += 1\nans = "".join(reversed(a))\nif ans == "":\n ans = 0\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s302794779', 's856545528'] | [3188.0, 3060.0] | [21.0, 18.0] | [230, 230] |
p03286 | u105124953 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n = int(input())\nif n == 0:\n print(0)\n exit()\nflag = True\nans_str = ''\nwhile True:\n if n // (-2) == 0:\n ans_str = '1' + ans_str\n print(int(ans_str))\n exit()\n else:\n ans_str = n%(-2) + ans_str", "n = int(input())\nif n == 0:\n print(0)\n exit()\nflag = True\nans_str = ''\nwhile True:\n if n == 1:\n ans_str = '1' + ans_str\n print(int(ans_str))\n exit()\n if n < 0 and (-n)%2 == 1:\n ans_str = '1' + ans_str\n n = -(n-1)//2\n elif n < 0 and (-n)%2 == 0:\n ans_str = '0' + ans_str\n n = -n//2\n elif n > 0 and n%2 ==1:\n ans_str = '1' + ans_str\n n = -(n//2)\n elif n > 0 and n%2 ==0:\n ans_str = '0' + ans_str\n n = -(n//2)"] | ['Runtime Error', 'Accepted'] | ['s258120473', 's554074644'] | [2940.0, 3064.0] | [19.0, 17.0] | [231, 504] |
p03286 | u106297876 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\nS = ''\nans_l = []\nif N != 0:\n\twhile N != 0:\n\t\tif N % 2 == 0:\n\t\t\tN = N // (-2)\n \t\t\tS = '0' + S\n\t\telse:\n \t\t\tN = (N-1) // (-2)\n \t\t\tS = '1' + S\nelse:\n\tS = '0'\nprint(S)\n", "N = int(input())\nS = ''\nans_l = []\nif N != 0:\n\twhile N != 0:\n\t\tif N % 2 == 0:\n\t\t\tN = N // (-2)\n\t\t\tS = '0' + S\n\t\telse:\n\t\t\tN = (N-1) // (-2)\n\t\t\tS = '1' + S\nelse:\n\tS = '0'\nprint(S)\n\n"] | ['Runtime Error', 'Accepted'] | ['s325041342', 's586645585'] | [3188.0, 3064.0] | [17.0, 17.0] | [184, 179] |
p03286 | u112002050 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['ans = ""\nN = int(input())\n\nwhile N != 0:\n if N % 2 != 0:\n ans = "0" + ans\n N -= 1\n else:\n ans = "1" + ans\n N /= -2\nprint("".join(ans))\n', 'ans = ""\nN = int(input())\n\nwhile N != 0:\n if N % 2 != 0:\n ans = "1" + ans\n N -= 1\n else:\n ans = "0" + ans\n N /= -2\nif ans == "": ans = "0"\nprint("".join(ans))\n'] | ['Wrong Answer', 'Accepted'] | ['s303097809', 's840291578'] | [2940.0, 2940.0] | [17.0, 17.0] | [165, 189] |
p03286 | u121921603 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n=int(input())\nif n==0:print(0)\nbi=''\nwhile n!=0:\n bi+=str(n%abs(k))\n if k<0:n=-(-n//k)\n else:n=n//k\nprint(bi[::-1])\n", "N=int(input())\nif N==0:print(0)\nbi=''\nwhile n!=0:\n bi+=str(n%abs(k))\n if k<0:n=-(-n//k)\n else:n=n//k\nprint(bi[::-1])", "n=int(input())\nif n==0:print(0)\nk=-2\nbi=''\nwhile n!=0:\n bi+=str(n%abs(k))\n if k<0:n=-(-n//k)\n else:n=n//k\nprint(bi[::-1])\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s390054547', 's783368499', 's166336242'] | [2940.0, 3060.0, 2940.0] | [17.0, 17.0, 17.0] | [126, 125, 131] |
p03286 | u125505541 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\nans = ""\nfor i in range(100):\n while n != 0:\n r = (n % 2)\n n = (n - r) // (-2)\n ans = str(r) + ans\nif n==0:\n print("0")\nelse:\n print(ans)', 'n = int(input())\nps = [0] * (1 << 16)\nfor i in range(1 << 16):\n temp = 0\n for j in range(16):\n if (i >> j) & 1:\n temp += (-2) ** (2 *j)\n ps[i] = temp\n\n"""\nfor index, value in enumerate(ps):\n print(bin(index)[2:].zfill(16), value)\n"""\n\npattern1 = None\npattern2 = None\n\nfor i in range(1 << 16):\n temp2 = 0\n for j in range(16):\n if (i >> j) & 1:\n temp2 += (-2) ** (2 *j + 1)\n n2 = n - temp2\n pattern1 = bisect.bisect_left(ps, n2)\n if pattern1 != (1 << 16) and ps[pattern1] == n2:\n pattern2 = bin(i)[2:].zfill(16)\n pattern1 = bin(pattern1)[2:].zfill(16)\n break\n\nans = ""\nfor i in range(16):\n ans += pattern2[i]\n ans += pattern1[i]\n \ntrue_ans = ""\nflag = False\nfor i in range(len(ans)):\n if ans[i]=="1":\n true_ans += "1"\n flag = True\n elif flag:\n true_ans += "0"\n\nif true_ans == "":\n true_ans = "0"\n \nprint(true_ans)', 'n = int(input())\nn2 = n\nans = ""\nfor i in range(100):\n while n != 0:\n r = (n % 2)\n n = (n - r) // (-2)\n ans = str(r) + ans\nif n2==0:\n print("0")\nelse:\n print(ans)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s069306619', 's737694603', 's617304118'] | [3060.0, 5800.0, 3060.0] | [17.0, 372.0, 17.0] | [184, 949, 192] |
p03286 | u131264627 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n = int(input())\nans = ''`\nwhile n != 0:\n if n % (-2) == 0:\n ans = '0' + ans\n else:\n ans = '1' + ans\n n -= 1\n n /= -2\nif ans == '':\n ans = '0'\nprint(ans)", "n = int(input())\nans = ''\nwhile n != 0:\n if n % (-2) == 0:\n ans = '0' + ans\n else:\n ans = '1' + ans\n n -= 1\n n /= -2\nif ans == '':\n ans = '0'\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s676543591', 's773107381'] | [2940.0, 3060.0] | [17.0, 18.0] | [186, 185] |
p03286 | u136395536 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N = int(input())\n\nans = str(bin(N))\n\nstring = ""\n\nif N<0:\n for i in range(3,len(ans)):\n string = string + ans[i]\nelse:\n for i in range(2,len(ans)):\n string = string + ans[i]\n \nprint(string)', 'N = int(input())\n\n\nans = ""\ndivide = 1\n\nif N == 0:\n ans = "0"\nelse:\n while N != 0:\n if N%(divide*2) == 0:\n ans = "0" + ans\n else:\n ans = "1" + ans\n N -= divide\n divide *= -2\n \n\nprint(ans)\n '] | ['Wrong Answer', 'Accepted'] | ['s478336588', 's114742644'] | [3060.0, 2940.0] | [17.0, 17.0] | [212, 255] |
p03286 | u142415823 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["import sys\n\nN = int(input())\n\nk = 0\nS = []\nwhile 1:\n print(k, N)\n if N % 2 == 0:\n S.append(0)\n else:\n N -= (-1) ** k\n S.append(1)\n N /= 2\n k += 1\n if N == 0:\n break\n\nfor i in S[::-1]:\n sys.stdout.write(str(i))\nsys.stdout.write('\\n')\n", "import sys\n\nN = int(input())\n\nk = 0\nS = []\nwhile 1:\n if N % 2 == 0:\n S.append(0)\n else:\n N -= (-1) ** k\n S.append(1)\n N /= 2\n k += 1\n if N == 0:\n break\n\nfor i in S[::-1]:\n sys.stdout.write(str(i))\nsys.stdout.write('\\n')\n"] | ['Wrong Answer', 'Accepted'] | ['s287679759', 's109930748'] | [3060.0, 3060.0] | [17.0, 17.0] | [282, 266] |
p03286 | u162612857 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['import numpy as np\nfrom functools import reduce\n\nn = int(input())\n\nX = 35\ni = np.arange(X, dtype=np.int64)[::-1]\n\n\ni = (-2)**i\nprint(i.dtype)\n\nans = np.zeros(X, dtype=np.int64)\n\nfor digit in range(X):\n\n\ti[digit]\n\tsum_of_opposite = i[digit+1::2].sum() \n\n\tif i[digit] > 0 and i[digit] + sum_of_opposite > n:\n\t\tans[digit] = 0\n\telif i[digit] < 0 and i[digit] + sum_of_opposite < n:\n\t\tans[digit] = 0\n\telse:\n\t\tans[digit] = 1\n\t\tn -= i[digit]\n\n\nprint(int(reduce(lambda x, y: str(x) + str(y), ans)))\n', 'import numpy as np\nfrom functools import reduce\n\nn = int(input())\n\nX = 35\ni = np.arange(X, dtype=np.int64)[::-1]\n\n\ni = (-2)**i\n\nans = np.zeros(X, dtype=np.int64)\n\nfor digit in range(X):\n\n\ti[digit]\n\tsum_of_opposite = i[digit+1::2].sum() \n\n\tif i[digit] > 0 and i[digit] + sum_of_opposite > n:\n\t\tans[digit] = 0\n\telif i[digit] < 0 and i[digit] + sum_of_opposite < n:\n\t\tans[digit] = 0\n\telse:\n\t\tans[digit] = 1\n\t\tn -= i[digit]\n\n\nprint(int(reduce(lambda x, y: str(x) + str(y), ans)))\n'] | ['Wrong Answer', 'Accepted'] | ['s003370774', 's145181021'] | [12492.0, 12512.0] | [151.0, 150.0] | [601, 586] |
p03286 | u166306121 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | [" N = int(input())\n minus_bit = ''\n if N == 0:\n minus_bit = '00'\n while N != 0:\n mod = N % 4\n if mod == 0:\n minus_bit = minus_bit + '00'\n N = N//4\n elif mod == 1:\n minus_bit = minus_bit + '10'\n N = (N-1)//4\n elif mod == 2:\n minus_bit = minus_bit + '01'\n N = (N+2)//4\n else:\n minus_bit = minus_bit + '11'\n N = (N+1)//4\n\n if minus_bit[-1] == '0':\n minus_bit = minus_bit[:-1]\n print(minus_bit[::-1])", "N = int(input())\nminus_bit = ''\nif N == 0:\n minus_bit = '0'\nwhile N != 0:\n mod = N % 4\n if mod == 0:\n minus_bit = minus_bit + '00'\n N = N//4\n print(N)\n elif mod == 1:\n minus_bit = minus_bit + '10'\n N = (N-1)//4\n print(N)\n elif mod == 2:\n minus_bit = minus_bit + '01'\n N = (N+2)//4\n print(N)\n else:\n minus_bit = minus_bit + '11'\n N = (N+1)//4\n print(N)\n\nif minus_bit[-1] == '0':\n minus_bit = minus_bit[:-1]\nprint(minus_bit[::-1])", "N = int(input())\nminus_bit = ''\nif N == 0:\n minus_bit = '00'\nwhile N != 0:\n mod = N % 4\n if mod == 0:\n minus_bit = minus_bit + '00'\n N = N//4\n elif mod == 1:\n minus_bit = minus_bit + '10'\n N = (N-1)//4\n elif mod == 2:\n minus_bit = minus_bit + '01'\n N = (N+2)//4\n else:\n minus_bit = minus_bit + '11'\n N = (N+1)//4\n\nif minus_bit[-1] == '0':\n minus_bit = minus_bit[:-1]\nprint(minus_bit[::-1])"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s388648353', 's545866396', 's068519648'] | [2940.0, 3064.0, 3064.0] | [17.0, 18.0, 18.0] | [508, 533, 466] |
p03286 | u170324846 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['import math\n\ndef dnt(n):\n if n >= 0:\n return (-1) * (n // 2)\n else:\n return math.ceil((-1) * (n / 2))\n\nN = int(input())\nS = ""\n\nwhile N != 1:\n if N % 2 == 1:\n S = "1" + S\n else:\n S = "0" + S\n N = dnt(N)\n print(N)\n\nprint("1"+S)', 'import math\n\ndef dnt(n):\n if n >= 0:\n return (-1) * (n // 2)\n else:\n return math.ceil((-1) * (n / 2))\n\nN = int(input())\nS = ""\n\nif N == 0:\n print(0)\n\nelse:\n while N != 1:\n if N % 2 == 1:\n S = "1" + S\n else:\n S = "0" + S\n N = dnt(N)\n print("1"+S)'] | ['Wrong Answer', 'Accepted'] | ['s407495840', 's661661978'] | [4720.0, 3060.0] | [2104.0, 18.0] | [272, 317] |
p03286 | u175426149 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["import math\n\nN = int(input())\n\ndef calc_power(num):\n if num > 1:\n m = 5\n power = 2\n while True:\n if num <= m:\n return_num = power\n break\n else:\n m = m * 4 + 1\n power += 2 \n elif num == 1:\n return_num = 0\n elif num == 0:\n print('0')\n exit()\n else:\n m = -2\n power = 1\n while True:\n if num >= m:\n return_num = power\n break\n else:\n m = m * 4 - 2\n power += 2\n\n return return_num\n\nnum = N\npre_power = calc_power(N) + 1\nans = ''\nwhile num != 0:\n power = calc_power(num)\n print(num, power)\n num -= (-2) ** power\n if power == pre_power - 1:\n ans += '1'\n else:\n for _ in range(pre_power - 1 - power):\n ans += '0'\n ans += '1'\n pre_power = power\n\nprint(ans)", "import math\n \nN = int(input())\n \ndef calc_power(num):\n if num > 1:\n m = 5\n power = 2\n while True:\n if num <= m:\n return_num = power\n break\n else:\n m = m * 4 + 1\n power += 2 \n elif num == 1:\n return_num = 0\n elif num == 0:\n print('0')\n exit()\n else:\n m = -2\n power = 1\n while True:\n if num >= m:\n return_num = power\n break\n else:\n m = m * 4 - 2\n power += 2\n \n return return_num\n \nnum = N\npre_power = calc_power(N) + 1\nans = ''\nwhile num != 0:\n power = calc_power(num)\n num -= (-2) ** power\n if power == pre_power - 1:\n ans += '1'\n else:\n for _ in range(pre_power - 1 - power):\n ans += '0'\n ans += '1'\n if num == 0:\n for _ in range(power):\n ans += '0'\n pre_power = power\n \nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s682327793', 's220804568'] | [3064.0, 3064.0] | [18.0, 18.0] | [937, 991] |
p03286 | u185034753 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N=int(input())\n\nm = 2\ns = ""\nsgn = 1\nwhile N!=0:\n r = N % m\n s += "1" if r != 0 else "0"\n m *= -2\n N = N -r \nif N == 0:\n print(0)\nelse:\n print(s[::-1])\n', 'N=int(input())\n\nif N == 0:\n print(0)\nelse:\n m = 2\n s = ""\n sgn = 1\n while N!=0:\n r = N % m\n s += "1" if r != 0 else "0"\n m *= -2\n N = N -r \n print(s[::-1])\n\n'] | ['Wrong Answer', 'Accepted'] | ['s175201125', 's924105480'] | [2940.0, 2940.0] | [17.0, 18.0] | [170, 203] |
p03286 | u187205913 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n = int(input())\nans = []\ni=2\nj=0\nk = 0\nwhile True:\n if k==n:\n break\n if (n-k)%i==0:\n ans.append(0)\n else:\n k += i>>1 if j%2==0 else -i>>1\n ans.append(1)\n print(k)\n i = i<<1\n j+=1\nfor i in ans[::-1]:\n print(i,end='')\nprint()", "n = int(input())\nans = []\ni=2\nj=0\nk = 0\nwhile True:\n if k==n:\n break\n if (n-k)%i==0:\n ans.append(0)\n else:\n k += i>>1 if j%2==0 else -i>>1\n ans.append(1)\n i = i<<1\n j+=1\n\nif n==0:\n print(0)\nelse:\n for i in ans[::-1]:\n print(i,end='')\n print()"] | ['Wrong Answer', 'Accepted'] | ['s929122030', 's933974853'] | [3060.0, 3064.0] | [18.0, 18.0] | [273, 301] |
p03286 | u201802797 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['# solution\n\ndata=int(input())\n\na="";k=1\n\nwhile data:\n\tt=k;k*=-2\n\tif n%k:n-=t;a+="1"\n\telse:a+="0"\nprint(a[::-1]or 0)', '# solution\nimport io\nimport math\n\ndata = int(input())\nresult=""\ncounter=1\nif data==0:\n\tresult="0"\nwhile data:\n\tt=counter\n\tcounter*=-2\n\tif data%counter:\n\t\tdata-=t\n\t\tresult+="1"\n\telse:\n\t\tresult+="0"\nprint(result[::-1])'] | ['Runtime Error', 'Accepted'] | ['s290589614', 's437007943'] | [2940.0, 3060.0] | [17.0, 17.0] | [115, 216] |
p03286 | u201856486 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['# coding: utf-8\nimport sys\nimport bisect\n\n\n"""Template"""\n\n\nclass IP:\n \n def __init__(self):\n self.input = sys.stdin.readline\n\n def I(self):\n \n return int(input())\n\n def IL(self):\n \n return list(map(int, self.input().split()))\n\n def SL(self):\n \n return list(map(str, self.input().split()))\n\n def ILS(self, n):\n \n return [int(self.input()) for _ in range(n)]\n\n def SLS(self, n):\n \n return [self.input() for _ in range(n)]\n\n\nclass Idea:\n def __init__(self):\n pass\n\n def HF(self, p):\n \n return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))\n\n def Bfs2(self, a):\n \n \n # https://blog.rossywhite.com/2018/08/06/bit-search/\n \n value = []\n for i in range(1 << len(a)):\n output = []\n\n for j in range(len(a)):\n if ((i >> j) & 1) == 1:\n \n # output.append(a[j])\n output.append(a[j])\n value.append([format(i, \'b\').zfill(16), sum(output)])\n\n value.sort(key=lambda x: x[1])\n bin = [value[k][0] for k in range(len(value))]\n val = [value[k][1] for k in range(len(value))]\n return bin, val\n\n\n\n\n\ndef main():\n \n r, e = range, enumerate\n ip = IP()\n id = Idea()\n\n \n n = ip.I()\n \n list1 = [(-2) ** i for i in r(16)]\n list2 = [(-2) ** (i + 16) for i in r(16)]\n list1_bin, list1_val = id.Bfs2(list1)\n list2_bin, list2_val = id.Bfs2(list2)\n\n \n ans = 0\n for i in r(len(list1_val)):\n j = bisect.bisect_left(list2_val, n - list1_val[i])\n\n if j < len(list2_val) and list1_val[i] + list2_val[j] == n:\n ans = list2_bin[j] + list1_bin[i]\n print(j)\n break\n print(int(ans))\n\n\nmain()', '# coding: utf-8\nimport sys\nimport bisect\n\n\n"""Template"""\n\n\nclass IP:\n \n def __init__(self):\n self.input = sys.stdin.readline\n\n def I(self):\n \n return int(input())\n\n def IL(self):\n \n return list(map(int, self.input().split()))\n\n def SL(self):\n \n return list(map(str, self.input().split()))\n\n def ILS(self, n):\n \n return [int(self.input()) for _ in range(n)]\n\n def SLS(self, n):\n \n return [self.input() for _ in range(n)]\n\n\nclass Idea:\n def __init__(self):\n pass\n\n def HF(self, p):\n \n return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))\n\n def Bfs2(self, a):\n \n \n # https://blog.rossywhite.com/2018/08/06/bit-search/\n \n value = []\n for i in range(1 << len(a)):\n output = []\n\n for j in range(len(a)):\n if ((i >> j) & 1) == 1:\n \n # output.append(a[j])\n output.append(a[j])\n value.append([format(i, \'b\').zfill(16), sum(output)])\n\n value.sort(key=lambda x: x[1])\n bin = [value[k][0] for k in range(len(value))]\n val = [value[k][1] for k in range(len(value))]\n return bin, val\n\n\n\n\n\ndef main():\n \n \n r, e = range, enumerate\n ip = IP()\n id = Idea()\n\n \n\n \n n = ip.I()\n s = \'\'\n while True:\n r = n % (-2)\n n //= -2\n if r < 0:\n r += 2\n n += 1\n s += str(r)\n if n == 0: break\n print(s[::-1])\n\n\nmain()\n'] | ['Wrong Answer', 'Accepted'] | ['s702405162', 's652454700'] | [25408.0, 3316.0] | [643.0, 19.0] | [3292, 2948] |
p03286 | u202570162 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N=int(input())\nans=''\nwhile N:\n ans=str(N%2)+ans\n N//=(-2)\nprint(ans)", "N=int(input())\nans=''\nwhile N:\n ans=str(N%2)+ans\n N=-(N//2)\nprint(ans if ans else 0)"] | ['Wrong Answer', 'Accepted'] | ['s115383345', 's329786968'] | [2940.0, 2940.0] | [17.0, 17.0] | [71, 86] |
p03286 | u214434454 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\ns = []\ndiv = -2\ni = 0\nwhile n!=0:\n r = n % div\n if r == 0:\n s.append(0)\n else:\n s.append(1)\n n -= (-2) ** i\n div *= 2\n i += 1\nans = ""\nfor i in range(len(s)):\n ans = str(s[i]) + ans\nif n != 0:\n print(ans)\nelse:\n print(0)', 'n = int(input())\ns = []\ndiv = -2\ni = 0\nwhile n!=0:\n r = n % div\n if r == 0:\n s.append(0)\n else:\n s.append(1)\n n -= (-2) ** i\n div *= 2\n i += 1\ns = map(str, s)\n\nprint("".join(s))', 'n = int(input())\ns = []\nif n % 2 == 1:\n s.append(1)\nelif n % 2 == 0:\n s.append(0)\na = (-2) ** 0 * s[0]\ndiv = 4\nwhile a != n:\n r = n % div\n r_0 = 0\n for i in range(len(s)):\n r_0 += (-2) ** i * s[i]\n if r_0 % div == r:\n s.append(0)\n else:\n s.append(1)\n div *= 2\n a += (-2) ** (len(s)-1) * s[-1]\n\ns = map(str, s)\n\nprint("".join(s))', 'n = int(input())\ns = []\ndiv = -2\ni = 0\nwhile n!=0:\n r = n % div\n if r == 0:\n s.append(0)\n else:\n s.append(1)\n n -= (-2) ** i\n div *= 2\n i += 1\nans = ""\nfor i in range(len(s)):\n ans = str(s[i]) + ans\nif n != 0\n print(ans)\nelse:\n print(0)', 'n = int(input())\ns = []\ndiv = -2\ni = 0\nwhile n!=0:\n r = n % div\n if r == 0:\n s.append(0)\n else:\n s.append(1)\n n -= (-2) ** i\n div *= 2\n i += 1\nans = ""\nfor i in range(len(s)):\n ans = str(s[i]) + ans\nif ans != "":\n print(ans)\nelse:\n print(0)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s052037097', 's468016543', 's925911847', 's928159061', 's962435769'] | [3064.0, 3064.0, 3064.0, 2940.0, 3064.0] | [17.0, 17.0, 17.0, 18.0, 18.0] | [283, 213, 376, 282, 286] |
p03286 | u215115622 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\nif n == 0:\n\t print ("0")\nout = []\nwhile n != 0:\n\t n, rem = divmod(n, -2)\n\t if rem < 0:\n\t \t n += 1\n\t \t rem -= ^2\n\t out.append(rem)\nprint ("".join(map(str, out[::-1])))', 'n = int(input())\nif n == 0:\n\t print ("0")\nout = []\nwhile n != 0:\n\t n, rem = divmod(n, -2)\n\t if rem < 0:\n\t \t n += 1\n\t \t rem -= -2\n\t out.append(rem)\nprint ("".join(map(str, out[::-1])))\n'] | ['Runtime Error', 'Accepted'] | ['s581100373', 's415019696'] | [3064.0, 2940.0] | [17.0, 17.0] | [183, 184] |
p03286 | u223904637 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n=int(input())\nans=''\ni=1\nk=n\nwhile k>0:\n if n%(2**i)!=0:\n ans='1'+ans\n k-=(-2)**(i-1)\n else:\n ans='0'+ans\n i+=1\nprint(ans)", "n=int(input())\nif n==0:\n print(0)\n exit()\nans=''\ni=1\nk=n\nwhile k!=0:\n if k%(2**i)!=0:\n ans='1'+ans\n k-=(-2)**(i-1)\n else:\n ans='0'+ans\n i+=1\nprint(ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s780831829', 's709453470'] | [3060.0, 3060.0] | [17.0, 17.0] | [153, 188] |
p03286 | u225388820 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n=int(input())\ns=""\nwhile n:\n print(n)\n s=str(n&1)+s\n n=-(n>>1)\n print(s)\nprint(s if s else 0)', 'n=int(input())\ns=""\nwhile n:\n s=str(n&1)+s\n n=-(n>>1)\nprint(s if s else 0)'] | ['Wrong Answer', 'Accepted'] | ['s988618122', 's406371768'] | [2940.0, 2940.0] | [17.0, 17.0] | [106, 80] |
p03286 | u228223940 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\n\n\nans = ""\n\nwhile(n != 0):\n if n % 2 == 0:\n ans = "0" + ans\n else:\n ans = "1" + ans\n n = n // (-2)\n \nprint(ans)', 'n = int(input())\n\n\nans = ""\n\nwhile(n != 0):\n if n % 2 == 0:\n ans = "0" + ans\n else:\n n -= 1\n ans = "1" + ans\n n = n // (-2)\n\nif n == 0:\n ans = 0\n\nprint(ans)', 'n = int(input())\n\nnum = -n\nans = ""\n\n\nif n == 0:\n print(0)\n exit()\n\nwhile num!= 0:\n if num % 2 == 0:\n ans = "0" + ans\n else:\n ans = "1" + ans\n num //= (-2)\n #print(num)\n \nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s553837672', 's792971096', 's818963782'] | [2940.0, 3064.0, 2940.0] | [17.0, 17.0, 17.0] | [154, 189, 224] |
p03286 | u231122239 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n = int(input())\nx=''\nwhile n != 0:\n x = str(n%2) + x\n n = - n//2\nprint(0 if x == '' else x)\n", "n = int(input())\nx=''\nwhile n != 0:\n x = str(n%2) + x\n n = - (n//2)\nprint(0 if x == '' else x)\n"] | ['Wrong Answer', 'Accepted'] | ['s280259963', 's134008438'] | [2940.0, 2940.0] | [17.0, 18.0] | [99, 101] |
p03286 | u235084192 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\n\nif N == 0:\n print(0)\nelif N == 1:\n print(1)\nelse:\n s = 2\n j = 2\n i = 1\n while s + j**2 <= N:\n i += 1\n s += j**2\n j*= 2\n \n k = 2 * i + 1\n print('1' + bin(int('10'*i, 2)^(N-s))[2:])", "N = int(input())\nif N >= 0:\n if N == 0:\n print(0)\n elif N == 1:\n print(1)\n else:\n s = 2\n j = 2\n i = 1\n while s + j**2 <= N:\n i += 1\n s += j**2\n j*= 2\n \n k = 2 * i + 1\n a = bin(int('10'*i, 2)^(N-s))[2:]\n if len(a) < k-1:\n a = '0'*(k-1-len(a)) + a\n print('1' + a)\nelse:\n s = -1\n j = -2\n i = 1\n while N <= s + j:\n s += j\n j *= 4\n i += 1\n k = 2 * i\n print(bin(int('10'*i, 2)^(N-(s+j)-1))[2:])"] | ['Wrong Answer', 'Accepted'] | ['s658248723', 's929349658'] | [3064.0, 3064.0] | [18.0, 17.0] | [215, 458] |
p03286 | u240793404 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nn=int(input())\nl=list(map(int,str(bin(n))[2:]))\nfor i in range(1,len(l)+3): \n if l[-i] == 2: \n l[-i] = 0\n try:\n l[-(i+1)]+=1\n except:\n l.insert(0,1)\n if i%2==0 and l[-i]==1: \n try: \n l[-(i+1)]+=1\n except:\n l.insert(0,1)\ns = ''.join([str(x) for x in l])\nprint(s)", "n=int(input())\nl=list(map(int,str(bin(n))[2:]))\nfor i in range(1,len(l)+3): \n if l[-i] == 2:\n l[-i] = 0\n if i == len(l):\n l.insert(0,1)\n else:\n l[-(i+1)]+=1\n if i%2==0 and l[-i]==1:\n if i == len(l):\n l.insert(0,1)\n else:\n l[-(i+1)]+=1\ns = ''.join([str(x) for x in l])\nprint(s)", "n=int(input())\nl=list(map(int,str(bin(n))[2:]))\nfor i in range(1,len(l)+3): \n if l[-i] == 2:\n l[-i] = 0\n try:\n l[-(i+1)]+=1\n except:\n l.insert(0,1)\n if i%2==0 and l[-i]==1:\n try: \n l[-(i+1)]+=1\n except:\n l.insert(0,1)\ns = ''.join([str(x) for x in l])\nprint(s)", "n=int(input())\nflg = 0\nif n < 0:\n n *= -1\n flg = 1\nl=list(map(int,str(bin(n))[2:]))\nfor i in range(1,len(l)+3): \n try:\n if l[-i] == 2:\n l[-i] = 0\n if i == len(l):\n l.insert(0,1)\n else:\n l[-(i+1)]+=1\n if i%2==flg and l[-i]==1:\n if i == len(l):\n l.insert(0,1)\n else:\n l[-(i+1)]+=1\n except:\n pass\ns = ''.join([str(x) for x in l])\nprint(s)"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s199092092', 's626580561', 's767047991', 's315561061'] | [3064.0, 3064.0, 3064.0, 3064.0] | [19.0, 19.0, 19.0, 18.0] | [448, 361, 344, 483] |
p03286 | u245870380 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N = int(input())\n\nans = ""\n\nif N == 0:\n print(0)\nelse:\n while True:\n if N == 0:\n break\n if N % -2 == 0:\n ans = ans + "0"\n N = N // -2\n else:\n ans = ans + "1"\n N = (N-1) // -2\n print(ans)', 'N = int(input())\n\nans = ""\n\nif N == 0:\n print(0)\nelse:\n while True:\n if N == 0:\n break\n if N % -2 == 0:\n print(N // -2)\n print(N // 2)\n ans = ans + "0"\n N = N // -2\n else:\n ans = ans + "1"\n N = (N-1) // -2\n print(ans)', 'N = int(input())\n\nans = ""\n\nif N == 0:\n print(0)\nelse:\n while True:\n if N == 0:\n break\n if N % -2 == 0:\n ans = ans + "0"\n N = N // -2\n else:\n ans = ans + "1"\n N = (N-1) // -2\n print(ans[::-1])'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s233478096', 's686772489', 's682006936'] | [2940.0, 3064.0, 2940.0] | [17.0, 18.0, 18.0] | [271, 324, 277] |
p03286 | u250583425 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['import sys\ndef input(): return sys.stdin.readline().rstrip()\n\ndef main():\n N = int(input())\n\n ans = []\n while N != 0:\n r = N % 2\n if r < 0:\n r += 2\n ans.append(r)\n N -= r\n N //= -2\n print("".join(map(str, ans)))\n\nif __name__ == \'__main__\':\n main()\n', 'import sys\ndef input(): return sys.stdin.readline().rstrip()\n\ndef main():\n N = int(input())\n\n if N == 0:\n print(0)\n exit()\n\n ans = []\n while N != 0:\n r = N % 2\n if r < 0:\n r += 2\n ans.append(r)\n N -= r\n N //= -2\n print("".join(map(str, ans[::-1])))\n\nif __name__ == \'__main__\':\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s809694371', 's941001307'] | [2940.0, 3060.0] | [19.0, 17.0] | [309, 363] |
p03286 | u251515715 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['import sys\nn = int(input())\ns=[]\ni=0\nif n==0:\n print(0)\n sys.exit()\nwhile n > 0:\n if n%(2**(i+1))!=0:\n a=1\n else:\n a=0\n s.append(a)\n n=n-a*(-2)**i\n i+=1\n\ns.reverse()\nm=""\nfor ss in s:\n m+=str(ss)\nprint(m)', 'import sys\nn = int(input())\ns=[]\ni=0\nif n==0:\n print(0)\n sys.exit()\nwhile n != 0:\n if n%(2**(i+1))!=0:\n a=1\n else:\n a=0\n s.append(a)\n n=n-a*(-2)**i\n i+=1\n\ns.reverse()\nm=""\nfor ss in s:\n m+=str(ss)\nprint(m)'] | ['Wrong Answer', 'Accepted'] | ['s938561944', 's634101122'] | [3064.0, 3060.0] | [17.0, 17.0] | [218, 219] |
p03286 | u254871849 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["import sys\n\nn = int(sys.stdin.readline().rstrip())\n\ndef base_convert(n, b):\n res = ''\n while n:\n r = abs(n % b)\n res = str(r) + res\n n = (n - r) // b\n\n return int(res) if res else 0\n\ndef main():\n return base_convert(n, 3)\n\nif __name__ == '__main__':\n ans = main()\n print(ans)", "import sys\n\ndef base_convert(n, b):\n if not n: return 0\n res = ''\n while n:\n n, r = divmod(n, b)\n if r < 0: n += 1; r -= b\n res += str(r)\n return int(res[::-1])\n\nn = int(sys.stdin.readline().rstrip())\n\ndef main():\n print(base_convert(n, -2))\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s646833530', 's748199532'] | [3684.0, 3060.0] | [2104.0, 18.0] | [314, 297] |
p03286 | u255280439 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['import sys\nimport math\nimport collections\nimport itertools\nimport array\nimport inspect\n\n\nsys.setrecursionlimit(10000)\n\n\n# Debug output\ndef chkprint(*args):\n names = {\n id(v): k\n for k, v in inspect.currentframe().f_back.f_locals.items()\n }\n print(\', \'.join(\n names.get(id(arg), \'???\') + \' = \' + repr(arg) for arg in args))\n\n\n# Binary converter\ndef to_bin(x):\n return bin(x)[2:]\n\n\ndef li_input():\n return [int(_) for _ in input().split()]\n\n\n# --------------------------------------------\n\ndp = None\nc = []\n\n\ndef f(B):\n ans = 0\n for idx in range(len(B)):\n if B[len(B) - idx - 1] == "1":\n ans += ((-2)**idx)\n\n return ans\n\n\ndef is_lower(idx, c_value, N):\n add_value = 0\n for i in range(idx, -1, -1):\n if c[i] > 0:\n add_value += c[i]\n\n return c_value + add_value < N\n\n\n\n\ndef is_over(idx, c_value, N):\n sub_value = 0\n for i in range(idx, -1, -1):\n if c[i] < 0:\n sub_value += c[i]\n\n return c_value + sub_value > N\n\n\ndef main():\n N = int(input())\n c_value = None\n\n if N == 0:\n print(0)\n return\n\n for i in range(50):\n c.append((-2)**i)\n\n if N > 0:\n tmpsum = 0\n for i in range(50):\n if c[i] > 0:\n tmpsum += c[i]\n\n if tmpsum >= N:\n idx = i\n c_value = c[i]\n break\n\n ans = "1"\n\n for c_idx in range(idx - 1, -1, -1):\n if c[c_idx] < 0:\n if is_over(c_idx - 2, c_value, N):\n ans += "1"\n c_value += c[c_idx]\n else:\n ans += "0"\n else:\n if is_lower(c_idx - 2, c_value, N):\n ans += "1"\n c_value += c[c_idx]\n else:\n ans += "0"\n\n else:\n tmpsub = 0\n for i in range(50):\n if c[i] < 0:\n tmpsub += c[i]\n\n if tmpsub <= N:\n idx = i\n c_value = c[i]\n break\n\n ans = "1"\n\n for c_idx in range(idx - 1, -1, -1):\n if c[c_idx] < 0:\n if is_over(c_idx - 2, c_value, N):\n ans += "1"\n c_value += c[c_idx]\n else:\n ans += "0"\n else:\n if is_lower(c_idx - 2, c_value, N):\n ans += "1"\n c_value += c[c_idx]\n else:\n ans += "0"\n\n print(ans)\n print(f(ans))\n\n\nmain()\n', 'import sys\nimport math\nimport collections\nimport itertools\nimport array\nimport inspect\n\n\nsys.setrecursionlimit(10000)\n\n\n# Debug output\ndef chkprint(*args):\n names = {\n id(v): k\n for k, v in inspect.currentframe().f_back.f_locals.items()\n }\n print(\', \'.join(\n names.get(id(arg), \'???\') + \' = \' + repr(arg) for arg in args))\n\n\n# Binary converter\ndef to_bin(x):\n return bin(x)[2:]\n\n\ndef li_input():\n return [int(_) for _ in input().split()]\n\n\n# --------------------------------------------\n\ndp = None\nc = []\n\n\ndef f(B):\n ans = 0\n for idx in range(len(B)):\n if B[len(B) - idx - 1] == "1":\n ans += ((-2)**idx)\n\n return ans\n\n\ndef is_lower(idx, c_value, N):\n add_value = 0\n for i in range(idx, -1, -1):\n if c[i] > 0:\n add_value += c[i]\n\n return c_value + add_value < N\n\n\n\n\ndef is_over(idx, c_value, N):\n sub_value = 0\n for i in range(idx, -1, -1):\n if c[i] < 0:\n sub_value += c[i]\n\n return c_value + sub_value > N\n\n\ndef main():\n N = int(input())\n c_value = None\n\n if N == 0:\n print(0)\n return\n\n for i in range(50):\n c.append((-2)**i)\n\n if N > 0:\n tmpsum = 0\n for i in range(50):\n if c[i] > 0:\n tmpsum += c[i]\n\n if tmpsum >= N:\n idx = i\n c_value = c[i]\n break\n\n ans = "1"\n\n for c_idx in range(idx - 1, -1, -1):\n if c[c_idx] < 0:\n if is_over(c_idx - 2, c_value, N):\n ans += "1"\n c_value += c[c_idx]\n else:\n ans += "0"\n else:\n if is_lower(c_idx - 2, c_value, N):\n ans += "1"\n c_value += c[c_idx]\n else:\n ans += "0"\n\n else:\n tmpsub = 0\n for i in range(50):\n if c[i] < 0:\n tmpsub += c[i]\n\n if tmpsub <= N:\n idx = i\n c_value = c[i]\n break\n\n ans = "1"\n\n for c_idx in range(idx - 1, -1, -1):\n if c[c_idx] < 0:\n if is_over(c_idx - 2, c_value, N):\n ans += "1"\n c_value += c[c_idx]\n else:\n ans += "0"\n else:\n if is_lower(c_idx - 2, c_value, N):\n ans += "1"\n c_value += c[c_idx]\n else:\n ans += "0"\n\n print(ans)\n\n\nmain()\n'] | ['Wrong Answer', 'Accepted'] | ['s308862655', 's812803793'] | [5052.0, 5052.0] | [263.0, 258.0] | [2730, 2712] |
p03286 | u256464928 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n=int(input())\nx=""\nwhile n!=0:\n x=str(n%2)+x\n n=-(n//2)\n print(x,n)\nprint(0 if x=="" else x)', 'n=int(input())\nx=""\nwhile n!=0:\n x=str(n%2)+x\n n=-(n//2)\nprint(0 if x=="" else x)\n'] | ['Wrong Answer', 'Accepted'] | ['s520189091', 's642758653'] | [3060.0, 2940.0] | [18.0, 18.0] | [102, 88] |
p03286 | u263654061 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N = int(input())\nts = fetch_Hosu(N)\n\nle = len(ts)\nnuml = [0]* 15\n\nfor i in range(15):\n tmp = int(ts[2*i+1:2*i+3])\n \n if tmp ==1:\n numl[i] += 11\n elif tmp ==11:\n if i>1:\n numl[i-1] += 11\n numl[i] += 1\n else:\n numl[i] += tmp\n \n# print(numl)\n\n# print(numl)\n\nfor j in range(len(numl)):\n if numl[14-j]==21:\n numl[13-j] += 11\n numl[14-j] = 1\n\n if numl[14-j]==12:\n numl[14-j] = 0\n \n if numl[14-j]==22:\n numl[14-j] = 10\n \n# print(numl)\noutttt = ["{0:02d}".format(i) for i in numl]\n# print(outttt)\nttt=""\nfor k in range(len(outttt)):\n ttt += outttt[k]\n\nttt += ts[-1]\n\nif int(ttt)==0:\n print(0)\nelse:\n tetee = str(ttt)\n tpl = tetee[2:].find("1")\n print(tetee[tpl+2:])', 'N = int(input())\nts = fetch_Hosu(N)\n\nle = len(ts)\nnuml = [0]* 15\n\nfor i in range(15):\n tmp = int(ts[2*i+1:2*i+3])\n \n if tmp ==1:\n numl[i] += 11\n elif tmp ==11:\n if i>1:\n numl[i-1] += 11\n numl[i] += 1\n else:\n numl[i] += tmp\n \n# print(numl)\n\n# print(numl)\n\nfor j in range(len(numl)):\n if numl[14-j]==21:\n numl[13-j] += 11\n numl[14-j] = 1\n\n if numl[14-j]==12:\n numl[14-j] = 0\n \n if numl[14-j]==22:\n numl[14-j] = 10\n \n# print(numl)\noutttt = ["{0:02d}".format(i) for i in numl]\n# print(outttt)\nttt=""\nfor k in range(len(outttt)):\n ttt += outttt[k]\n\nttt += ts[-1]\n\n# print(ttt)\ntetee = str(ttt)\ntpl = tetee[2:].find("1")\nprint(tetee[tpl+2:])', 'N=int(input())\n\nlr = ""\ni=1\n\nif N==0:\n print(0)\n\nelse: \n while N!=0:\n if N%(2**i)!=0:\n lr = "1" + lr\n N = N - (-2)**(i-1)\n else:\n lr = "0" + lr\n\n i+=1\n\n print(lr)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s069035308', 's079663383', 's660482009'] | [3064.0, 3064.0, 3060.0] | [17.0, 17.0, 17.0] | [784, 750, 228] |
p03286 | u263830634 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\n\nS = str()\ncount = 1\nmemo = 0\nwhile a:\n amari = N%(2 ** count)\n# print ('amari', amari)\n if (amari- memo) == 2 ** (count-1):\n s = 1\n else:\n s = 0\n memo = memo + s * (-2) **(count-1)\n# print ('momo', memo)\n S = str(s) + S\n count += 1\n if memo == N:\n print (S)\n a = not a\n", "N = int(input())\nans = []\n\nif N == 0:\n print (0)\n exit()\n\nnum = 1\nwhile N:\n if N % (num * (-2)):\n ans.append(1)\n N -= num\n else:\n ans.append(0)\n num *= -2\n\nprint (*ans[::-1], sep = '')\n"] | ['Runtime Error', 'Accepted'] | ['s477805662', 's423098681'] | [3060.0, 3060.0] | [17.0, 18.0] | [342, 221] |
p03286 | u268792407 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n=int(input())\ns=""\nwhile n>0:\n if n % 2 == 1:\n s = "1" + s\n n = (n-1)//2*(-1)\n else:\n s="0"+s\n n=n//2*(-1)\nprint(s)', 'n=int(input())\nif n==0:\n print(0)\n exit()\ns=""\nwhile n!=0:\n if n % 2 == 1:\n s = "1" + s\n n = (n-1)//2*(-1)\n else:\n s="0"+s\n n=n//2*(-1)\nprint(s)'] | ['Wrong Answer', 'Accepted'] | ['s629058816', 's974496385'] | [2940.0, 2940.0] | [17.0, 17.0] | [130, 160] |
p03286 | u272557899 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\nli = []\nres = n % (-2)\nans = n // (-2)\nli.append(res)\np = 0\nwhile p == 0:\n res = ans % (-2)\n ans = ans // (-2)\n li.append(res)\n if ans == 0 or ans == 1:\n p = 1\n if ans == 1:\n li.append(ans)\nli = [str(n) for n in li]\npr = ""\nfor i in range(len(li)):\n pr += li[-1-i]\nprint(pr)', 'n = int(input())\nli = []\nres = n % (-2)\nans = n // (-2)\nans1 = n\nif res != 0:\n res = ans1 - (-2) * (ans + 1)\n ans = ans + 1\nans1 = ans\nli.append(res)\np = 0\nif ans == 0 or ans == 1:\n p = 1\n if ans == 1:\n li.append(ans)\nwhile p == 0:\n res = ans % (-2)\n ans = ans // (-2)\n if res != 0:\n res = ans1 - (-2) * (ans + 1)\n ans = ans + 1\n ans1 = ans\n li.append(res)\n if ans == 0 or ans == 1:\n p = 1\n if ans == 1:\n li.append(ans)\nli = [str(n) for n in li]\npr = ""\nfor i in range(len(li)):\n pr += li[-1-i]\nprint(pr)'] | ['Wrong Answer', 'Accepted'] | ['s609123211', 's716253983'] | [3064.0, 3064.0] | [19.0, 18.0] | [307, 549] |
p03286 | u278670845 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['from math import *\na = int(input())\n\n# imax =\nflag1 = a%2!=0\nflag2 = a <=0\n\nif flag1:\n a -=1\n\ndef Base_10_to_n(X, n):\n print(int(X/n))\n if (int(X/n)):\n return Base_10_to_n(int(X/n), n)+str(abs(X%n))\n return str(abs(X%n))\n\nx2 = Base_10_to_n(a, -2)\n\nif flag1:\n print(x2[:-1]+"1")\nelse:\n print(x2)', "n = int(input())\n\ns = ''\nwhile n!=0:\n x = abs(n%2)\n n = (n - x)//(-2)\n s = str(x) + s\n\nif s=='':\n print(0)\nelse:\n print(s)"] | ['Wrong Answer', 'Accepted'] | ['s684326572', 's874017842'] | [3188.0, 3060.0] | [19.0, 17.0] | [319, 127] |
p03286 | u278868910 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\n\nif N == 0:\n print (0)\n exit(0)\n\nflag = N < 0\nN = N + 1\nans = ''\nfor i in range(100,0,-1):\n if N == 0:\n break;\n if (flag and i % 2 == 0) or (not(flag) and i%2 == 1):\n ans = ans + '0'\n continue\n x = (-2) ** i\n if abs(N) >= abs(x):\n N = N - x\n ans = ans + '1'\n else:\n ans = ans + '0'\n \n\n\nprint (ans)\n", "N = int(input())\n\nans = ''\nN = N * (-1)\nwhile N :\n m = abs(N%2)\n ans = ans + str(m)\n N = (N // (-2))\n \n\nif len(ans) == 0:\n ans = '0'\n \nans = ans[::-1]\nprint (ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s466211166', 's937534489'] | [3064.0, 3316.0] | [17.0, 21.0] | [381, 181] |
p03286 | u280978334 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['from math import log2\n\ndef main():\n N = int(input())\n if N == 0:\n print(0)\n return\n Ans = []\n while N != 1:\n r = N%2\n Ans.append(r)\n N = -1*( N // 2)\n print(*Ans[::-1],sep="")\n return\n\nif __name__ == "__main__":\n main()', 'from math import log2\n\ndef main():\n N = int(input())\n if N <= 0:\n print(0)\n return\n K = int(log2(abs(N))) + 1\n Ans = []\n for _ in range(K):\n r = N%2\n Ans.append(r)\n N = -1*( N // 2)\n print(*Ans[::-1],sep="")\n return\n\nif __name__ == "__main__":\n main()', 'from math import log2\n\ndef main():\n N = int(input())\n if N == 0:\n print(0)\n return\n Ans = []\n while N != 0:\n r = N%2\n Ans.append(r)\n N = -1*( N // 2)\n print(*Ans[::-1],sep="")\n return\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s407133196', 's595968163', 's499593740'] | [3060.0, 3188.0, 3060.0] | [17.0, 19.0, 17.0] | [276, 310, 276] |
p03286 | u281303342 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N = int(input())\n\nprint(N%(-2),N//(-2))\n\nAns = ""\nwhile N!=0:\n Ans = str(N%2) +Ans\n N = (N - N%2)//2\n N *= -1\n\nprint(Ans)', 'N = int(input())\n\nAns = 0\nwhile N!=0:\n Ans = str(N%2) +Ans\n N = (N - N%2)//2\n N *= -1\n\nprint(Ans)', 'N = int(input())\n\nAns = ""\nwhile N!=0:\n Ans = str(N%2) +Ans\n N = (N - N%2)//2\n N *= -1\n\nprint(Ans if Ans!="" else 0)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s461242950', 's757390627', 's483255964'] | [3060.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [130, 106, 125] |
p03286 | u282228874 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\nif n == 0:\n\tprint(0)\n\texit()\nres = ""\nwhile True:\n\tif n == 0:\n\t\tbreak\n\telse:\n\t\tif n%2 == 0:\n\t\t\tres += \'0\'\n\t\telse:\n\t\t\tres += \'1\'\n\t\t\tn -= 1\n\t\tn //= -2\n\t\tprint(n)\nprint(res[::-1])', 'N = int(input())\nif N == 0:\n print(0)\n exit()\nres = ""\nwhile N != 1:\n res += str(abs(N%(-2)))\n if N%2 == 0:\n N //= -2\n else:\n N //= -2\n N += 1\nres += \'1\'\nprint(res[::-1])'] | ['Wrong Answer', 'Accepted'] | ['s769934534', 's334781364'] | [2940.0, 3060.0] | [20.0, 17.0] | [193, 206] |
p03286 | u285443936 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N = int(input())\n\nans = []\n\nwhile N != 0:\n if N < 0:\n N = abs(N)+2\n b = N % 2\n N = N // (-2)\n ans.append(b)\n #print(N,b,ans)\n\nans = map(str, ans)\nans_str = "".join(ans)\nprint(ans_str[::-1])', 'N = int(input())\ni = 0\nans = []\nif N == 0:\n print(0)\n exit()\nwhile N:\n if N%(2)**(i+1) > 0:\n ans.append(1)\n N -= (-2)**i\n else:\n ans.append(0)\n i += 1\nans.reverse()\nprint("".join(map(str,ans)))'] | ['Wrong Answer', 'Accepted'] | ['s203791464', 's650416022'] | [46232.0, 3064.0] | [2106.0, 17.0] | [197, 207] |
p03286 | u314050667 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N=int(input())\nans=[]\nt=N\nwhile t > 0:\n if t%(-2)==0:\n ans.append('0')\n t //= -2\n else:\n ans.appappend('1')\n t=(t-1)//(-2)\n \nprint(''.join(reversed(ans)))\n ", "N=int(input())\nans=[]\nt=N\nwhile t != 0:\n if t%(-2)==0:\n ans.append('0')\n t //= -2\n else:\n ans.append('1')\n t=(t-1)//(-2)\n \nans = rereversed(ans)\nprint(''.join(ans))\n ", 'N = int(input())\n\nL = [[0,1]]\ni = 1\nwhile True:\n\td = (-2) ** i\n\tif d < 0:\n\t\tL.append([L[-1][0]+d,L[-1][1]])\n\telse:\n\t\tL.append([L[-1][0],L[-1][1]+d])\n\n\ta,b = L[-1]\n\tif a <= N <= b:\n\t\tbreak\n\n\ti += 1\n\t\t\nans = []\ntmp = N\nfor i in reversed(range(len(L))):\n\tif i == 0:\n\t\tif tmp == 1:\n\t\t\tans.append("1")\n\t\telse:\n\t\t\tans.append("0")\n\t\tbreak\n\n\tadd = (-2) ** i\n\ta,b = L[i]\n\tc,d = L[i-1]\n\tif a == c:\n\t\tif d < tmp <= b:\n\t\t\tans.append("1")\n\t\t\ttmp -= add\n\t\t\tcontinue\n\telif b == d:\n\t\tif a <= tmp < c:\n\t\t\tans.append("1")\n\t\t\ttmp -= add\n\t\t\tcontinue\n\n\tans.append("0")\n\nif ans[0] == "0":\n\tans.pop(0)\n\nprint("".join(ans))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s705016533', 's996609401', 's140697134'] | [2940.0, 2940.0, 3064.0] | [17.0, 17.0, 17.0] | [204, 214, 599] |
p03286 | u316464887 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["from itertools import product\ndef main():\n N = int(input())\n if N == 0:\n return 0\n l = set()\n while N != 0:\n if N > 0:\n r = plus(N)\n l.add(r)\n N -= pow(2, r)\n else:\n r = minus(N)\n l.add(r)\n N += pow(2, r)\n s = [0] * (max(l)+1)\n for i in range(max(l)+1):\n if i in l:\n print(i)\n s[i] = 1\n s.reverse()\n return ''.join(str(i) for i in s)\n\ndef plus(N):\n p = 0\n n = 0\n while True:\n p += pow(2, n)\n if p >= N:\n break\n n += 2\n return n\ndef minus(N):\n p = 0\n n = 1\n while True:\n p -= pow(2, n)\n if p <= N:\n break\n n += 2\n return n\n\nprint(main())\n", "def main():\n N = int(input())\n if N == 0:\n return 0\n l = set()\n while N != 0:\n if N > 0:\n r = plus(N)\n l.add(r)\n N -= pow(2, r)\n else:\n r = minus(N)\n l.add(r)\n N += pow(2, r)\n s = [0] * (max(l)+1)\n for i in range(max(l)+1):\n if i in l:\n s[i] = 1\n s.reverse()\n return ''.join(str(i) for i in s)\ndef plus(N):\n p = 0\n n = 0\n while True:\n p += pow(2, n)\n if p >= N:\n break\n n += 2\n return n\ndef minus(N):\n p = 0\n n = 1\n while True:\n p -= pow(2, n)\n if p <= N:\n break\n n += 2\n return n\n\nprint(main())\n"] | ['Wrong Answer', 'Accepted'] | ['s495114783', 's798030994'] | [3064.0, 3064.0] | [18.0, 19.0] | [765, 713] |
p03286 | u318127926 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n = int(input())\ni = 1\ns = []\nwhile n!=0:\n if n%2**i>0:\n s.append('1')\n n -= (-2)**(i-1)\n else:\n s.append('0')\n i += 1\nif n==0:\n print('0')\nelse:\n print(''.join(s[::-1]))", "n = int(input())\nans = []\nfor i in range(100):\n if n%(2**(i+1))>0:\n ans.append('1')\n n -= (-2)**i\n else:\n ans.append('0')\n if n==0:\n break\nprint(''.join(ans[::-1]))"] | ['Wrong Answer', 'Accepted'] | ['s682931462', 's263638076'] | [3060.0, 3060.0] | [17.0, 17.0] | [206, 201] |
p03286 | u327465093 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N = int(input())\n\ns = ""\nwhile abs(N) > 0:\n m = N % (-2)\n if m != 0:\n s = "1" + s\n else:\n s = "0" + s\n N = (N+m) // (-2)\n print(m, N)\nprint(s)\n', 'N = int(input())\n\nif N == 0:\n print(0)\nelse:\n s = ""\n while abs(N) > 0:\n m = N % (-2)\n if m != 0:\n s = "1" + s\n else:\n s = "0" + s\n N = (N+m) // (-2)\n print(s)\n'] | ['Wrong Answer', 'Accepted'] | ['s221475067', 's213488025'] | [3060.0, 2940.0] | [19.0, 17.0] | [172, 222] |
p03286 | u332906195 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\n\nif N == 0:\n print('0')\nelse:\n ans, d = '', 2\n while abs(N) > 0:\n ans = '0' + ans if N % d == 0 else '1' + ans\n N, d = N - N % d, d * (-2)\n\n print(ans)\n", "N = int(input())\n\nn, ans, d = N, '', 2\nwhile abs(n) > 0:\n ans = '0' + ans if n % d == 0 else '1' + ans\n n, d = n - n % d, d * (-2)\nprint('0' if N == 0 else ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s334743496', 's412258852'] | [2940.0, 2940.0] | [17.0, 17.0] | [199, 167] |
p03286 | u342563578 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N,K = map(int,input().split())\nAlist = list(map(int, input().strip().split()))\np = 1\nfor i in range(len(Alist)-1):\n if Alist[i]*Alist[i+1] <= 0:\n q = i\n p = p*(-1)\nlength = 10**10\nans2 = 10**10\nif p == 1:\n if Alist[0] > 0:\n ans = Alist[K-1]\n if Alist[0] < 0:\n ans = -Alist[0]\nif p == -1:\n for i in range(len(Alist)):\n if i + K - 1 < len(Alist):\n if i + K - 1 == q:\n length = min(abs(Alist[i]),length)\n elif i == q + 1:\n length = min((Alist[i+K-1]),length)\n else:\n length = min(min(abs(Alist[i+K-1]-Alist[i])+abs(Alist[i]),abs(Alist[i+K-1]-Alist[i]),abs(Alist[i+K-1])),length)\n ans = length\nfor i in range(len(Alist)):\n ans2 = min(ans2,abs(Alist[i]))\nif K == 1:\n print(ans2)\nelse:\n if len(Alist) > 1:\n print(ans)\n if len(Alist) ==1:\n print(Alist[0])', "N = int(input())\np = []\nif N > 0:\n for i in range(500):\n if (2**(2*i)-1)/3 < N <= (2**(2*(i+1))-1)/3:\n q = 2*i + 1\nif N < 0:\n for i in range(1,500):\n if -(2**(2*i+1)-2)/3 <= N < -(2**(2*i-1)-2)/3:\n q = 2*i\nif N == 0:\n q = 1\ndef cal(n,i):\n if i % 2 != 0:\n if (2**(i-1)-1)/3 < n <= (2**(i+1)-1)/3:\n p.append(1)\n n = n - (-2)**(i-1)\n i = i-1\n if i > 0:\n cal(n,i)\n else:\n p.append(0)\n i = i-1\n if i > 0:\n cal(n,i)\n elif n == 0:\n p.append(0)\n i = i-1\n if i > 0:\n cal(n,i)\n else:\n if -(2**(i+1)-2)/3 <= n < -(2**(i-1)-2)/3:\n p.append(1)\n n = n - (-2)**(i-1)\n i = i-1\n if i > 0:\n cal(n,i)\n else:\n p.append(0)\n i = i-1\n if i > 0:\n cal(n,i)\n \n return p\nans = cal(N,q)\nfor i in range(len(ans)):\n ans[i] = str(ans[i])\nprint(''.join(ans))"] | ['Runtime Error', 'Accepted'] | ['s032817890', 's505151528'] | [3064.0, 3064.0] | [18.0, 19.0] | [902, 1071] |
p03286 | u344813796 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n=int(input())\nans=""\nwhile n!=0:\n if (n%2)!=0:\n n-=1\n ans="1"+ans\n else:\n ans="1"+ans\n n/=-2\nif ans=="":\n ans="0"\nprint(ans)', 'n=int(input())\nans=""\nwhile n!=0:\n if (n%2)!=0:\n n-=1\n ans="1"+ans\n else:\n ans="0"+ans\n n/=-2\nif ans=="":\n ans="0"\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s142703942', 's693534505'] | [2940.0, 3064.0] | [19.0, 17.0] | [138, 138] |
p03286 | u347640436 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["import sys\nn = int(input())\nif n == 0:\n print('0')\n sys.exit()\nt = []\nwhile n != 0:\n r = n % 2\n t.append(str(r))\n n = (n - r) // -2\nprint(t[::-1])\n", "import sys\nn = int(input())\nif n == 0:\n print('0')\n sys.exit()\nt = []\nwhile n != 0:\n r = n % 2\n t.append(str(r))\n n = (n - r) // -2\nprint(''.join(t[::-1]))\n"] | ['Wrong Answer', 'Accepted'] | ['s637615550', 's256197292'] | [2940.0, 2940.0] | [17.0, 18.0] | [152, 161] |
p03286 | u359474860 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['import math\nn = int(input())\nx = []\n\nif n == 0:\n print(0)\nelse:\n if n > 0:\n a = math.ceil(math.log2(n * 3 + 1) / 2) \n b = 2 * a - 1\n print(b)\n x = [[]] * (b)\n print(x)\n else:\n a = math.ceil(math.log2((-3 * n + 2) / 2) / 2)\n b = 2 * a\n x = [[]] * (b)\n print(x)\n while n != 0:\n if n > 0:\n a = math.ceil(math.log2(n * 3 + 1) / 2) \n b = 2 * a - 1 \n n = n - (2) ** (b-1)\n print(n)\n print(b-1)\n x[-b] = "1" \n else:\n a = math.ceil(math.log2((-3 * n + 2) / 2) / 2)\n b = 2 * a\n n = n - (-2) ** (b-1)\n print(n)\n print(b-1)\n x[-b] = "1"\nprint(x)\nx_replace = ["0" if i != "1" else i for i in x]\nx_replace = "".join(x_replace)\nprint(x_replace)', 'import math\nn = int(input())\nx = []\n\nif n == 0:\n print(0)\nelse:\n if n > 0:\n a = math.ceil(math.log2(n * 3 + 1) / 2) \n b = 2 * a - 1\n x = [[]] * (b)\n else:\n a = math.ceil(math.log2((-3 * n + 2) / 2) / 2)\n b = 2 * a\n x = [[]] * (b)\n while n != 0:\n if n > 0:\n a = math.ceil(math.log2(n * 3 + 1) / 2) \n b = 2 * a - 1 \n n = n - (2) ** (b-1)\n x[-b] = "1" \n else:\n a = math.ceil(math.log2((-3 * n + 2) / 2) / 2)\n b = 2 * a\n n = n - (-2) ** (b-1)\n x[-b] = "1"\nx_replace = ["0" if i != "1" else i for i in x]\nx_replace = "".join(x_replace)\nprint(x_replace)'] | ['Wrong Answer', 'Accepted'] | ['s721399705', 's816547353'] | [3064.0, 3064.0] | [18.0, 19.0] | [852, 704] |
p03286 | u359747364 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['a = int(input())\nif a == 0:\n print("0")\nelse:\n digits = []*10\n base = 1\n i = 0\n while a != 0:\n if a%(base*2) == 0:\n digits.append(\'0\')\n else:\n digits.append(\'1\')\n a -= base\n i += 0\n base *= -2\n print(\'\'.join(digits))\n', 'a = int(input())\nif a == 0:\n print("0")\nelse:\n digits = []*10\n base = 1\n i = 0\n while a != 0:\n if a%(base*2) == 0:\n digits.append(\'0\')\n else:\n digits.append(\'1\')\n a -= base\n i += 0\n base *= -2\n print(\'\'.join(digits[::-1]))'] | ['Wrong Answer', 'Accepted'] | ['s447840756', 's017544790'] | [2940.0, 3060.0] | [17.0, 17.0] | [296, 301] |
p03286 | u360515075 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N = int(input())\n\nB = ""\ni = 0\nwhile N != 0:\n B = str(abs(N % (-2))) + B\n if i % 2 == 0:\n N = (N + (N % (-2))) // 2\n else:\n N = (N - (N % (-2))) // 2\n i += 1\nelse:\n print (0)\nprint (B)\n', 'N = int(input())\n\nB = ""\ni = 0\nif N == 0:\n print (0)\nelse:\n while N != 0:\n B = str(abs(N % (-2))) + B\n if i % 2 == 0:\n N = (N + (N % (-2))) // 2\n else:\n N = (N - (N % (-2))) // 2\n i += 1\n print (B)\n'] | ['Wrong Answer', 'Accepted'] | ['s190330070', 's973032825'] | [3060.0, 3064.0] | [17.0, 17.0] | [196, 223] |
p03286 | u364862909 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['import itertools\nN = int(input())\n\nif N == 0:\n print(0)\n exit()\nans = []\nwhile N !=0:\n ans.append(N%2)\n N = -(N-N%2)//2\nprint("".join(list(map(str,ans))))', 'import itertools\nN = int(input())\n\nif N == 0:\n print(0)\n exit()\nans = []\nwhile N !=0:\n ans.append(N%2)\n N = -(N-N%2)//2\nans.reverse()\nprint("".join(list(map(str,ans))))'] | ['Wrong Answer', 'Accepted'] | ['s256566124', 's715444601'] | [8976.0, 9116.0] | [29.0, 29.0] | [166, 180] |
p03286 | u365364616 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\nif N == 0:\n print('0')\nelse:\n k = 0\n ans = []\n while(True):\n if N % (-2) ** k == 0:\n ans.append('0')\n else:\n ans.append('1')\n N -= (-2) ** (k - 1)\n if N == 0:\n break\n else:\n k += 1\n print(''.join(ans[::-1]))", "N = int(input())\nif N == 0:\n print('0')\nelse:\n k = 1\n ans = []\n while(True):\n if N % ((-2) ** k) == 0:\n ans.append('0')\n else:\n ans.append('1')\n N -= (-2) ** (k - 1)\n if N == 0:\n break\n else:\n k += 1\n print(''.join(ans[::-1]))"] | ['Wrong Answer', 'Accepted'] | ['s774318647', 's584387111'] | [3188.0, 3060.0] | [18.0, 17.0] | [322, 324] |
p03286 | u371763408 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\nif n ==0:\n print(0)\ns=\'\'\nwhile n !=0:\n if n%2==1:\n s="1"+s\n n-=1\n else:\n s=\'0\'+s\n n-=n//2\nprint(s)\n', 'n = int(input())\nif n ==0:\n print(0)\ns=\'\'\nwhile n !=0:\n if n%2==1:\n s="1"+\n n-=1\n else:\n s=\'0\'+s\n n-=n//2\nprint(s)\n', 'n = int(input())\nif n ==0:\n print(0)\ns=\'\'\nwhile n !=0:\n if n%2==1:\n s="1"+s\n n-=1\n else:\n s=\'0\'+s\n n=-n//2\nprint(s)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s041686844', 's454214173', 's895611597'] | [3684.0, 3064.0, 2940.0] | [2104.0, 18.0, 17.0] | [129, 128, 128] |
p03286 | u391066416 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['def sigma4jou(k):\n total = 0\n for i in range(k):\n total += 4 ** (i)\n return(total)\n\ndef pketa(N):\n k = 1\n while N - sigma4jou(k) > 0:\n k += 1\n return(2 * k - 1)\n\ndef mketa(N):\n k = 1\n while N + 2 * sigma4jou(k) < 0:\n k += 1\n return(2 * k)\n\ndef getResult(N):\n result = ""\n if N == 0:\n result += "0"\n elif N > 0:\n k = pketa(N)\n for i in range(k, 0, -2):\n j = int((i+1)/2)\n if abs((sigma4jou(j) - N) // (2 ** (i-1))) % 2 == 0:\n result += "1"\n else:\n result += "0"\n if i > 1:\n if abs(((sigma4jou(j) - N)) // (2 ** (i-2))) % 2 == 1:\n result += "1"\n else:\n result += "0"\n elif N < 0:\n k = mketa(N)\n for i in range(k, 0, -2):\n j = int(i/2)\n if abs((N + 2 * sigma4jou(j)) // (2 ** (i-1))) % 2 == 0:\n result += "1"\n else:\n result += "0"\n if i > 1:\n if abs(((N + 2 * sigma4jou(j))) // (2 ** (i-2))) % 2 == 1:\n result += "1"\n else:\n result += "0"\n return(result)\n\nN = input()\nprint(getResult(N))', 'def sigma4jou(k):\n total = 0\n for i in range(k):\n total += 4 ** (i)\n return(total)\n\ndef pketa(N):\n k = 1\n while N - sigma4jou(k) > 0:\n k += 1\n return(2 * k - 1)\n\ndef mketa(N):\n k = 1\n while N + 2 * sigma4jou(k) < 0:\n k += 1\n return(2 * k)\n\ndef getResult(N):\n result = ""\n if N == 0:\n result += "0"\n elif N > 0:\n k = pketa(N)\n for i in range(k, 0, -2):\n j = int((i+1)/2)\n if abs((sigma4jou(j) - N) // (2 ** (i-1))) % 2 == 0:\n result += "1"\n else:\n result += "0"\n if i > 1:\n if abs(((sigma4jou(j) - N)) // (2 ** (i-2))) % 2 == 1:\n result += "1"\n else:\n result += "0"\n elif N < 0:\n k = mketa(N)\n for i in range(k, 0, -2):\n j = int(i/2)\n if abs((N + 2 * sigma4jou(j)) // (2 ** (i-1))) % 2 == 0:\n result += "1"\n else:\n result += "0"\n if i > 1:\n if abs(((N + 2 * sigma4jou(j))) // (2 ** (i-2))) % 2 == 1:\n result += "1"\n else:\n result += "0"\n return(result)\n\nN = int(input())\nprint(getResult(N))'] | ['Runtime Error', 'Accepted'] | ['s825971735', 's240463070'] | [3064.0, 3064.0] | [17.0, 17.0] | [1266, 1271] |
p03286 | u397531548 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N=int(input())\nif N==0:\n print(0)\nelif N>0:\n a=0\n i=31\n while i>=0:\n if N%(2**i)==0:\n if i%2==1:\n a+=2**(i+1)+2**i\n break\n else:\n a+=2**i\n break\n else:\n if N>2**i:\n N-=2**i\n if i%2==1:\n a+=2**(i+1)+2**i\n else:\n a+=2**i\n i-=1\n print(int(str(a),2))\nelse:\n a=0\n i=31\n while i>=0:\n if N%(2**i)==0:\n if i%2!=1:\n a+=2**(i+1)+2**i\n break\n else:\n a+=2**i\n break\n else:\n if -N>2**i:\n N+=2**i\n if i%2!=1:\n a+=2**(i+1)+2**i\n else:\n a+=2**i\n i-=1\n print(int(str(a),2))\n', 'N=int(input())\nif N==0:\n print(0)\nelif N>0:\n a=0\n i=31\n while i>=0:\n if N%(2**i)==0:\n if i%2==1:\n a+=2**(i+1)+2**i\n break\n else:\n a+=2**i\n break\n else:\n if N>2**i:\n N-=2**i\n if i%2==1:\n a+=2**(i+1)+2**i\n else:\n a+=2**i\n i-=1\n print(int(format(a,2)))\nelse:\n a=0\n i=31\n while i>=0:\n if N%(2**i)==0:\n if i%2!=1:\n a+=2**(i+1)+2**i\n break\n else:\n a+=2**i\n break\n else:\n if -N>2**i:\n N+=2**i\n if i%2!=1:\n a+=2**(i+1)+2**i\n else:\n a+=2**i\n i-=1\n print(int(format(a,2)))\n', 'N=int(input())\nif N==0:\n a=0\nelif N>0:\n a=0\n i=31\n while i>=0:\n if N%(2**i)==0:\n if i%2==1:\n a+=2**(i+1)+2**i\n break\n else:\n a+=2**i\n break\n else:\n if N>2**i:\n N-=2**i\n if i%2==1:\n a+=2**(i+1)+2**i\n else:\n a+=2**i\n i-=1\nelse:\n a=0\n i=31\n while i>=0:\n if N%(2**i)==0:\n if i%2!=1:\n a+=2**(i+1)+2**i\n break\n else:\n a+=2**i\n break\n else:\n if -N>2**i:\n N+=2**i\n if i%2!=1:\n a+=2**(i+1)+2**i\n else:\n a+=2**i\n i-=1\nprint(int(format(a,"b"))\n', 'N=int(input())\nif N==0:\n N=0\nelif N>0:\n n=format(N,"b")\n for i in range(10**9):\n if i==len(n):\n break\n elif i%2==1:\n if n[-i-1]=="1":\n N+=2**(i+1)\n n=format(N,"b")\nelse:\n N*=-1\n n=format(N,"b")\n for i in range(10**9):\n if i==len(n):\n break\n elif i%2==0:\n if n[-i-1]=="1":\n N+=2**(i+1)\n n=format(N,"b")\nprint(int(format(N,"b")))\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s039172838', 's191905204', 's326256255', 's505887297'] | [3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 18.0, 18.0, 18.0] | [886, 892, 856, 478] |
p03286 | u398942100 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["a=int(input())\nb=[]\nif a==0:\n print(0)\nelse:\n while a:\n\tb.append(a&1)\n\ta=int((a-(a&1))/(-2))\n print(''.join(map(str,b)))", "a=int(input())\nb=[]\nwhile a:\n\tprint(str(a)+' '+str(a&1))\n\tb.append(a&1)\n\ta=int((a-(a&1))/(-2))\nprint(''.join(map(str,b)))", "a=int(input())\nb=[]\nif a==0:\n\tprint(0)\nwhile a:\n\tb.append(a&1)\n\ta=int((a-(a&1))/(-2))\nprint(''.join(map(str,b)))", "a=int(input())\nb=[]\nif(a==0)print(0)\nwhile a:\n\tb.append(a&1)\n\ta=int((a-(a&1))/(-2))\nprint(''.join(map(str,b)))", "a=int(input())\nb=''\nwhile a:\n s=str(a&1)+s\n n=-(n//2)\nprint(b if b else 0)", "a=int(input())\nb=[]\nif(a==0)print(0)\nelse:\n while a:\n\tb.append(a&1)\n\ta=int((a-(a&1))/(-2))\n print(''.join(map(str,b)))", "a=int(input())\nb=[]\nif a==0:\n\tprint(0)\nwhile a:\n\tb.append(a&1)\n\ta-=a&1\n\ta=int(a/-2)\nprint(''.join(map(str,b)))", "a=int(input())\nb=''\nwhile a:\n b=str(a&1)+b\n a=-(a//2)\nprint(b if b else 0)"] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s160153425', 's173163610', 's426963169', 's556193131', 's576626122', 's622821313', 's764300600', 's891892843'] | [3060.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3060.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0] | [123, 121, 112, 110, 76, 120, 110, 74] |
p03286 | u415905784 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\ndef n_aray_notation(N, n):\n if N == 0:\n return '0'\n else:\n s = ''\n while N:\n s = str(N % abs(n)) + s\n N -= N % abs(n)\n N //= n\n return s\nprint(n_array_notation(N, -2))", "N = int(input())\ndef n_ary_notation(N, n):\n if N == 0:\n return '0'\n else:\n s = ''\n while N:\n s = str(N % abs(n)) + s\n N -= N % abs(n)\n N //= n\n return s\nprint(n_ary_notation(N, -2))"] | ['Runtime Error', 'Accepted'] | ['s837720224', 's588127721'] | [2940.0, 2940.0] | [17.0, 17.0] | [213, 210] |
p03286 | u417169160 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N=int(input())\ni=0\ns=[]\nn=N\nwhile 1:\n k=pow(2,i+1)\n d=n%k\n if d!=0:\n s.append(1)\n n=n-pow(-2,i)\n elif n//k!=0:\n s.append(0)\n else:\n break\n i=i+1\nwhile s:\n print(s.pop())\n ', 'N=int(input())\ni=0\ns=[]\nn=N\nwhile 1:\n k=pow(2,i+1)\n d=n%k\n if d!=0:\n s.append(1)\n n=n-pow(-2,i)\n elif n//k!=0:\n s.append(0)\n else:\n break\n i=i+1\nwhile s:\n print(s.pop(),end="")\nif N==0:\n print(0,end="")\nprint("")\n '] | ['Wrong Answer', 'Accepted'] | ['s487383292', 's277451905'] | [3060.0, 3064.0] | [19.0, 18.0] | [223, 269] |
p03286 | u434282696 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\nif N == 0:\n print(0)\nelse:\n li = []\n ind = 0\n while N != 0:\n if N % 2**(ind + 1) == 0:\n li.insert(0,0)\n ind += 1\n else:\n li.insert(0,1)\n N -= (-2)**(ind)\n ind += 1 \n x = ''.join([str(li[i]) for i in range(len(li))])\n print(x)", "N = int(input())\nif N == 0:\n print(0)\nelse:\n li = []\n ind = 0\n while N != 0:\n if N % 2**(ind + 1) == 0:\n li.insert(0,0)\n ind += 1\n else:\n li.insert(0,1)\n N -= (-2)**(ind)\n ind += 1 \n x = ''.join([str(li[i]) for i in range(len(li))])\n print(x)"] | ['Wrong Answer', 'Accepted'] | ['s267748832', 's718368948'] | [3064.0, 3064.0] | [17.0, 17.0] | [356, 340] |
p03286 | u445380615 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['def mainusbin(num):\n base = -2\n dst = ""\n i = 0\n if abs(base) > num:\n return num\n while abs(base**i) <= num:\n i += 1\n amari = num % base**i\n if amari:\n dst = "1" + dst\n num -= base**(i-1)\n else:\n dst = "0" + dst\n return dst\nsrc = int(input())\ndst = mainusbin(src)\nprint(dst)\n', 'def mainusbin(num):\n base = -2\n dst = ""\n i = 0\n if abs(base) > abs(num):\n return num\n while abs(base**i) <= abs(num):\n i += 1\n amari = num % base**i\n if amari:\n dst = "1" + dst\n num -= base**(i-1)\n else:\n dst = "0" + dst\n return dst\nsrc = int(input())\ndst = mainusbin(src)\nprint(dst)\n'] | ['Wrong Answer', 'Accepted'] | ['s555028321', 's689183798'] | [3060.0, 3060.0] | [18.0, 18.0] | [361, 371] |
p03286 | u445927145 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['from itertools import permutations\n\n\nclass Solver(object):\n def __init__(self):\n self.n = int(input())\n\n def solve(self):\n number_string = ""\n n = self.n\n while True:\n remainder = abs(n % (-2))\n number_string = str(remainder) + number_string\n quotient = n // (-2)\n if quotient == 0:\n break\n n = quotient\n if number_string == "":\n print("0")\n else:\n print(number_string.lstrip("0"))\n\n\nif __name__ == "__main__":\n s = Solver()\n s.solve()', 'from itertools import permutations\n\n\nclass Solver(object):\n def __init__(self):\n self.n = int(input())\n\n def solve(self):\n number_string = ""\n n = -self.n\n while True:\n remainder = abs(n % (-2))\n number_string = str(remainder) + number_string\n quotient = n // (-2)\n if quotient == 0:\n break\n n = quotient\n if (number_string == "") or (number_string == "0"):\n print("0")\n else:\n print(number_string.lstrip("0"))\n\n\nif __name__ == "__main__":\n s = Solver()\n s.solve()'] | ['Wrong Answer', 'Accepted'] | ['s601479803', 's818659413'] | [3064.0, 3064.0] | [17.0, 21.0] | [581, 610] |
p03286 | u451017206 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['def EncodeNegBase(n, b): #Converts from decimal\n\tif n == 0:\n\t\treturn "0"\n\tout = []\n\twhile n != 0:\n\t\tn, rem = divmod(n, b)\n\t\tif rem < 0:\n\t\t\tn += 1\n\t\t\trem -= b\n\t\tout.append(rem)\n\treturn "".join(map(str, out[::-1]))\n \ndef DecodeNegBase(nstr, b): #Converts to decimal\n\tif nstr == "0":\n\t\treturn 0\n \n\ttotal = 0\n\tfor i, ch in enumerate(nstr[::-1]):\n\t\ttotal += int(ch) * b**i\n\treturn total', "N = int(input())\nans = ''\nwhile N != 0:\n bit = N % 2\n ans = str(bit) + ans\n N -= bit\n N //= -2\nif not ans:ans=0\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s181984457', 's953751631'] | [3060.0, 3060.0] | [17.0, 17.0] | [381, 134] |
p03286 | u457683760 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n=int(input())\n\nif n==0:\n print(0)\nelse:\n ans=""\n while n!=0:\n ans=str(n%2)+ans\n n=n//(-2)\nans=int(ans)\nprint(ans)', 'n=int(input())\n\nif n==0:\n ans="0"\nelse:\n ans=""\n while n!=0:\n ans=str(n%2)+ans\n n=-1*(n//2)\nans=int(ans)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s292804792', 's418146484'] | [2940.0, 3060.0] | [19.0, 18.0] | [137, 138] |
p03286 | u457901067 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N = int(input())\ni = 0\nansw = []\n\nif N == 0:\n print("0")\n exit(0)\n\nif ( N == abs(N)):\n sign = 1\n base = 0\n i = 0\n while(1):\n if N <= (-2) ** i + base:\n break\n else:\n base = base + (-2) ** i\n i = i + 2\nelse:\n sign = -1\n base = 0\n i = 1\n while(1):\n if N >= (-2) ** i + base:\n break\n else:\n base = base + (-2) ** i\n i = i + 2\n #print(i, base)\n# keta\n#print("keta", i)\n\nif(sign == 1):\n N = N - (-2) ** i\n answ.append(\'1\')\n i = i - 1\n\nwhile(i >= 0):\n a = N\n b = N - (-2) ** i\n c = N - (-2) ** i - (-2) ** (i-1)\n d = N - (-2) ** (i-1)\n x = min(abs(a), abs(b), abs(c), abs(d))\n if abs(a) == x:\n answ.append(\'00\')\n elif abs(b) == x:\n answ.append(\'10\')\n N = b\n elif abs(c) == x:\n answ.append(\'11\')\n N = c\n else:\n answ.append(\'01\')\n N = d\n #print(i,N)\n i = i - 2\n\nals = \'\'.join(answ)\nprint(als[::-1])', 'N = int(input())\ni = 0\nstr = ""\n\nif N == 0:\n print(\'0\')\n exit(0)\n\nwhile(N != 0):\n if N % 2 == 1:\n str = \'1\' + str\n N = N - 1\n else:\n str = \'0\' + str\n #print(i,N)\n N = N // (-2)\n #i += 1\n\nprint(str)'] | ['Wrong Answer', 'Accepted'] | ['s718322866', 's627532911'] | [3064.0, 2940.0] | [17.0, 17.0] | [882, 213] |
p03286 | u472065247 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n = 0\nl = []\n\nif n == 0:\n l.append('0')\n\nwhile n:\n if n % 2:\n l.append('1')\n else:\n l.append('0')\n n = -(n // 2)", "n = 0\nl = []\n\nif n == 0:\n l.append('0')\n\nwhile n:\n if n % 2:\n l.append('1')\n else:\n l.append('0')\n n = -(n // 2)\n\nprint(''.join(reversed(l)))", "n = int(input())\n\nl = []\n\nif n == 0:\n l.append('0')\n\nwhile n:\n if n % 2:\n l.append('1')\n else:\n l.append('0')\n n = -(n // 2)\n\nprint(''.join(reversed(l)))\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s318995132', 's963692650', 's070294535'] | [2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0] | [138, 167, 180] |
p03286 | u474270503 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N=-int(input())\nif N=0:\n print(0)\nelse:\n tmp=[]\n while N!=0:\n tmp.insert(0,N%(2))\n N=-N//2\n s=''.join([str(_) for _ in tmp])\n print(s)\n", "N=-int(input())\nif N==0:\n print(0)\nelse:\n tmp=[]\n while N!=0:\n tmp.insert(0,N%(2))\n N=-N//2\n s=''.join([str(_) for _ in tmp])\n print(s)\n"] | ['Runtime Error', 'Accepted'] | ['s115916752', 's562559622'] | [2940.0, 2940.0] | [16.0, 17.0] | [164, 165] |
p03286 | u475675023 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N=int(input())\nL=[]\nM=""\nwhile N!=0:\n M=int((-1)*(N%(-2)))\n if N<0:\n N=int((N-1)/(-2))\n else:\n N=int(N/(-2))\n L.insert(0,str(M))\nif N=0:\n print(0)\nelse:\n print("".join(L))', 'N=int(input())\nL=[]\nM=""\nwhile N!=0:\n M=int((-1)*(N%(-2)))\n if N<0:\n N=int((N-1)/(-2))\n else:\n N=int(N/(-2))\n L.insert(0,str(M))\nif N==0:\n print(0)\nelse:\n print("".join(L))', 'N=int(input())\nL=[]\nM=""\nwhile N!=0:\n M=int((-1)*(N%(-2)))\n if N<0:\n N=int((N-1)/(-2))\n else:\n N=int(N/(-2))\n L.insert(0,str(M))\nif len(L)==0:\n L=["0"]\nprint("".join(L))\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s338344401', 's866589198', 's973874022'] | [2940.0, 3060.0, 3060.0] | [17.0, 18.0, 17.0] | [183, 184, 181] |
p03286 | u494058663 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\n\nans = []\ntmp = 0\n\ndef algo(n):\n if n == 0:\n return\n \n if n%2 == 0:\n tmp = 0 \n else:\n tmp = 1\n ans.append(tmp)\n algo((n-tmp)//(-2))\n\nalgo(N)\nStr = ''\nfor i in range(len(ans)):\n Str=Str+str(ans[i])\nprint(Str)", "import sys\nN = int(input())\nif N == 0:\n print(0)\n sys.exit()\nans = []\ntmp = 0\n\ndef algo(n):\n if n == 0:\n return \n \n if n%2 == 0:\n tmp = 0 \n else:\n tmp = 1\n ans.append(tmp)\n algo((n-tmp)//(-2))\n\nalgo(N)\nStr = ''\nans.reverse()\nfor i in range(len(ans)):\n Str=Str+str(ans[i])\nprint(Str)\n\n"] | ['Wrong Answer', 'Accepted'] | ['s090203844', 's987753957'] | [3064.0, 3064.0] | [18.0, 17.0] | [296, 362] |
p03286 | u497625442 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\ns=""\nt=-2\nwhile n != 0:\n z = 0 if n % t ==0 else 1\n s = s + str(z)\n n = n - z*t/(-2)\n t = t*(-2)\nprint(s)\n', 'n = int(input())\nif n==0:\n print("0")\n exit()\ns=""\nt=-2\nwhile n != 0:\n z = 0 if n % t ==0 else 1\n s = str(z)+s\n n = n - z*t/(-2)\n t = t*(-2)\nprint(s)'] | ['Wrong Answer', 'Accepted'] | ['s426393482', 's527191303'] | [2940.0, 2940.0] | [17.0, 17.0] | [127, 155] |
p03286 | u500990280 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = map(int,input())\n\n\ndef base-2(n):\n a = ()\n while n! = 0:\n r = n % 2:\n if (r < 0):\n r += 2\n\n n = (n - r)/2\n a.append(str(r))\n if(a = ""):\n a = "0"\n reversed(a)\nprint(base(n))', 'n = int(input())\ndef basen(n):\n a = []\n while n!= 0:\n r = n % 2\n if (r < 0):\n r += 2\n\n n = (n - r)//(-2)\n a.append(r)\n if(a == " "):\n a.append(0)\n reversed(a)\n return a\nprint(basen(n))', 'n = map(int,input())\n\ndef basen(n):\n a = []\n while n!= 0:\n r = n % 2\n if (r < 0):\n r += 2\n\n n = (n - r)//(-2)\n a.append(r)\n if(a == " "):\n a.append(0)\n reversed(a)\n return a\n \nprint(basen(n))', 'n = int(input())\ndef basen(n):\n a = []\n while n!= 0:\n r = n % 2\n if (r < 0):\n r += 2\n\n n = (n - r)//(-2)\n a.append(r)\n if(a == " "):\n a.append(0)\n reversed(a)\n return "".join(map(str,a))\nprint(basen(n))', 'n = int(input())\n\ndef basen(n):\n a = []\n while n!= 0:\n r = n % 2\n if (r < 0):\n r += 2\n\n n = (n - r)//(-2)\n a.append(r)\n if a == []:\n a.append(0)\n a.reverse()\n return "".join(map(str,a))\nprint(basen(n))\n\n '] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s187895505', 's607905235', 's634620566', 's955580839', 's519032488'] | [3064.0, 3060.0, 3060.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 18.0, 18.0] | [239, 257, 264, 275, 276] |
p03286 | u502389123 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\nstr = ''\n\nwhile(N != 0):\n if N % 2:\n N -= 1\n N //= -2\n str += '1'\n else:\n N //= -2\n str += '0'\n \nif N == 0:\n print(0)\nelse:\n print(str[::-1])\n", "N = int(input())\nstr = ''\n\nwhile(N != 0):\n if N % 2:\n N -= 1\n N //= -2\n str += '1'\n else:\n N //= -2\n str += '0'\n \nif str = '':\n print(0)\nelse:\n print(str[::-1])\n", "N = int(input())\nstr = ''\n\nwhile(N != 0):\n if N % 2:\n N -= 1\n N //= -2\n str += '1'\n else:\n N //= -2\n str += '0'\n\nif str == '':\n print(0)\nelse:\n print(str[::-1])\n"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s684848520', 's850694638', 's829174429'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [213, 215, 208] |
p03286 | u513081876 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["import math\nN = int(input())\n\ndef minus_2(n):\n ans = ''\n \n if n == 1:\n ans += '1'\n elif n == 0:\n ans += '0'\n else:\n for i in range(10**9):\n if n % 2 == 0:\n ans += '0'\n else:\n ans += '1'\n n = math.ceil(n/-2)\n if n == 1:\n break\n ans += '1'\n ans = ans[::-1]\n \n return ans\n\nprint(minus_2(N))", "import math\nN = int(input())\nans = ''\n\nif N == 0:\n ans += '0'\nelse:\n while N != 1:\n if N % 2 == 0:\n ans += '0'\n else:\n ans += '1'\n N = math.ceil(N / -2)\n ans += '1'\nans = ans[::-1]\nprint(ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s342267844', 's150648857'] | [3064.0, 2940.0] | [17.0, 17.0] | [444, 244] |
p03286 | u518042385 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['a=int(input())\nl=[]\nif a==0:\n print(a)\nelse:\n while a!=1:\n if a<0:\n l.append(abs(a)%2)\n if abs(a)%2==1:\n a=abs(a-1)//2\n else:\n a=abs(a)//2\n elif a>0:\n l.append(-(a%2))\n a=-(a//2)\n l.append(a)\n s=""\n for i in l:\n s+=str(i)\n print(s)\n \n \n ', 'a=int(input())\nl=[]\nif a==0:\n print(a)\nelse:\n while a!=1:\n if a<0:\n l.append(abs(a)%2)\n if abs(a)%2==1:\n a=abs(a-1)//2\n else:\n a=abs(a)//2\n elif a>0:\n l.append(a%2)\n a=-(a//2)\n l.append(a)\n s=""\n for i in l:\n s+=str(i)\n print(s)', 'a=int(input())\nl=[]\nif a==0:\n print(a)\nelse:\n while a!=1:\n if a<0:\n l.append(abs(a)%2)\n if abs(a)%2==1:\n a=abs(a-1)//2\n else:\n a=abs(a)//2\n elif a>0:\n l.append(a%2)\n a=-(a//2)\n l.append(a)\n s=""\n for i in range(1,1+len(l)):\n s+=str(l[-i])\n print(s)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s045002530', 's859184352', 's697441789'] | [3060.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0] | [296, 282, 302] |
p03286 | u519923151 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\n\ndp =[0]*40\n\nif n ==0:\n print(0)\n\nelif n >0:\n x = bin(n)\n bx = x[2:]\n lx = len(bx)\n for i in range(lx-1,-1,-1):\n dp[i] = int(bx[lx-1-i])\n for i in range(40):\n if i % 2 ==1 and dp[i]==1:\n dp[i+1] +=1\n while max(dp) >1:\n for i in range(40):\n if dp[i] >=2:\n dp[i] -=2\n if dp[i+1] >0:\n dp[i+1] -=1\n else:\n dp[i+1] +=1\n dp[i+2] +=1\n dpr = list(reversed(dp))\n dprs = list(map(lambda x :str(x),dpr))\n dprj = "".join(dprs)\n print(int(dprj)) \n\nelse:\n x = bin(n)\n bx = x[2:]\n lx = len(bx)\n for i in range(lx-1,-1,-1):\n dp[i] = int(bx[lx-1-i])\n for i in range(40):\n if i % 2 ==1 and dp[i]==1:\n dp[i+1] +=1\n while max(dp) >1:\n for i in range(40):\n if dp[i] >=2:\n dp[i] -=2\n if dp[i+1] >0:\n dp[i+1] -=1\n else:\n dp[i+1] +=1\n dp[i+2] +=1\n dpr = list(reversed(dp))\n dprs = list(map(lambda x :str(x),dpr))\n dprj = "".join(dprs)\n print(int(dprj)) ', 'n = int(input())\n\ndp =[0]*40\n\nif n ==0:\n print(0)\n\nelif n >0:\n x = bin(n)\n bx = x[2:]\n lx = len(bx)\n for i in range(lx-1,-1,-1):\n dp[i] = int(bx[lx-1-i])\n for i in range(40):\n if i % 2 ==1 and dp[i]==1:\n dp[i+1] +=1\n while max(dp) >1:\n for i in range(40):\n if dp[i] >=2:\n dp[i] -=2\n if dp[i+1] >0:\n dp[i+1] -=1\n else:\n dp[i+1] +=1\n dp[i+2] +=1\n dpr = list(reversed(dp))\n dprs = list(map(lambda x :str(x),dpr))\n dprj = "".join(dprs)\n print(int(dprj)) \n\nelse:\n x = bin(-n)\n bx = x[2:]\n lx = len(bx)\n for i in range(lx-1,-1,-1):\n dp[i] = int(bx[lx-1-i])\n for i in range(40):\n if i % 2 ==0 and dp[i]==1:\n dp[i+1] +=1\n while max(dp) >1:\n for i in range(40):\n if dp[i] >=2:\n dp[i] -=2\n if dp[i+1] >0:\n dp[i+1] -=1\n else:\n dp[i+1] +=1\n dp[i+2] +=1\n dpr = list(reversed(dp))\n dprs = list(map(lambda x :str(x),dpr))\n dprj = "".join(dprs)\n print(int(dprj)) '] | ['Runtime Error', 'Accepted'] | ['s976058202', 's146813258'] | [9348.0, 9136.0] | [27.0, 30.0] | [1205, 1206] |
p03286 | u528981315 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['import sys\nimport math\ny = int(input().split()[0])\nresult = ""\ni = 0\nwhile True:\n print(i)\n z = (-2) ** (i+1)\n x = y % z\n print(x)\n if x != 0:\n y = y + x\n result = "1" + result\n else:\n result = "0" + result\n if y == 0:\n break\n i = i + 1\nprint(result)', 'import sys\nimport math\ny = int(input().split()[0])\nresult = ""\ni = 0\nwhile True:\n z = (-2) ** (i+1)\n x = y % z\n if x != 0:\n y = y + x\n result = "1" + result\n else:\n result = "0" + result\n if y == 0:\n break\n i = i + 1\nprint(result)\n'] | ['Wrong Answer', 'Accepted'] | ['s970774917', 's793749066'] | [3188.0, 3188.0] | [18.0, 19.0] | [302, 277] |
p03286 | u551909378 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["\ndef change_2r(N):\n if N==0:\n return [0]\n list=[]\n while N>=2:\n list.append(N%2)\n N=int((N-N%2)/2)\n list.append(1)\n return list\n \n\ndef moveup(N,i):\n if len(N)<=i:\n N.append(1)\n else:\n if N[i]==0:\n N[i]=1\n elif N[i]==1:\n N[i]=0\n moveup(N,i+1)\n\nN=int(input())\ni=0\nif N>=0:\n Nlist=change_2r(N)\n while i<len(Nlist):\n if i%2!=0 and Nlist[i]==1:\n moveup(Nlist,i+1)\n i+=1\nelse:\n N=-N\n Nlist=change_2r(N)\n while i<len(Nlist):\n if i%2==0 and Nlist[i]==1:\n moveup(Nlist,i+1)\n i+=1\n \nNlist.reverse()\nprint(Nlist)\nprint(''.join(map(str,Nlist)))", "\ndef change_2r(N):\n if N==0:\n return [0]\n list=[]\n while N>=2:\n list.append(N%2)\n N=int((N-N%2)/2)\n list.append(1)\n return list\n \n\ndef moveup(N,i):\n if len(N)<=i:\n N.append(1)\n else:\n if N[i]==0:\n N[i]=1\n elif N[i]==1:\n N[i]=0\n moveup(N,i+1)\n\nN=int(input())\ni=0\nif N>=0:\n Nlist=change_2r(N)\n while i<len(Nlist):\n if i%2!=0 and Nlist[i]==1:\n moveup(Nlist,i+1)\n i+=1\nelse:\n N=-N\n Nlist=change_2r(N)\n while i<len(Nlist):\n if i%2==0 and Nlist[i]==1:\n moveup(Nlist,i+1)\n i+=1\n \nNlist.reverse()\nprint(''.join(map(str,Nlist)))"] | ['Wrong Answer', 'Accepted'] | ['s260786306', 's588036674'] | [3064.0, 3064.0] | [17.0, 17.0] | [817, 804] |
p03286 | u553348533 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N = int(input())\nans = ""\nif N == 0:\n ans = "0"\nwhile N != 0:\n if N % 2 != 0:\n N -= 1\n ans = "1" + ans\n else:\n ans = "0" + ans\n N //= -2\n\nprint(int(ans))', 'N = int(input())\nans = ""\nif N == 0:\n ans = "0"\nwhile N != 0:\n if N % 2 != 0:\n N -= 1\n ans = "1" + ans\n else:\n ans = "0" + ans\n\n N //= -2\n\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s217495654', 's487032896'] | [2940.0, 2940.0] | [17.0, 17.0] | [190, 187] |
p03286 | u559823804 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["from math import ceil\n\nn=int(input())\nif n==0:\n print(0)\n exit()\n\nans=''\n\nwhile n!=0:\n ans+=str(abs(n)%2)\n n=ceil(n/-2)\n print(n)\nprint(ans[::-1])", "from math import ceil\n\nn=int(input())\nif n==0:\n print(0)\n exit()\n\nans=''\n\nwhile n!=0:\n ans+=str(abs(n)%2)\n n=ceil(n/-2)\nprint(ans[::-1])"] | ['Wrong Answer', 'Accepted'] | ['s478848495', 's283088123'] | [3060.0, 3060.0] | [17.0, 17.0] | [161, 148] |
p03286 | u571444155 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n = int(input())\n\nans = ''\n\nwhile n != 0:\n r = n % 2 \n print(r)\n\n if r < 0:\n r = r + 2\n \n n = (n-r) / (-2)\n\n ans = ans + str(int(r))\n\nans = list(ans) \nprint(ans)\nans.reverse()\nprint(''.join(ans))", "n = int(input())\n\nans = ''\n\nif n == 0:\n print('0')\n\nwhile n != 0:\n r = n % 2 \n\n if r < 0:\n r = r + 2\n \n n = (n-r) / (-2)\n\n ans = ans + str(int(r))\n\nans = list(ans) \nans.reverse()\nprint(''.join(ans))"] | ['Wrong Answer', 'Accepted'] | ['s249815213', 's943805387'] | [3060.0, 3060.0] | [17.0, 17.0] | [223, 226] |
p03286 | u576432509 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n=int(input())\n\n#n=-9\n#ans=1011\n\n#n=123456789\n#ans=11000101011001101110100010101\n#ans="01 10 00 10 10 11 00 11 01 11 01 00 01 01 01"\n\n#n=4\n\n#n=0\n#ans=0\n\nkp=0\nkm=0\nk=0\nwhile not(km<=n and n<=kp):\n k=k+1\n km=-int(2*(4**k-1)/(4-1))\n kp=int((4**k-1)/(4-1))\n# print("n=",n,"k=",k,"km=",km,"kp=",kp) \n#print("n=",n,"n-km=",n-km)\n\nn=n-km\n#s=[]\n#t=[]\nu=""\nwhile n>0:\n n0=n\n n=n//4\n n2=n0%4\n# n1=n0-n*4\n# print(n0,n,n2)\n# s.append(n2)\n if n2==0:\n# t.append("10")\n u="10"+u\n elif n2==1:\n# t.append("11")\n u="11"+u\n elif n2==2:\n# t.append("00")\n u="00"+u\n elif n2==3:\n# t.append("01")\n u="01"+u\n \nif len(u)>0:\n while u[0]=="0":\n u=u[1:]\n\n#s.reverse() \n#print(s)\n#t.reverse() \n#print(t)\nprint(u)\n#print(ans)\n', 'n=int(input())\n\nkp=-10\nkm=10\nk=0\nwhile not(km<=n and n<=kp):\n k=k+1\n km=-int(2*(4**k-1)/(4-1))\n kp=int((4**k-1)/(4-1))\n print("n=",n,"k=",k,"km=",km,"kp=",kp) \n#print("n=",n,"n-km=",n-km)\n\nn=n-km\n\nv=""\nfor kk in range(k):\n np=n//4**(k-kk-1)\n n=n-np*4**(k-kk-1)\n if np==0:\n v=v+"10"\n elif np==1:\n v=v+"11"\n elif np==2:\n v=v+"00"\n elif np==3:\n v=v+"01"\n#print("v=",v)\n\nif len(v)>0 and v[0]=="0":\n v=v[1:]\nif len(v)>0:\n print(v)\nelse:\n print(0)', 'n=int(input())\n\ns=[]\nif n%2==0:\n s.append(0)\nelse:\n s.append(1)\nnn=n\nii=0\nwhile nn<=-1 or 2<=nn:\n nn=(nn-s[ii])//(-2)\n if nn%2==0:\n s.append(0)\n else:\n s.append(1)\n ii+=1\n\nss=""\nfor i in range(len(s)):\n ss=str(s[i])+ss\nprint(ss)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s041759597', 's746967937', 's551609057'] | [3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0] | [824, 515, 263] |
p03286 | u582333355 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\n\nans = ''\n\ndef divide(n):\n\tif n % (-2) != 0:\n\t\tp = (n//(-2))+1\n\t\tq = n - p * (-2)\n\telse:\n\t\tp = n//(-2)\n\t\tq = n - p * (-2)\n\treturn p,q\n\nwhile True:\n\tp,q = divide(N)\n\tif p == 1 or p == 0:\n\t\tans = str(p) + ans\n\t\tbreak\n\tN = p\n\tans = str(q) + ans\nprint(ans)", "N = int(input())\n\nans = ''\n\ndef divide(n):\n\tif n % (-2) != 0:\n\t\tp = (n//(-2))+1\n\t\tq = n - p * (-2)\n\telse:\n\t\tp = n//(-2)\n\t\tq = n - p * (-2)\n\treturn p,q\n\nwhile True:\n\tp,q = divide(N)\n\tif p == 0:\n\t\tans = str(p) + ans\n\t\tbreak\n\tN = p\n\tans = str(q) + ans\n\tif p == 1:\n\t\tans = str(p) + ans\n\t\tbreak\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s509320951', 's848266836'] | [3064.0, 3064.0] | [17.0, 17.0] | [269, 300] |
p03286 | u585742242 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["# -*- coding: utf-8 -*-\nn = int(input())\n\nif n == 0:\n print(0)\n\nelse:\n s = ''\n cnt = 1\n while n > 0:\n s += str(1) if n % (-2)**cnt != 0 else str(0)\n n -= (-2)**(cnt - 1) if n % (-2)**cnt != 0 else 0\n cnt += 1\n print(s[::-1])\n", "# -*- coding: utf-8 -*-\nn = int(input())\n\nif n == 0:\n print(0)\n\nelse:\n s = ''\n cnt = 1\n while n != 0:\n s += str(1) if n % (-2)**cnt != 0 else str(0)\n n -= (-2)**(cnt - 1) if n % (-2)**cnt != 0 else 0\n cnt += 1\n print(s[::-1])\n"] | ['Wrong Answer', 'Accepted'] | ['s528053000', 's564504158'] | [2940.0, 2940.0] | [17.0, 17.0] | [261, 262] |
p03286 | u593005350 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N=int(input())\n\nx=[]\nif N != 0:\n\tflag = N // abs(N)\nN=abs(N)\nwhile N != 0:\n\tx.insert(0,N % 2 * flag )\n\tN //= 2\n\tflag *= -1\nx.insert(0,0)\nx.insert(0,0)\n\n# 2 = (-1)*(-2) = (-2+1)*(-2) = (-2)^2+(-2)\nfor i in range(len(x))[::-1]:\n\tif x[i] == -1:\n\t\tx[i] = 1\n\t\tx[i-1] += 1\n\tif x[i] == 2:\n\t\tx[i] = 0\n\t\tx[i-1] += 1\n\t\tx[i-2] += 1\n\nif x[0]==1:\n\tprint(1,end="")\nelif len(x)==1:\n\tprint(0)\nfor i in range(1,len(x)):\n\tprint(x[i],end="")\n', 'N=int(input())\nx=""\nwhile N != 0:\n\tx=str(N%2) + x\n\tN =-(N//2)\nprint(x if x!="" else 0)'] | ['Wrong Answer', 'Accepted'] | ['s345186936', 's365988793'] | [3064.0, 2940.0] | [17.0, 17.0] | [534, 86] |
p03286 | u597374218 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n=int(input())\nx=""\nwhile n!=0:\n x+=str(n%2)\n n=-(n//2)\nprint("0" if x=="" else x)', 'n=int(input())\nx=""\nwhile n!=0:\n x=str(n%2)+x\n n=-(n//2)\nprint(0 if x=="" else x)'] | ['Wrong Answer', 'Accepted'] | ['s362132784', 's230186365'] | [2940.0, 2940.0] | [18.0, 18.0] | [88, 87] |
p03286 | u598812605 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\nif n == 0:\n print("0")\n exit()\nans = ""\nwhile n != 0:\n if n % (2) == 0:\n n = n // (-2)\n ans = ans + "0"\n else:\n n = (n - 1) // (-2)\n ans = ans + "1"\nprint(ans)', 'n = int(input())\nif n == 0:\n print(0)\n exit()\nans = ""\nwhile n != 0:\n if n % (2) == 0:\n n = n // (-2)\n ans = ans + 0\n else:\n n = (n - 1) // (-2)\n ans = ans + 1\nprint(ans)', 'n = int(input())\nif n == 0:\n print("0")\n exit()\nans = ""\nwhile n != 0:\n if n % (-2) == 0:\n n = n // (-2)\n ans = ans + "0"\n else:\n n = (n - 1) // (-2)\n ans = ans + "1"\nprint(ans)', 'n = int(input())\nif n == 0:\n print(0)\n exit()\nans = ""\nwhile n != 0:\n if n % (2) == 0:\n n = n // (-2)\n ans = "0" + ans\n else:\n n = (n - 1) // (-2)\n ans = "1" + ans\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s233257882', 's728798557', 's909416938', 's922206606'] | [3060.0, 3060.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0, 20.0] | [216, 210, 217, 214] |
p03286 | u600402037 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N = int(input())\nprint(bin(N)[2:])', 'N = int(input())\nprint(bin(N)[3:] if N != 0 else 0)', "# coding: utf-8\nimport sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\ndef F(x):\n if x == 0:\n return ''\n if x % 2 == 0:\n return F(x//-2) + '0'\n else:\n return F((x-1)//-2) + '1'\n\nN = ir()\nanswer = F(N)\nif N == 0:\n answer = 0\nprint(answer)\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s435306774', 's535522890', 's775029715'] | [3064.0, 2940.0, 3060.0] | [18.0, 18.0, 18.0] | [34, 51, 337] |
p03286 | u612721349 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\ndef solve():\n n = int(input())\n ans, m = "", 1\n while n != 0:\n m *= (-2)\n if abs(n) % abs(m) > 0:\n ans += "1"\n n -= m // (-2)\n else:\n ans += "0"\n print(ans if ans else 0)\n\nif __name__=="__main__":\n solve()', '#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\ndef solve():\n n = int(input())\n ans, m = "", 1\n while n != 0:\n m *= (-2)\n if abs(n) % abs(m) > 0:\n ans += "1"\n n -= m // (-2)\n else:\n ans += "0"\n print(ans[::-1] if ans else 0)\n\nif __name__=="__main__":\n solve()'] | ['Wrong Answer', 'Accepted'] | ['s888996550', 's906981281'] | [3060.0, 3060.0] | [17.0, 17.0] | [321, 327] |
p03286 | u616217092 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["from sys import stdin\nstdin = open('sample.txt')\n\n\ndef main():\n N = int(stdin.readline().rstrip())\n\n if N == 0:\n print('0')\n return\n\n ans = ''\n base = 2\n while N != 1:\n ans = str(abs(N % base)) + ans\n N = N // base\n N = -1 * N\n print('1' + ans)\n\n\nif __name__ == '__main__':\n main()\n", "from sys import stdin\n\n\ndef main():\n N = int(stdin.readline().rstrip())\n\n if N == 0:\n print('0')\n return\n\n ans = ''\n base = 2\n while N != 1:\n ans = str(abs(N % base)) + ans\n N = N // base\n N = -1 * N\n print('1' + ans)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s275447274', 's780275080'] | [3060.0, 3060.0] | [17.0, 17.0] | [338, 311] |
p03286 | u617037231 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["N = int(input())\ns = ''\ns2 = ''\nwhile N != 0:\n if N % 2 == 0:\n s += '0'\n N //= (-2)\n if N % 2 == -1 or N % 2 == 1:\n s += '1'\n N //= (-2)\n N += 1\ns2 = s[::1]\nprint(s2)\n \n \n ", "import sys\nN = int(input())\ns = ''\ns2 = ''\nif N == 0:\n print(0)\n sys.exit(0)\nwhile N != 0:\n if N % 2 == 0:\n s += '0'\n N //= (-2)\n if N % 2 == -1 or N % 2 == 1:\n s += '1'\n N //= (-2)\n N += 1\ns2 = s[::-1]\nprint(s2)\n"] | ['Wrong Answer', 'Accepted'] | ['s259220708', 's761748268'] | [2940.0, 3060.0] | [17.0, 17.0] | [198, 232] |
p03286 | u617203831 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n=int(input())\nx=""\nwhile n!=0:\n x=str(n%2)+x\n s=-(n//2)\nprint(0 if x=="" else x)', 'n=int(input())\nx=""\nwhile n!=0:\n x=str(n%2)+x\n n=-(n//2)\nprint(0 if x=="" else x)'] | ['Time Limit Exceeded', 'Accepted'] | ['s076644795', 's812971757'] | [3672.0, 2940.0] | [2104.0, 17.0] | [87, 87] |
p03286 | u620846115 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['N = input()\na = ""\nif N ==0:\n a =0\nwhile N !=0:\n if N%2 != 0:\n a = "1" + a\n else:\n a = "0" + a\n N = - (N//2)\nprint(a)', 'N = int(input())\na = ""\nif N ==0:\n a =0\nwhile N !=0:\n if N%2 != 0:\n a = "1" + a\n else:\n a = "0" + a\n N = - (N//2)\nprint(a)'] | ['Runtime Error', 'Accepted'] | ['s955141747', 's249635458'] | [8988.0, 9184.0] | [23.0, 30.0] | [127, 132] |
p03286 | u623687794 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n=int(input())\nans=""\ni=1\nwhile True:\n if n==0:break\n else:\n if n%(2**i)==0:ans="0"+ans;n-=2**i;i+=1\n else:ans="1"+ans;n-=2**i;i+=1\nprint(ans)', 'n=int(input())\nans=""\ni=1\nwhile True:\n if n==0:break\n else:\n if n%(2**i)==0:ans="0"+ans;i+=1\n else:ans="1"+ans;n-=(-2)**(i-1);i+=1\nprint(ans if ans!="" else 0)\n'] | ['Wrong Answer', 'Accepted'] | ['s984148694', 's134074541'] | [3060.0, 2940.0] | [2104.0, 17.0] | [150, 168] |
p03286 | u627691992 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n = int(input())\n\ns = ''\nwhile(n != 0):\n s = str(n % 2)+s\n n = -(n//2)\n print(s)\n", 'n = int(input())\n\ns = \'\'\nwhile(n != 0):\n s = str(n % 2)+s\n n = -(n//2)\nprint(0 if(s == "") else s)\n'] | ['Wrong Answer', 'Accepted'] | ['s097177505', 's819457524'] | [9168.0, 9148.0] | [27.0, 29.0] | [90, 105] |
p03286 | u628262476 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n = int(input())\nret = ''\nwhile n > 0:\n d, r = n / (-2), n % (-2)\n if r == -1: # (d+1) * (-2) + 1 = n\n r = 1\n d += 1\n ret += str(r)\n n = d\nif ret == '':\n ret = '0'\nelse:\n ret = ret[::-1]\nprint(ret)\n ", "n = int(input())\nret = ''\nwhile n != 0:\n d, r = n // (-2), n % (-2)\n if r == -1: # (d+1) * (-2) + 1 = n\n r = 1\n d += 1\n ret += str(r)\n n = d\nif ret == '':\n ret = '0'\nelse:\n ret = ret[::-1]\nprint(ret)\n "] | ['Wrong Answer', 'Accepted'] | ['s529895732', 's494148262'] | [2940.0, 2940.0] | [19.0, 17.0] | [212, 214] |
p03286 | u631914718 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["input()\nprint('11000101011001101110100010101')", 'def determine_digit(digit_num, acm, n):\n mod = 2 ** (digit_num + 1)\n if (n - acm) % mod:\n return 1\n else:\n return 0\n\n\ndef convert(n):\n if n == 0:\n return \'0\'\n\n result = \'\'\n acm = 0\n digit_num = 0\n # print(\'n:\', n)\n while n != acm:\n # print(digit_num, acm, result)\n d = determine_digit(digit_num, acm, n)\n # print(\'d: \', d)\n\n # incremental procedure\n acm += d * (-2)**digit_num\n digit_num += 1\n result += str(d)\n\n return result[::-1]\n\n\nif __name__ == "__main__":\n n = int(input())\n\n print(convert(n))\n'] | ['Wrong Answer', 'Accepted'] | ['s799682767', 's181658629'] | [2940.0, 3064.0] | [17.0, 17.0] | [46, 606] |
p03286 | u652081898 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ['n = int(input())\n\nif N == 0:\n print(0)\n exit()\n\ns = ""\nwhile n != 0:\n s += str(n%2)\n n = (n-n%2)//(-2)\n\nprint(s[::-1])', 'n = int(input())\n\nif n == 0:\n print(0)\n exit()\n\ns = ""\nwhile n != 0:\n s += str(n%2)\n n = (n-n%2)//(-2)\n\nprint(s[::-1])\n'] | ['Runtime Error', 'Accepted'] | ['s585550889', 's288125584'] | [3060.0, 2940.0] | [17.0, 17.0] | [130, 131] |
p03286 | u652656291 | 2,000 | 1,048,576 | Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N. It can be proved that, for any integer M, the base -2 representation of M is uniquely determined. | ["n = int(input())\nx = ''\nwhile n != 0:\n x += str(n%2)\n n = -(n//2)\n \nif x == '':\n print(0)\nelse:\n print(x)\n", 'n=int(input())\nx=""\nWhile n != 0:\n x = str(n%2) + x\n n = -(n//2)\nprint(0 if x == "" else x)\n', "n = int(input())\nx = ''\nWhile n != 0:\n x += str(n%2)\n n = -(n//2)\n \nif x == '':\n print(0)\nelse:\n print(x)", 'n=int(input())\nx=""\nwhile n != 0:\n x = str(n%2) + x\n n = -(n//2)\nprint(0 if x == "" else x)\n'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s091981563', 's235933379', 's960371868', 's075654456'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0, 18.0] | [111, 98, 110, 98] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.