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
p03675
u077019541
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['n = int(input())\nAs= list(map(int,input().split()))\nback = As[::-2]\nif n%2==0:\n forward = As[::2]\nelse:\n forward = As[1::2]\nprint(back+forward)', 'n = int(input())\nAs= list(map(int,input().split()))\nback = As[::-2]\nif n%2==0:\n forward = As[::2]\nelse:\n forward = As[1::2]\nans = back+forward\np...
['Wrong Answer', 'Accepted']
['s867711262', 's332823591']
[26180.0, 30404.0]
[94.0, 112.0]
[149, 178]
p03675
u118642796
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['N = int(input())\nA = [int(a) for a in input().split()]\n\nprint(*([A[i] for i in range(N-1,-1,-2)]+[A[i] for i in range(2,N,2)])) \n', 'N = int(input())\nA = [int(a) for a in input().split()]\n\nprint(*([A[i] for i in range(N-1,-1,-2)]+[A[i] for i in range(N%2,N,2)])) ']
['Wrong Answer', 'Accepted']
['s972744960', 's513312941']
[26360.0, 26020.0]
[201.0, 192.0]
[130, 134]
p03675
u123648284
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['from collections import deque\n\nN = int(input())\nA = list(map(int, input().split()))\n\nq = deque()\nq.append(A[0])\nq.append(A[1])\nfor i in range(2, N):\n a = A[i]\n if i % 2 == 1:\n q.appendleft(a)\n else:\n q.append(a)\n\nprint(" ".join(map(str, q)))\n', 'from collections import deque\n\nN = int(input(...
['Runtime Error', 'Accepted']
['s209552425', 's868025272']
[29124.0, 29124.0]
[168.0, 175.0]
[251, 257]
p03675
u243492642
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['import collections\nn = int(input())\na = list(map(int, input().split()))\nb = collections.deque(list)\nif n % 2 == 0:\n for i, ele in enumerate(a):\n if i % 2 == 0:\n b.append(ele)\n else:\n b.appendleft(ele)\nelse:\n for i, ele in enumerate(a):\n if i % 2 == 0:\n ...
['Runtime Error', 'Accepted']
['s455151426', 's471674337']
[25412.0, 30176.0]
[70.0, 151.0]
[390, 960]
p03675
u364386647
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['n = int(input())\na = list(map(int, input().split()))\n\nb = []\n\nfor i in range(n):\n if i % 2 != n % 2:\n b.insert(0, a[i])\n else:\n b.append(a[i])\n\nfor i in range(n):\n print(b[i], end=" ")\n', 'n = int(input())\na = list(map(int, input().split()))\n\nb = []\n\nfor i in range(n):\n b....
['Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s496491776', 's725102268', 's839933888', 's931581469']
[26020.0, 26020.0, 26180.0, 29128.0]
[2104.0, 2104.0, 2104.0, 171.0]
[208, 163, 126, 230]
p03675
u375616706
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['N = int(input())\nA = list(map(int, input().split()))\n\nans = []\n\nl1 = A[0::2]\nl2 = A[1::2]\nif N % 2 == 0:\n l2 = l2[::-1]\n ans = l2+l1\nelse:\n l1 = l1[::-1]\n ans = l1+l2\n\nprint(" ".join(ans))\n', 'N = int(input())\nA = list(input().split())\n\nans = []\n\nl1 = A[0::2]\nl2 = A[1::2]\nif N % 2 ==...
['Runtime Error', 'Accepted']
['s206826702', 's369085332']
[26360.0, 27204.0]
[77.0, 61.0]
[201, 191]
p03675
u382748202
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['from operator import mul\nfrom functools import reduce\n\nn = int(input())\na = list(map(int, input().split()))\n\ndef com(n, k):\n if n == 0 or k == 0:\n return 1\n return int(reduce(mul, range(n + 1 - k, n + 1)) / reduce(mul, range(1, k + 1)))\n\nidx_list = [-1] * (n + 2)\nl = 0\nr = 0\nfor i, a_i in e...
['Runtime Error', 'Accepted']
['s958433426', 's451615077']
[25776.0, 31944.0]
[79.0, 147.0]
[735, 363]
p03675
u482969053
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['n = input()\nan = list(map(int, input().split()))\nb = []\n\nfor i in an:\n b.append(i)\n b.reverse()\n\nprint(b)\n', 'n = int(input())\na = list(input().split())\nif n == 1:\n print(a[0])\nelif n % 2:\n print(*(a[-1::-2] + a[1::2]))\nelse:\n print(*(a[-1::-2] + a[0::2]))\n']
['Wrong Answer', 'Accepted']
['s405737159', 's892091541']
[25156.0, 23332.0]
[2104.0, 116.0]
[112, 156]
p03675
u500297289
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
["n = int(input())\na = list(map(int, input().split()))\n\nb = []\nfor aa in a:\n b.append(aa)\n b.reverse()\n\nans = ''\nfor bb in b:\n ans += bb + ' '\n\nprint(ans[:-1])\n", "from collections import deque\n\nn = int(input())\na = list(input().split())\n\nb = deque()\nfor i in range(n):\n if i % 2 == 0:\n ...
['Runtime Error', 'Accepted']
['s107945912', 's397813296']
[25156.0, 26564.0]
[2106.0, 107.0]
[167, 236]
p03675
u536113865
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['f = lambda: list(map(int,input().split()))\nn = int(input())\na = f()\nif n&1:\n b = a[::-2]+a[1::2]\nelse:\n b = a[::-1]+a[::2]\nprint(*b)\n', 'ai = lambda: list(map(int,input().split()))\nai_ = lambda: [int(x)-1 for x in input().split()]\n\n\nn = int(input())\na = ai()\nMOD = 10**9+7\n\nfrom collections impor...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s339529501', 's987702829', 's670681365']
[25156.0, 35648.0, 26020.0]
[221.0, 202.0, 171.0]
[139, 823, 139]
p03675
u667084803
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['import math\nN=int(input())\na=list(map(int,input().split()))\nc=[]\nfor i in range(N+1):\n if a[i] in c:\n b=a[i]\n j=c.index(a[i])\n k=i\n L=j+N-k\n break\n c+=[a[i]]\nBase=N+1\nMinu=1\nfor i in range(0,min(L+1,N+1)):\n print((Base-Minu)%(10**9+7))\n Base=int(Base*(N-i)/(i+2))\n Minu=int(Minu*(L...
['Runtime Error', 'Accepted']
['s769623945', 's352034971']
[25156.0, 29768.0]
[2104.0, 171.0]
[524, 292]
p03675
u676264453
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['n = int(input())\nl = list(map(int, input().split()))\nk = []\n\nfor i in range(n):\n k.append(l[i])\n k = list(reversed(k))\n\nprint(",".join(map(str, k)))', 'from collections import deque\n\nn = int(input())\nl = list(map(int, input().split()))\nd = deque()\n\nfor i in range(n):\n if (i % 2 == 0):\n d.appendl...
['Wrong Answer', 'Accepted']
['s910540744', 's057285957']
[26180.0, 29252.0]
[2105.0, 161.0]
[150, 251]
p03675
u751717561
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
["n = int(input())\nx = list(input().split()) \na = ''.join(x)\n\nif n == 1:\n print(a)\n exit()\n\ns1 = a[::2] \ns2 = a[1::2] \n\ns2 = s2[::-1]\n\ns = s2 + s1\n\nif n%2 == 1:\n s = s[::-1]\n\nfor i in s:\n print(int(i), end=' ')\n", 'n = int(input())\na = list(map(int,input().split()))\nb = []\nc = ...
['Wrong Answer', 'Accepted']
['s547516279', 's393877958']
[30004.0, 26020.0]
[2105.0, 223.0]
[254, 228]
p03675
u780475861
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
["import sys\nn, *alst = map(int, sys.stdin.read().split())\nlst1 = alst[::2]\nlst2 = alst[1::2]\nif n % 2:\n lst1.reverse()\n print(''.join(lst1 + lst2))\nelse:\n lst2.reverse()\n print(''.join(lst2 + lst1))", "n = int(input())\nalst = input().split()\nlst1 = alst[::2]\nlst2 = alst[1::2]\nif n % 2:\n lst1.reverse...
['Runtime Error', 'Accepted']
['s735511894', 's414107710']
[25180.0, 26616.0]
[71.0, 49.0]
[201, 187]
p03675
u970449052
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
['n=int(input())\na=list(map(int,input().split()))\na1=[]\nfor i in range(n-1,-1,-2):\n a1.append(a[i])\na2=[]\nfor i in range(n-2,-1,-2):\n a2.append(a[i])\na2.reverse\na1+=a2\nprint(*a1)', 'n=int(input())\na=list(map(int,input().split()))\na1=[]\nfor i in range(n-1,-1,-2):\n a1.append(a[i])\na2=[]\nfor i in ...
['Wrong Answer', 'Accepted']
['s318483060', 's112113933']
[26360.0, 26356.0]
[196.0, 198.0]
[182, 184]
p03675
u985443069
2,000
262,144
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b. The i-th operation is as follows: 1. Append a_i to the end of b. 2. Reverse the order of the elements in b. Find the sequence b obtained after these n operations.
["import sys\n\n\n\n\n\ndef read_int_list():\n return list(map(int, input().split()))\n\n\ndef read_int():\n return int(input())\n\n\ndef read_str_list():\n return input().split()\n\n\ndef read_str():\n return input()\n\n\ndef solve():\n n = read_int()\n a = read_int_list()\n b = [0] * n\n p = 0...
['Wrong Answer', 'Accepted']
['s366915217', 's887793573']
[29216.0, 29344.0]
[153.0, 152.0]
[611, 619]
p03676
u218843509
2,000
262,144
You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence. For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given s...
['MOD = (10 ** 9) + 7\n\nf_list = [1] * 100001\nf_r_list = [1] * 100001\n\nfor i in range(100000):\n\tf_list[i + 1] = int((f_list[i] * (i + 2)) % MOD)\n\ndef power(n, x):\n\tif x == 1:\n\t\treturn n\n\telif x % 2 == 0:\n\t\treturn power(int((n * n) % MOD), int(x / 2))\n\telse:\n\t\treturn int((n * power(n, x - 1)) % MO...
['Runtime Error', 'Accepted']
['s095134310', 's056555186']
[3064.0, 21748.0]
[17.0, 374.0]
[889, 890]
p03676
u329749432
2,000
262,144
You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence. For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given s...
['from scipy.misc import comb\n\nn=int(input())\ns=[int(i) for i in input().split()]\nfor i in range(1,n+1):\n k=s.count(i)\n if k==2:\n a=s.index(i)\n b=s.index(i,a+1)\n\nfor i in range(1,n+2):\n print(comb(n+1,i,1)-comb(a+n-b,i-1,1))\n', 'import scipy.misc as scm\nfrom collections import Counte...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s251382568', 's299725596', 's716773520', 's730519912', 's208168923']
[23992.0, 28196.0, 23992.0, 23904.0, 27752.0]
[2109.0, 2112.0, 2109.0, 2109.0, 456.0]
[246, 321, 281, 487, 704]
p03676
u458486313
2,000
262,144
You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence. For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given s...
['import sys\n\nstdin = sys.stdin\n\nns = lambda: stdin.readline()\nni = lambda: int(ns())\nna = lambda: list(map(int,stdin.readline().split()))\n\nMOD = 10**9+7\n\nclass Comb:\n def __init__(self, size):\n self.fact = [0 for i in range(size + 1)]\n self.inv_fact = [0 for i in range(size + 1)]\n ...
['Wrong Answer', 'Accepted']
['s038538593', 's615987718']
[20528.0, 20456.0]
[758.0, 760.0]
[1191, 1180]
p03676
u497046426
2,000
262,144
You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence. For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given s...
['# ARC 77 D\nMOD = 10**9 + 7\nn = int(input())\nA = list(map(int, input().split()))\n\nfact = {i: None for i in range(n+1)} # n!\ninverse = {i: None for i in range(1, n+1)} # inverse of n in the field Z/(MOD)Z\nfact_inverse = {i: None for i in range(n+1)} # inverse of n! in the field Z/(MOD)Z\n\...
['Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s770826903', 's842641173', 's497102205']
[50780.0, 351360.0, 51804.0]
[216.0, 2117.0, 509.0]
[998, 1004, 1647]
p03676
u536113865
2,000
262,144
You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence. For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given s...
['ai = lambda: list(map(int,input().split()))\nai_ = lambda: [int(x)-1 for x in input().split()]\n\nn = int(input())\na = ai()\n\ndup = sum(a)-n*(n+1)//2\nant = a.index(dup)\npost = a[::-1].index(dup)\nprint(ant,post)\n\nmod = 10**9+7\nfactorial = [1]\nfor i in range(1,n+2):\n factorial.append(factorial[i-1]*i %mod)...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s140177456', 's518593985', 's798095520']
[16484.0, 20064.0, 16484.0]
[307.0, 367.0, 322.0]
[744, 696, 728]
p03676
u559823804
2,000
262,144
You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence. For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given s...
['from operator import mul\nfrom functools import reduce\nmod=10**9+2\ndef cmb(n,r):\n if r>n: return 0\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n\n\nn=int(input())\na=list(map(int,input().split()))\ns...
['Wrong Answer', 'Accepted']
['s270764510', 's238590196']
[14436.0, 24404.0]
[2104.0, 404.0]
[525, 746]
p03676
u766684188
2,000
262,144
You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence. For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given s...
['import sys\ninput=sys.stdin.readline\nsys.setrecursionlimit(10**9)\nfrom collections import Counter\nmod=10**9+7\nn=int(input())\nA=list(map(int,input().split()))\nfactorial=[1]\nfor i in range(1,n+2):\n factorial.append(factorial[i-1]*i%mod)\ninverse=[0]*(n+2)\ninverse[n+1]=pow(factorial[n+1],mod-2,mod)\nfor i in...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s177891024', 's246471968', 's318437561']
[29980.0, 29972.0, 29980.0]
[374.0, 371.0, 367.0]
[628, 637, 619]
p03676
u777923818
2,000
262,144
You are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n. It is known that each of the n integers 1,...,n appears at least once in this sequence. For each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given s...
['# -*- coding: utf-8 -*-\nfrom math import factorial\nfrom scipy.misc import comb\ndef inpl(): return tuple(map(int, input().split()))\n\ndef combination(n, r):\n if n < r:\n return 0\n else:\n return factorial(n)//(factorial(r) * factorial(n-r))\n\nn = int(input())\nA = inpl()\nC = ["" for i in ra...
['Time Limit Exceeded', 'Accepted']
['s337479455', 's829851129']
[24004.0, 21024.0]
[2109.0, 679.0]
[569, 622]
p03684
u059586440
2,000
262,144
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates. You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (the currency of Japan). It is not possible to build other types of road...
['n = int(input())\nxs = []\nys = []\n\nfor i in range(n):\n x, y = map(int, input().split())\n xs.append((x, i))\n ys.append((y, i))\n\n\nxs.sort()\nys.sort()\n\nes = []\n\nfor i in range(n-1):\n es.append((xs[i+1][0] - xs[i][0], xs[i][1], xs[i+1][1]))\n es.append((ys[i+1][0] - ys[i][0], ys[i][1], ys[i+...
['Wrong Answer', 'Accepted']
['s033808910', 's262063616']
[50248.0, 58356.0]
[1016.0, 1720.0]
[865, 908]
p03684
u104282757
2,000
262,144
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates. You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (the currency of Japan). It is not possible to build other types of road...
['# D\nimport numpy as np\nN = int(input())\nX = np.zeros(N, dtype=int)\nY = np.zeros(N, dtype=int)\n\nfor i in range(N):\n x, y = map(int, input().split())\n X[i] = x\n Y[i] = y\n\n# edges\nX_s = np.argsort(X)\nY_s = np.argsort(Y)\n\nedge_list = []\nedge_weight = []\nfor i in range(N-1):\n edge_list.append...
['Runtime Error', 'Runtime Error', 'Accepted']
['s380072078', 's799959648', 's425422743']
[78600.0, 75548.0, 74088.0]
[1391.0, 1347.0, 1986.0]
[1255, 1321, 1073]
p03684
u231685196
2,000
262,144
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates. You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (the currency of Japan). It is not possible to build other types of road...
['\n\n\nclass uf_tree():\n\n def __init__(self,n):\n self.n = n\n self.par = [i for i in range(n)]\n\n def indep(self):\n dep =0\n for i in range(self.n):\n if i == self.par[i]:\n dep += 1\n\n return dep\n\n def unite(self,child,mas):\n if sel...
['Wrong Answer', 'Accepted']
['s568673150', 's989482792']
[3192.0, 55196.0]
[18.0, 1602.0]
[1646, 1726]
p03684
u497046426
2,000
262,144
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates. You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (the currency of Japan). It is not possible to build other types of road...
["from collections import defaultdict\nfrom heapq import *\n\ndef prim(V, E):\n '''\n Input:\n V = list(range(N))\n E = {i: defaultdict(int) for i in range(N)}\n Output:\n the edges of the minimum weight tree and its weight\n '''\n N = len(V)\n weight = 0; edges = [];\n used = ...
['Wrong Answer', 'Accepted']
['s667371077', 's661137869']
[88592.0, 87180.0]
[1309.0, 1419.0]
[1234, 1272]
p03684
u835482198
2,000
262,144
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates. You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (the currency of Japan). It is not possible to build other types of road...
['s UnionFind(object):\n\n def __init__(self, n):\n self.n = n\n self.par = list(range(n))\n self.rank = [1] * n\n\n def is_same(self, a, b):\n return self.root(a) == self.root(b)\n\n def root(self, x):\n if self.par[x] == x:\n return x\n self.par[x] = self....
['Runtime Error', 'Accepted']
['s119362788', 's860787010']
[2940.0, 54544.0]
[17.0, 1464.0]
[1170, 1174]
p03684
u884087839
2,000
262,144
There are N towns on a plane. The i-th town is located at the coordinates (x_i,y_i). There may be more than one town at the same coordinates. You can build a road between two towns at coordinates (a,b) and (c,d) for a cost of min(|a-c|,|b-d|) yen (the currency of Japan). It is not possible to build other types of road...
["#!/usr/bin/env python3\nimport sys\n\nclass UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n \n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n retur...
['Runtime Error', 'Runtime Error', 'Accepted']
['s278127755', 's372303998', 's153342446']
[49320.0, 72408.0, 47320.0]
[601.0, 1122.0, 1430.0]
[3257, 3292, 2369]
p03687
u021548497
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['s = input()[:-1]\nalphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]\n\nans = len(s)\nfor i in range(26):\n k = s.count(alphabet[i])\n ans = min(ans, len(s)-k)\nprint(ans)', 's = input()[:-1]\nalphabet = ["a", "b", "c", "d", ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s077413380', 's824150058', 's915377938']
[9024.0, 9096.0, 9112.0]
[29.0, 55.0, 48.0]
[257, 558, 689]
p03687
u039623862
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
["s = input()\nn = len(s)\nmin_t = float('inf')\nfor i in range(n):\n target = s[i]\n pre = 0\n max_t = 0\n for j in range(n):\n if s[j] == s[i]:\n max_t = max(max_t, j-pre-1)\n pre = j\n max_t = max(max_t, n - pre-1)\n if max_t < min_t:\n min_t = min(min_t, max_t)\...
['Wrong Answer', 'Accepted']
['s452351236', 's271697239']
[3064.0, 9876.0]
[21.0, 55.0]
[317, 596]
p03687
u057993957
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['from collections import Counter\ns = input()\ncnt = Counter(s).most_common()\nprint(cnt)\n\nmins = len(s) - 1\nfor k, v in cnt:\n if v != 1:\n ind = 0\n dist = []\n for i in range(len(s)):\n if k == s[i]:\n dist.append(i-ind+1) \n ind = i\n mins ...
['Wrong Answer', 'Accepted']
['s357799901', 's981377925']
[3316.0, 2940.0]
[21.0, 17.0]
[338, 107]
p03687
u125545880
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['import sys\n\nsys.setrecursionlimit(10**6)\n\ndef handling(string, letter):\n global cnt\n cnt += 1\n for i, r in enumerate(string):\n if r == letter and 0 < i < len(string):\n if string[i-1] != letter:\n string[i-1] = letter\n elif i < len(string)-1:\n ...
['Wrong Answer', 'Accepted']
['s287615260', 's406224046']
[3064.0, 3064.0]
[25.0, 36.0]
[828, 696]
p03687
u151785909
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
["s = input()\na = [[0] for i in range(26)]\n\nfor i in range(len(s)):\n a[ord(s[i])-ord('a')].append(i)\n\nfor i in range(26):\n a[i].append(len(s)-1)\n\nans = float('inf')\nfor i in range(26):\n ma = 0\n for j in range(1,len(a[i])):\n dis = a[i][j]-a[i][j-1]-1\n ma = max(dis,ma)\n ans = m...
['Wrong Answer', 'Accepted']
['s006979868', 's803437396']
[3064.0, 3064.0]
[18.0, 18.0]
[326, 325]
p03687
u163320134
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
["check='abcdefghijklmnopqrstuvwxyz'\ns=input()\nl=len(s)\npos=[0]*26\nfor i in range(l):\n for j in range(26):\n if s[i]==check[j]:\n pos[j].append(i)\nans=10**9:\n for i in range(26):\n tmp=0\n for j in range(len(pos[i])-1):\n tmp=max(tmp,pos[i][j+1]-pos[i][j])\n tmp=max(tmp,(l-1)-pos[i][-1])\...
['Runtime Error', 'Accepted']
['s852482623', 's477013670']
[2940.0, 3064.0]
[17.0, 18.0]
[336, 342]
p03687
u177481830
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['s=input()\nprint(s)', 's=input()\n\nminCost=len(s)\nfor char in char_set:\n m=max([len(_) for _ in s.split(char)])\n if m<minCost:\n minCost=m\nprint(minCost)', 's=input()\n\nminCost=len(s)\nchar_set=set(s)\nfor char in char_set:\n m=max([len(_) for _ in s.split(char)])\n if m<minCost:\n min...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s271083404', 's333673249', 's304119948']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[18, 172, 188]
p03687
u227082700
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['s=input()\nans=len(s)\ndef a(s,t):\n ss=""\n a=0\n b=False\n for i in range(len(s)-1):\n if s[i]!=t!=s[i+1]:ss+=s[i];b=True\n else:ss+=t\n if b:a=a(ss,t)\n return a+1\nfor i in s:ans=min(ans,a(s,i))\nprint(ans)', 's=input()\nse=set(list(s))\nx=len(s)\nfor i in se:\n a=b=0\n for j in s:\n if i==j:a=0\...
['Runtime Error', 'Accepted']
['s392724576', 's233852479']
[3064.0, 2940.0]
[17.0, 18.0]
[210, 132]
p03687
u252828980
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['s = input()#print(len(s))\nnum = []\n\nli1 = []\nn = 0\nwhile n < len(s):\n \n li2 = []\n for i in range(len(s)):\n if s[i] == s[n]:\n li2.append(i)\n #print(li2)\n if len(li2) == 1:\n num.append(li2[0])\n break\n elif len(li2) >=2: \n idx = li2[0]\n ...
['Wrong Answer', 'Accepted']
['s205106235', 's353592391']
[3064.0, 9160.0]
[23.0, 169.0]
[500, 593]
p03687
u256868077
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['s=input()\nl=len(s)\na=[1]*(l+1)\nc=[]\nx=0\nwhile(x<=l-1):\n if(a[x]==1):\n a[x]=0\n k=0\n b=[x-1]\n t=s+s[x]\n for i in range(x+1,l+1):\n if(t[x]==t[i]):\n b.append(k)\n a[i]=0\n k=0\n else:\n k+=1\n c.append(max(b))\n x+=1\nprint(min(c))', 's=input()\nl=len...
['Wrong Answer', 'Accepted']
['s470576215', 's565407024']
[3064.0, 3064.0]
[18.0, 17.0]
[278, 276]
p03687
u263830634
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['s = list(input())\nN = len(s)\nif N == 1:\n print (0)\n exit()\n\n ans = 99\nfor i in range(1, N): \n tmp = 0 \n count = 0 \n for j in range(i):\n if s[j] == s[i]:\n tmp = max(tmp, count)\n count = 0\n else:\n count += 1\n tmp = max(tmp, count)\n ...
['Runtime Error', 'Accepted']
['s517012773', 's850335938']
[3064.0, 3064.0]
[17.0, 19.0]
[466, 462]
p03687
u278356323
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
["s = input()\nprint(s.count('r'))\n\n\ndef calc(s, a):\n if s.count(a) == len(s):\n return 0\n ns = s[:-1]\n for i in range(len(s)-1):\n if s[i] == a or s[i+1] == a:\n ns[i] = a\n return 1+calc(ns, a)\n\n\n# for a in list('abcdefghijklmnopqrstuvwxyz'):\n# print(a)\n", 'from coll...
['Wrong Answer', 'Accepted']
['s928774580', 's239120467']
[2940.0, 3316.0]
[17.0, 34.0]
[289, 349]
p03687
u309977459
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['#s = input()\ns = "zzz"\ns = "whbrjpjyhsrywlqjxdbrbaomnw"\nf = {}\ng = {}\n\nchars = [c for c in s]\n#print(chars)\n\nfor char in chars:\n f[char] = []\n f[char].append(-1)\n for i, c in enumerate(s):\n if(c==char):\n f[char].append(i)\n f[char].append(len(s))\n\nmax_len_all = len(s)\nfo...
['Wrong Answer', 'Accepted']
['s456105633', 's446011185']
[3064.0, 3064.0]
[17.0, 23.0]
[569, 525]
p03687
u323680411
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['import sys\n\n\ndef next_str() -> str:\n result = ""\n while True:\n tmp = sys.stdin.read(1)\n if tmp.strip() != "":\n result += tmp\n elif tmp != \'\\r\':\n break\n return result\n\n\ndef main() -> None:\n s = next_str()\n dic = [set() for _ in range(len(s))]...
['Wrong Answer', 'Accepted']
['s157957700', 's598539742']
[3064.0, 3064.0]
[19.0, 19.0]
[789, 773]
p03687
u354638986
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
["def main():\n s = input()\n c_set = set(s)\n\n min_c = len(s)\n for i in range(len(s)):\n if s[i] in c_set:\n max_c, f_idx = i, i\n for j in range(i+1, len(s)):\n if s[i] == s[j] or j == len(s) - 1:\n if max_c < j - f_idx - 1:\n ...
['Wrong Answer', 'Accepted']
['s900588511', 's268000131']
[3064.0, 3064.0]
[18.0, 18.0]
[520, 469]
p03687
u374531474
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['from collections import Counter\n\ns = list(input())\n\nc = Counter(s)\nmc = c.most_common()\nlen_s = len(s)\nans = len_s\nfor l, n in mc:\n if n != mc[0][1]:\n break\n prev = 0\n x = 0\n for i in range(len_s):\n if s[i] == l:\n x = max(x, i - prev)\n prev = i + 1\n ...
['Wrong Answer', 'Accepted']
['s497536388', 's554191079']
[3316.0, 2940.0]
[21.0, 18.0]
[349, 78]
p03687
u405256066
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['from sys import stdin\ns= (stdin.readline().rstrip())\nf = lambda a, b: abs(a-b-1)\ndiff = lambda ls: map(f, ls[1:], ls)\n\nans = 100\nfor i in set(s):\n indexes = [j for j,x in enumerate(list(s)) if x == i]\n indexes = [0] + indexes + [len(s)]\n index_diff = list(diff(indexes))\n ans = min(ans,max(max(in...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s120566953', 's421971274', 's274522662']
[3064.0, 3064.0, 3060.0]
[17.0, 18.0, 17.0]
[363, 483, 209]
p03687
u453642820
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['S=input()\nA="abcdefghijklmnopqrstuvwxyz"\nminimum=len(S)//2\nfor a in A:\n maximum=0\n for s in S:\n p=-1\n if a==s:\n maximum=max(p-1,maximum)\n p=0\n else:\n p+=1\n minimum=min(maximum,minimum)\nprint(minimum)', 'S=input()\nA="abcdefghijklmnopqrstuvwxy...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s010263432', 's086940338', 's092113759', 's774518824']
[3060.0, 3060.0, 3316.0, 3060.0]
[17.0, 17.0, 21.0, 17.0]
[262, 276, 361, 282]
p03687
u455591217
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
["\nimport sys\n\ndef judgeUpper(ansList, var):\n for a in ansList:\n if int(a) > var:\n# print(a + ':' + str(var) + str(True))\n return True\n return False\ndef judgeEqual(ansList, var, N):\n count = ansList.count(str(var))\n# print(str(count) + ':' + str(N-1) + str(count < N...
['Runtime Error', 'Accepted']
['s785255850', 's587681264']
[3188.0, 3064.0]
[17.0, 38.0]
[853, 517]
p03687
u500297289
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
["s = input()\nl = set(list(s))\nN = len(s)\nn = len(s)\nans = 0\n\nfor ll in l:\n S = s\n while n > 0:\n tmp = ''\n for i in range(n - 1):\n if S[i] == ll or S[i + 1] == ll:\n tmp += ll\n else:\n tmp += S[i]\n if len(set(tmp)) == 1:\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s252460630', 's309511823', 's783768469', 's777046932']
[3064.0, 3444.0, 3064.0, 3064.0]
[19.0, 141.0, 20.0, 136.0]
[398, 422, 393, 449]
p03687
u593567568
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['from collections import Counter\n\nS = input()\nuni_s = list(set(list(S)))\n\nans = len(S) - 1\n\n# -1,1\nfor s in uni_s:\n L = len(S)\n T = list(S)\n all_same = [s == t for t in S]\n cnt = 0\n while not all(all_same):\n newT = [False] * (L-1)\n for i in range(L):\n t = T[i]\n if s == t:\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s286421990', 's414024741', 's506562296']
[3316.0, 3064.0, 3192.0]
[21.0, 64.0, 71.0]
[592, 594, 607]
p03687
u594329566
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['def solve (a , d):\n c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\n old =a\n a=""\n for i in old:\n c[ord(i)-97]+=1\n if len(old) == max(c):\n return 0\n for i in range(len(old)-2):\n if old[i]==d or old[i+1]==d:\n a+=d\n else :\n a+=o...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s631406502', 's674969615', 's511807277']
[3064.0, 3064.0, 3188.0]
[19.0, 19.0, 116.0]
[636, 593, 579]
p03687
u619819312
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['s=list(input())\np=[chr(ord("a")+i)for i in range(26)]\nq=100\nif len(list(set(d)))==1:\n print(0)\nelse:\n for i in range(26):\n t=p[i]\n d=s[:]\n c=0\n while len(d)>0:\n c+=1\n for j in range(len(d)-1):\n if d[j]==t or d[j+1]==t:\n ...
['Runtime Error', 'Accepted']
['s713923091', 's650419438']
[3064.0, 3064.0]
[18.0, 48.0]
[471, 471]
p03687
u623687794
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['s=input()\nans=1000\nfor i in range(26):\n if chr(97+i) not in s:continue\n S=s\n cnt=0\n while(len(set(S)))!=1:\n cnt+=1\n t=""\n for j in range(len(S)-1):\n if S[j] == chr(97+i) or S[j+1] == chr(97+i):\n t+=chr(97+i)\n else:\n t+=S[j]\n ans=min(cnt,ans)\nprint(ans)', 's=input()...
['Time Limit Exceeded', 'Accepted']
['s678434882', 's505406075']
[3064.0, 3064.0]
[2103.0, 68.0]
[290, 299]
p03687
u624475441
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['S = input()\nans = min(max(map(len, S.split(c)))\n for c in [chr(i + 97) for i in range(26)]\n if c not in S))\nprint(ans)', 'S = input()\nans = min(max(map(len, S.split(c)))\n for c in [chr(i + 97) for i in range(26)]\n if c not in S)\nprint(ans)', 'S = input()\nans = min(max(map(...
['Runtime Error', 'Runtime Error', 'Accepted']
['s027369558', 's092047056', 's200444093']
[2940.0, 2940.0, 2940.0]
[18.0, 18.0, 18.0]
[136, 135, 131]
p03687
u626468554
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['S = list(input())\ndis = [0 for i in range(26)]\nmm = [0 for i in range(26)]\n\nfor i in range(len(S)):\n wd = ord(S[i])-97\n dis[wd] = max(dis[wd],i-mm[wd]-1)\n mm[wd] = i\n\nfor i in range(26):\n dis[i] = max(dis[i],len(S)-mm[i]-1)\nprint(min(dis))', 'S = list(input())\ndis = [0 for i in range(26)]\nmm ...
['Wrong Answer', 'Accepted']
['s082964274', 's520541824']
[3064.0, 3064.0]
[18.0, 17.0]
[251, 265]
p03687
u629350026
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['s=str(input())\nimport collections\nc=collections.Counter(s)\ntemp=c.most_common()[0][0]\ntempc=c.most_common()[0][1]\nl=len(s)\na=0\ncnt=0\nfor i in range(l):\n if s[i]!=temp:\n cnt=cnt+1\n else:\n a=max(a,cnt)\n cnt=0\na=max(a,cnt)\nprint(a)', 's=str(input())\nl=len(s)\nans=99999999999\nfor j in s:\n te...
['Wrong Answer', 'Accepted']
['s265387072', 's130547215']
[3316.0, 3064.0]
[23.0, 19.0]
[239, 214]
p03687
u676264453
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['\nS = str(input())\n\nc = 0\nma = 0\nfor i in S:\n c = 0\n for k,j in enumerate(S):\n if ( k != 0 and k != N-1 and j != i and S[k-1] != a and S[k+1] != a):\n c += 1\n ma = min(ma, c)\n\nprint(ma)\n\n\n', '\n S = str(input())\n\n c = 0\n ma = 0\n for i in S:\n c = 0\n for k,j in enum...
['Runtime Error', 'Runtime Error', 'Accepted']
['s700341936', 's720982567', 's974860591']
[2940.0, 2940.0, 3064.0]
[17.0, 18.0, 116.0]
[213, 225, 413]
p03687
u691018832
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
["import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10 ** 7)\n\ns = input()\nlen_s = len(s)\ncnt = [0] * 26\nal = [chr(ord('a') + i) for i in range(26)]\nans = [''] * (len_s + 1)\nans[0] = s\nfor i in range(26):\n check = lis...
['Wrong Answer', 'Accepted']
['s656850982', 's315987573']
[3064.0, 3436.0]
[82.0, 44.0]
[869, 828]
p03687
u692632484
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
["s=input()\ns.lower()\n\na=[0 for i in range(26)]\nfor i in s:\n\ta[ord(i)-ord('a')]+=1\ntest=max(a)\n\nprint(len(s)-test)", 's=input()\n\nans=int(len(s)/2)\nfor i in range(26):\n\ttemp=0\n\ttempAns=0\n\tif s.count(chr(i+97))!=0:\n\t\tfor j in s:\n\t\t\tif j==chr(i+97):\n\t\t\t\ttempAns=max(temp,tempAns)\n\t\t\t\ttemp...
['Wrong Answer', 'Accepted']
['s921375370', 's631098823']
[2940.0, 3064.0]
[18.0, 18.0]
[112, 270]
p03687
u729133443
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['from subprocess import*\nwith open(\'Main.java\',\'w\')as f:f.write(r\'\'\'\nimport java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] s = sc.next().split("");\n\t\tString[] v = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s338252279', 's781127590', 's711065907']
[58376.0, 58012.0, 2940.0]
[1062.0, 1062.0, 18.0]
[1014, 1014, 56]
p03687
u745087332
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['# coding:utf-8\n\nfrom collections import Counter\n\n\ndef inpl(): return list(map(int, input().split()))\n\n\nS = input()\nC = Counter(S)\nif len(S) == 1:\n print(0)\n exit()\n\nans = 100\nfor key in C.keys():\n prev_S = list(S)\n cnt = 0\n t = len(S) - 1\n while t > 0:\n if all([1 if s == k...
['Wrong Answer', 'Accepted']
['s828904139', 's302984127']
[3316.0, 3316.0]
[61.0, 35.0]
[636, 799]
p03687
u749614185
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['S = input()\na = 1000 \nfor i in range (len(S)):\n A = B = 0\n for j in range (1, len(S) + 1):\n if S[i] == S[len(S)-j]:\n A = 0\n else:\n A += 1\n B = max(A,B)\n a = min(A,B)\nprint(a)', 'S = input()\nval = 10**9\n \nvoc = set(S)\nfor c in voc:\n cnt = 0\n tm...
['Wrong Answer', 'Accepted']
['s071082103', 's777632509']
[9036.0, 9132.0]
[30.0, 44.0]
[226, 346]
p03687
u757584836
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
["s = input()\nc = [0]*26\nv = []\nm = 0\nfor i in range(0, len(s)):\n c[(int)s[i]-'a'] += 1\nfor i in range(0, 26):\n m = max(m, c[i])\nfor i in range(0, 26):\n if c[i] == m:\n v.append((char)'a'+i)\na = 10000\nfor i in range(0, len(c)):\n n = 0\n t = 0\n for j in range(0, len(s)):\n if s[j] != v[i]:\n ...
['Runtime Error', 'Accepted']
['s056644039', 's477645947']
[2940.0, 3064.0]
[17.0, 18.0]
[394, 279]
p03687
u785989355
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
["def itoa(i):\n alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o',\n 'p','q','r','s','t','u','v','w','x','y','z']\n return alphabet[i]\ns = input()\nscore_list = []\nfor i in range(26):\n c = itoa(i)\n prev = -1\n score = 0\n flag=False\n for j in range(len(s))...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s101701150', 's414748141', 's762420777']
[3064.0, 3064.0, 3064.0]
[19.0, 18.0, 18.0]
[552, 533, 391]
p03687
u794543767
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['from collections import Counter\ns = input()\ncounter = Counter(s)\ntarget = counter.most_common()[0][0]\nj = 0\nwhile(1):\n if len(set(s)) == 1:\n break\n new_s = ""\n for i in range(len(s)-1):\n if s[i] == target or s[i+1] == target:\n new_s +=target\n else:\n new...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s133338191', 's508456482', 's682274516', 's597801439']
[3316.0, 3064.0, 3316.0, 3064.0]
[21.0, 24.0, 20.0, 41.0]
[348, 399, 352, 432]
p03687
u817328209
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['S = input()\n\nfor c in string.lowercase :\n if c not in S :\n continue\n\n X = S.split(c)\n ans = 0\n for str in X :\n ans = max(ans, len(str))\n\nprint(ans)', 'S = input()\nchars = set(S)\nans = len(S)\n\nfor c in chas :\n m = max(len(_) for _ in S.split(c))\n ans = min(ans, m)\n\npr...
['Runtime Error', 'Runtime Error', 'Accepted']
['s238955231', 's520588623', 's044578849']
[2940.0, 3060.0, 3060.0]
[17.0, 18.0, 18.0]
[173, 130, 131]
p03687
u861141787
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['s = input()\nans = float("inf")\nfor i in range(26):\n c = chr(ord("a")+i)\n if c not in s:\n continue\n temp = s\n count = 0\n while set(temp) != {c}:\n t = ""\n for j in range(len(temp)-1):\n if temp[j] == c or temp[j+1] == c:\n t += c\n else:\n t += "#"\n temp = t\n coun...
['Wrong Answer', 'Accepted']
['s325087148', 's021840357']
[3064.0, 3060.0]
[47.0, 51.0]
[359, 453]
p03687
u879870653
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['S = input()\nP = list(set(P))\nANS = []\nfor i in range(len(P)) :\n T = list(S.split(P[i]))\n U = []\n for j in range(len(T)) :\n U.append(len(T[j]))\n ANS.append(max(U))\nprint(min(ANS))\n', 'S = input()\nP = list(set(S))\nANS = []\nfor i in range(len(P)) :\n T = list(S.split(P[i]))\n U = []...
['Runtime Error', 'Accepted']
['s857503330', 's346480960']
[2940.0, 2940.0]
[17.0, 17.0]
[198, 198]
p03687
u921773161
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['import statistics\nimport math\n\nl = list(input())\n\nmode = statistics.mode(l)\nmode = l.count(mode)\n\ncheck = 0\n\n\n\nfor i in range(len(l)):\n if mode * (2**i) >= len(l) -i :\n ans = i\n break\n\nprint(ans)', 'import collections\ns = list(input())\n#print(s)\nc = collections.Counter(s)\nl = li...
['Runtime Error', 'Accepted']
['s846543027', 's046143067']
[5276.0, 3316.0]
[39.0, 24.0]
[250, 655]
p03687
u945418216
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['from collections import Counter\nss = input()\n\nans = 1000\ncandidates = set(ss)\nfor s in candidates:\n count = 0\n t = list(ss)\n while True:\n t = [t[i] if t[i+1] != s else t[i+1] for i in range(len(t)-1)]\n print(count, s, t)\n if len(set(t))==1:\n ans = min(ans, count)\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s201544339', 's714704048', 's798669623']
[14392.0, 3316.0, 3316.0]
[2104.0, 2104.0, 37.0]
[352, 325, 325]
p03687
u995062424
2,000
262,144
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule: * For each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t. There is a string s consisting of lowercase English letters. Snuke's objective is to apply the above operati...
['s = input()\nal = set(list(s)) \nans = 100\n\nfor c in al:\n L = list(s.split(c))\n print(L)\n tmp = 0\n for st in L:\n tmp = max(tmp, len(st))\n \n \n ans = min(tmp, ans)\n #print(ans)\nprint(ans)', 's = input()\nal = set(list(s)) \nans = 100\n\nfor c in al:\n L = list(s.split...
['Wrong Answer', 'Accepted']
['s231633314', 's245809492']
[3060.0, 3060.0]
[17.0, 17.0]
[270, 257]
p03688
u021548497
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['import sys\ninput = sys.stdin.readline\n\ndef main():\n n = int(input())\n a = list(map(int, input().split()))\n \n M, m = max(a), min(a)\n c = a.count(m)\n C = a.count(M)\n \n if M == m:\n if n//2 >= m:\n judge = True\n else:\n judge = False\n else:\n ...
['Wrong Answer', 'Accepted']
['s922098547', 's939066864']
[20668.0, 20796.0]
[57.0, 55.0]
[491, 606]
p03688
u102461423
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
["import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\nA = sorted(map(int, readline().split()))\n\ndef main(A):\n N = len(A)\n if A[0] == A[-1]:\n x = A[0]\n return x == N - 1 or 2 * x <= N\n if A[0] + 1 !...
['Wrong Answer', 'Accepted']
['s943660382', 's527986530']
[18348.0, 18344.0]
[50.0, 51.0]
[520, 520]
p03688
u128646083
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
["n=int(input())\na=list(map(int,input().split()))\nb=sorted(a)\nc=0\nif(b[n-1]-b[0]>1):\n print('No')\nelif(b[n-1]-b[0]==0):\n if(1<=b[0]<=n//2 or b[0]==n-1):\n print('Yes')\n else:\n print('No')\nelse:\n for i in range(n-1):\n if(b[i]<b[i+1]):\n c=i\n break\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s116687340', 's118971817', 's154894639']
[14092.0, 14092.0, 14092.0]
[58.0, 58.0, 59.0]
[428, 429, 427]
p03688
u148423304
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['n = int(input())\na = list(map(int, input().split()))\nimport collections\nl1 = collections.Counter(a).most_common()\nl1.sort()\nif len(l1) > 2\u3000or l1[1][0] - l1[0][0] > 1:\n print("No")\nelif len(l1) == 1:\n if l1[0][0] * 2 <= n or l1[0][0] == n - 1:\n print("Yes")\n else:\n print("No")\ne...
['Runtime Error', 'Accepted']
['s675215058', 's561415250']
[2940.0, 21360.0]
[17.0, 79.0]
[571, 596]
p03688
u163320134
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
["n=int(input())\narr=list(map(int,input().split()))\namax=max(arr)\namin=min(arr)\nif amax-amin>=2:\n print('No')\nelif amax-amin==0:\n flag=False\n for i in range(n):\n if arr[i]!=n-1:\n break\n else:\n flag=True\n for i in range(n):\n if 2*arr[i]>n:\n break\n else:\n flag=True\n if flag=...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s044830743', 's080140254', 's117046933', 's093164097']
[14008.0, 14092.0, 14092.0, 14092.0]
[63.0, 62.0, 61.0, 66.0]
[546, 545, 544, 547]
p03688
u227082700
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['n=int(input())\na=list(map(int,input().split()))\nif max(a)-2<=min(a):exit(print("No"))\nif len(set(a))==1:\n m=a[0]\n if m==n-1 or 2*m<=n:print("Yes")\n else:print("No")\nelse:\n x=a.count(min(a))\n y=n-x\n if x<max(a) and 2*(max(a)-x)<=y:print("Yes")\n else:print("No")', 'yes="Yes"\nno="No"\nn=int(input())\n...
['Wrong Answer', 'Accepted']
['s923863261', 's710058601']
[14204.0, 20784.0]
[55.0, 58.0]
[267, 290]
p03688
u257974487
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['n = int(input())\ncats = list(map(int,input().split()))\nflag = True\np, q = max(cats), min(cats)\nx = cats.count(p)\ny = cats.count(q)\nif p > q + 1:\n flag = False\nelif p == q:\n if n - p > 1 and p * 2 > n:\n flag = False\nelse:\n if x >= p or (p-x) * 2 > y:\n flag = False\n\nif flag:\n p...
['Wrong Answer', 'Accepted']
['s213430686', 's195382783']
[14092.0, 13964.0]
[46.0, 46.0]
[335, 337]
p03688
u268516119
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['import sys\ndef printans(t):\n print(t)\n sys.exit()\n\nN=int(input())\nA=[int(i) for i in input().split()]\n\nif all([a==A[0] for a in A]):\n shurui=A[0]\n if shurui==N-1 or shurui*2<=N:\n printans("Yes")\n else:printans("No")\nelse:\n maxshurui = max(A)\n if all([a in (maxshurui,maxshuru...
['Runtime Error', 'Accepted']
['s271197245', 's870271858']
[13964.0, 13964.0]
[53.0, 68.0]
[610, 645]
p03688
u284854859
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
["n = int(input())\n\na = list(map(int,int(input())))\na_max = max(a)\na_min = min(a)\nif a_max > a_min+1:\n print('No')\n exit()\nk = a_max\nif a_max == a_min:\n if k == n-1 or 2*k <= n:\n print('Yes')\n else:\n print('No')\nelse:\n uni = a.count(k-1)\n if k >= uni + 1 and k <= uni + (n...
['Runtime Error', 'Accepted']
['s544313425', 's209829435']
[4788.0, 14004.0]
[20.0, 44.0]
[362, 365]
p03688
u285891772
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\nfrom operator import itemgett...
['Wrong Answer', 'Accepted']
['s563134463', 's720747711']
[21988.0, 21556.0]
[65.0, 72.0]
[1162, 1215]
p03688
u333945892
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
["from collections import defaultdict,deque\nimport sys,heapq,bisect,math,itertools,string,queue,datetime\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nmod = 10**9+7\neps = 10**-7\ndef inpl(): return list(map(int, input().split()))\ndef inpls(): return list(input().split())\n\nN = int(input())\naa = inpl()\nMIN = ...
['Wrong Answer', 'Accepted']
['s791540290', 's644145140']
[15600.0, 15596.0]
[74.0, 74.0]
[695, 675]
p03688
u391731808
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['N=int(input())\n*A, = map(int,input().split())\nB = {}\nfor a in A: B[a] = B.get(a,0)+1\nm = min(B)\nM = max(B)\nif m+1<M:\n print("NO")\n exit()\ndef check(n):\n b0 = B.setdefault(n-1,0)\n b1 = B.setdefault(n,0)\n if b1==0:\n return b0==n\n else:\n return 1<= n-b0 <= b1//2\nif m+1==M:...
['Wrong Answer', 'Accepted']
['s989491794', 's182757694']
[18272.0, 17400.0]
[68.0, 71.0]
[390, 390]
p03688
u392319141
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
["from collections import Counter\n\nN = int(input())\nA = Counter(map(int, input().split()))\n\nif len(A.keys()) >= 3:\n print('No')\n exit()\n\nif len(A.keys()) == 1:\n p = list(A.keys())[0]\n print('Yes' if 2 * p <= N or p == N - 1 else 'No')\n exit()\n\np1, p2 = sorted(A.keys())\n1 / 0\nprint('Yes' i...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s290393392', 's343593890', 's826623647', 's849336028', 's998395184', 's094308086']
[22636.0, 21468.0, 22636.0, 22636.0, 22636.0, 22636.0]
[53.0, 70.0, 53.0, 53.0, 53.0, 53.0]
[348, 526, 355, 360, 376, 368]
p03688
u422104747
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['n=int(input())\ns=input().split()\nl=[int(s[i]) for i in range(n)]\nl.sort()\nif l[0]==l[-1]:\n if 1<=l[0]<=n//2:\n print("Yes")\n else:\n print("No")\nelif l[-1]-l[0]>1:\n l[10000000]-=1\n print("No")\nelse:\n l[10000000]-=1\n a=l.count(l[0])\n b=l.count(l[-1])\n if a+1<=l[-1]<=...
['Runtime Error', 'Accepted']
['s088973280', 's512498557']
[13964.0, 13964.0]
[50.0, 52.0]
[361, 333]
p03688
u637175065
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
["import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): retur...
['Runtime Error', 'Accepted']
['s762794143', 's973203639']
[20476.0, 20484.0]
[93.0, 95.0]
[1062, 1088]
p03688
u667084803
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['import sys\nN=int(input())\na=[int(i) for i in input().split()]\na.sort()\n\nif a[N-1]-a[0]>1:\n print("No")\n sys.exit()\nif a[0]==N-1:\n print("Yes")\n sys.exit()\nif a[N-1]==1:\n print("Yes")\n sys.exit()\nif a[0]==a[N-1]:\n if 2*a[0]<=N:\n print("Yes")\n else:\n print("No")\n sys.exit()\n\ncount=a....
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s011107352', 's674375530', 's729967136', 's864797464', 's262250609']
[13964.0, 13964.0, 13964.0, 13964.0, 13964.0]
[47.0, 69.0, 52.0, 45.0, 49.0]
[403, 299, 170, 257, 400]
p03688
u711245972
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['m=map(int,input().split())\na=[int(i) for i in m]\nd=max(a)-min(a)\nif d>1:\n ans=False\nelif d==0:\n if (max(a)<len(a) and max(a)*2>=len(a)):\n ans=True\n else:\n ans=False\nelse:\n max_num=a.count(max(a))\n min_num=a.count(min(a))\n dif=max(a)-min_num\n if (min_num<max(a) and dif*...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s069370168', 's887195475', 's723621455']
[3064.0, 3064.0, 13964.0]
[17.0, 17.0, 66.0]
[421, 443, 442]
p03688
u729133443
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
["print([1/id('hoge')%5%2]*2**28**id('fuga')and'Yes')", "n,a=open(0)\nn=int(n)\na=sorted(map(int,a.split()))\nif a[0]==a[-1]:\n if n-1==a[0]or n//a[0]>=2:\n print('Yes')\n else:\n print('No')\nelif a[-1]-1==a[0]:\n x=a.count(a[0])\n if x<a[-1]and(n-x)//(a[-1]-x)>=2:\n print('Yes')\n else:\n print('No')...
['Time Limit Exceeded', 'Accepted']
['s175227001', 's445356754']
[12324.0, 13992.0]
[2104.0, 42.0]
[51, 270]
p03688
u729707098
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['from collections import Counter\nn = int(input())\na = [int(i) for i in input().split()]\na.sort()\nc = Counter(a)\nif len(c)>2: print("No")\nelif len(c)==1:\n\tif a[0]+1==n or n>=2*a[0]: print("Yes")\n\telse: print("No")\nelif c[a[-1]]>=2*a[-1]: print("Yes")\nelse: print("No")', 'from collections import Counter\nn =...
['Wrong Answer', 'Accepted']
['s243236346', 's013219469']
[18656.0, 18656.0]
[56.0, 56.0]
[266, 313]
p03688
u780962115
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['n=int(input())\nlists=list(map(int,input().split()))\nfrom collections import Counter\na=dict(Counter(lists))\nif len(a)==1:\n if n>=lists[0]*2 or lists[0]==n-1:\n print("Yes")\n else:\n print("No")\n \nelif len(a)==2:\n P=list(a.keys())\n Q=list(a.values())\n x,y=min(P),max(P) #x=k+l-...
['Wrong Answer', 'Accepted']
['s175486758', 's780361359']
[21596.0, 21596.0]
[63.0, 54.0]
[461, 461]
p03688
u813174766
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['n=int(input())\na=list(map(int,input().split()))\nM=max(a)\nm=min(a)\nif M>m+1:\n print("No")\nelif M==m+1:\n cntm=a.count(m)\n cntM=n-cntm\n if cntm>m:\n print("No")\n elif cntm+cntM//2<M:\n print("No")\n else:\n print("Yes")\nelif M==m:\n if m<=n//2:\n print("Yes")\n else if m==n-1:\n print("...
['Runtime Error', 'Accepted']
['s765578720', 's799716095']
[3060.0, 14004.0]
[18.0, 44.0]
[328, 325]
p03688
u814986259
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['N = int(input())\na = list(map(int, input().split()))\nM = max(a)\nm = min(a)\nif M > m + 1:\n print("No")\nelse:\n if M == m:\n if M == N-1:\n print("Yes")\n elif M*2 <= N:\n print("Yes")\n else:\n print("No")\n\n else:\n if a.count(M) > 2:\n ...
['Wrong Answer', 'Accepted']
['s809891476', 's169274937']
[20868.0, 20768.0]
[55.0, 54.0]
[688, 600]
p03688
u896741788
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['n=int(input())\n\na=list(map(int,input().split()))\nif len(set(a))==1:\n if n>=2*a[0] or n-1==a[0]:print("Yes")\n else:print("No")\nelif len(set(a))>=3:print("No")\nelse:\n s,S=sorted(list(set(a)))\n if 2*n-a.count(s)<=S:print("Yes")\n else:print("No")', 'n=int(input())\n\na=list(map(int,input().split(...
['Wrong Answer', 'Accepted']
['s855909132', 's193511900']
[14564.0, 14208.0]
[52.0, 50.0]
[257, 284]
p03688
u950708010
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
["#https://img.atcoder.jp/agc016/editorial.pdf\ndef solve():\n n = int(input())\n a = list(int(i) for i in input().split())\n ans = 'YES'\n alone = 0\n group = 0\n if max(a) - min(a) >= 2: ans = 'NO'\n \n elif max(a) - min(a) == 1:\n for i in a:\n if i == max(a)-1 : alone += 1\n else: group += 1\n i...
['Wrong Answer', 'Accepted']
['s299277385', 's041450316']
[13964.0, 13964.0]
[2104.0, 57.0]
[536, 528]
p03688
u976162616
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['import sys\nif __name__ == "__main__":\n N = int(input())\n evidences = list(map(int, input().split()))\n evidences = list(sorted(evidences))\n unique_evidence = set(evidences)\n if (evidences[-1] - evidences[0] > 1):\n print ("No")\n sys.exit()\n if (len(unique_evidence) == 1):\n ...
['Runtime Error', 'Accepted']
['s076321795', 's059415705']
[14660.0, 14300.0]
[62.0, 65.0]
[1163, 1167]
p03688
u985443069
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
["import sys\nfrom collections import Counter\n\nsys.stdin = open('b1.in')\n\n\ndef read_int_list():\n return list(map(int, input().split()))\n\n\ndef read_int():\n return int(input())\n\n\ndef read_str_list():\n return input().split()\n\n\ndef read_str():\n return input()\n\n\nyes, no = 'Yes', 'No'\n\n\nde...
['Runtime Error', 'Accepted']
['s579875988', 's772356705']
[3316.0, 24280.0]
[21.0, 55.0]
[918, 920]
p03688
u996252264
2,000
262,144
There are N cats. We number them from 1 through N. Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me." Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
['def ri(): return int(input())\ndef rli(): return list(map(int, input().split()))\ndef ris(): return list(input())\ndef pli(): return "".join(list(map(str, ans)))\n\n\nN = ri()\na = rli()\nif(len(set(a)) >= 3):\n print("No")\nelif(len(set(a)) == 2):\n ma = max(a)\n mi = min(a)\n l_ma = 0\n l_mi = 0\n ...
['Wrong Answer', 'Accepted']
['s183328926', 's705972859']
[14300.0, 14300.0]
[67.0, 47.0]
[551, 548]
p03701
u033407970
2,000
262,144
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When...
["import math as mt\nstore = []\ndef binarysearch(min, max):\n mid = int((max + min)/2)\n if (min == max):\n return mid\n elif count(mid) > mid:\n return binarysearch(mid+1, max)\n else:\n return binarysearch(min, mid)\n\ndef count(x):\n store = [mt.ceil((n - x*b)/a) for n in hp]\n ...
['Runtime Error', 'Accepted']
['s981228818', 's518018625']
[3064.0, 2940.0]
[18.0, 17.0]
[659, 266]