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
p03261
u785505707
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['dataNum=input()\nwordList=[]\nfor word in input:\n wordList.append(word.strip())\n\nif len(wordList) != len(set(wordList)):\n print("No")\n exit()\n\nchar = wordList[0][-1:]\nfor n in range(1, len(wordList)):\n if(char != wordList[n][:1]):\n print("No")\n exit()\n char = wordList[n][-1:]\n\nprint("Yes")', 'dataNum=int(input())\nwordList=[]\nfor n in range(dataNum):\n wordList.append(input().strip())\n\nif len(wordList) != len(set(wordList)):\n print("No")\n exit()\n\nchar = wordList[0][-1:]\nfor n in range(1, len(wordList)):\n if(char != wordList[n][:1]):\n print("No")\n exit()\n char = wordList[n][-1:]\n\nprint("Yes")']
['Runtime Error', 'Accepted']
['s586074733', 's461732375']
[3064.0, 3064.0]
[17.0, 17.0]
[317, 331]
p03261
u790812284
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n=int(input())\nw=[input() for i in range(n)]\nw_set = set()\nfor i in range(n):\n w_set.add(w[i])\n\nif len(w)!=len(w_set):\n print("No")\nelse:\n for i in range(n-1):\n if w[i][-1]!=w[i+1][0]:\n print("No")\n \nprint("Yes")', 'import sys\nn=int(input())\nw=[input() for i in range(n)]\nw_set = set()\nfor i in range(n):\n w_set.add(w[i])\n\nif len(w)!=len(w_set):\n print("No")\n sys.exit()\n\nfor i in range(n-1):\n if w[i][-1]!=w[i+1][0]:\n print("No")\n sys.exit() \nprint("Yes")']
['Wrong Answer', 'Accepted']
['s988196738', 's017835488']
[3060.0, 3064.0]
[18.0, 17.0]
[255, 274]
p03261
u791664126
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["import sys\nn=int(input())\nsp=input()\nl=set()\nfor _ in range(n-1):\n sn=input()\n if (sn in l) or (sp[-1]!=sn[0]):\n print('No')\n sys.exit()\n l.add(sn)\n sp=sn\nprint('Yes')", "import sys\nn=int(input())\nsp=input()\nl=set()\nfor _ in range(n-1):\n sn=input()\n if (sn in l) or (sp[-1]!=sn[0]):\n print('No')\n sys.exit()\n l.add(sn)\n sp=sn\nprint('Yes')", "import sys\nn=int(input())\nsp=input()\nl=set()\nfor _ in range(n-1):\n sn=input()\n if (sn in l) or (sp[-1]!=sn[0]):\n print('No')\n sys.exit()\n l.add(sp)\n sp=sn\nprint('Yes')"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s173319716', 's367477705', 's568876254']
[3060.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0]
[193, 193, 193]
p03261
u803617136
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["n = int(input())\nans = 'Yes'\nwords = [input() for _ in range(n)]\nsaid = set()\ntail = words[0][0]\nfor w in words:\n if w in said or w[0] != tail:\n ans = 'No'\n print(w)\n break\n said.add(w)\n tail = w[-1]\n\nprint(ans)", "n = int(input())\nans = 'Yes'\nwords = [input() for _ in range(n)]\nsaid = set()\ntail = words[0][0]\nfor w in words:\n if w in said or w[0] != tail:\n ans = 'No'\n break\n said.add(w)\n tail = w[-1]\n\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s703032574', 's636944611']
[3064.0, 3064.0]
[17.0, 17.0]
[241, 224]
p03261
u810735437
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport array\nfrom bisect import *\nfrom collections import *\nimport fractions\nimport heapq \nfrom itertools import *\nimport math\nimport random\nimport re\nimport string\nimport sys\n\n\nN = int(input())\nprev = None\nok = Truen\nfor n in range(N):\n w = input()\n if prev is None:\n prev = w\n else:\n if prev[-1] != w[0]:\n ok = False\n prev = w\nif ok:\n print('Yes')\nelse:\n print('No')\n \n \n", "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport array\nfrom bisect import *\nfrom collections import *\nimport fractions\nimport heapq \nfrom itertools import *\nimport math\nimport random\nimport re\nimport string\nimport sys\n\n\nN = int(input())\nprev = None\nok = True\nfor n in range(N):\n w = input()\n if prev is None:\n prev = w\n else:\n if prev[-1] != w[0]:\n ok = False\n prev = w\nif ok:\n print('Yes')\nelse:\n print('No')\n \n \n", "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport array\nfrom bisect import *\nfrom collections import *\nimport fractions\nimport heapq \nfrom itertools import *\nimport math\nimport random\nimport re\nimport string\nimport sys\n\nN = int(input())\nprev = None\nok = True\nseen = set()\nfor n in range(N):\n w = input()\n if prev is None:\n prev = w\n else:\n if prev[-1] != w[0]:\n ok = False\n if w in seen:\n ok = False\n seen.add(w)\n prev = w\nif ok:\n print('Yes')\nelse:\n print('No')\n \n \n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s200819291', 's669942163', 's510176251']
[8232.0, 8264.0, 8008.0]
[269.0, 303.0, 282.0]
[467, 466, 531]
p03261
u811000506
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['N = int(input())\nW = [input() for _ in range(N)]\nflag = True \nb = W[0][-1] \nfor i in range(1,N): \n if b == W[i][0]:\u3000\n b = W[i][-1]\u3000\n else: \n flag = False\n exit()\n \nif int(len(W))!=len(set(W)):\n flag = False\n\nif flag == True:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nW = [input() for _ in range(N)]\nflag = True\nb = W[0][-1]\nfor i in range(1,N): \n if b == W[i][0]:\n b = W[i][-1]\n else:\n flag = False\n break\n \nif int(len(W))!=len(set(W)):\n flag = False\n\nif flag == True:\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Accepted']
['s427445265', 's401279605']
[2940.0, 3064.0]
[18.0, 18.0]
[278, 268]
p03261
u814781830
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['W = []\njudge = True\na = ""\nN = int(input())\nfor i in range(N):\n s = input()\n W.append(s)\n if i == 0:\n a = s[len(s)-1]\n else:\n if a != s[0] or s in W:\n judge = False\n break\n else:\n a = s[len(s)-1]\nif judge:\n print("Yes"):\nelse:\n print("No")', 'W = []\njudge = True\na = ""\nN = int(input())\nfor i in range(N):\n s = input()\n if i == 0:\n a = s[len(s)-1]\n else:\n if a != s[0] or s in W:\n judge = False\n break\n else:\n a = s[len(s)-1]\n W.append(s)\nif judge:\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Accepted']
['s225942953', 's096420292']
[2940.0, 3316.0]
[17.0, 19.0]
[311, 310]
p03261
u814986259
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['import collections\nN=int(input())\nsiritori=collections.defaultdict(int)\nprev=""\nfor i in range(N):\n word = imput()\n if word in siritori:\n print("No")\n elif prev[-1]==word[0]:\n print("No")\n siritori[word]+=1\nprint("Yes")', 'import collections\nN=int(input())\nsiritori=collections.defaultdict(int)\nprev=""\nfor i in range(N):\n word = input()\n if word in siritori:\n print("No")\n elif prev[-1]==word[0]:\n print("No")\n siritori[word]+=1\n prev=word\nprint("Yes")', 'import collections\nN=int(input())\nsiritori=collections.defaultdict(int)\nprev=""\nfor i in range(N):\n word = imput()\n if word in siritori:\n print("No")\n elif prev[-1]==word[0]:\n print("No")\n siritori[word]+=1\n prev=word\nprint("Yes")', 'N = int(input())\ns = set()\n\nflag = True\nfor i in range(N):\n S = input()\n if S in s:\n flag = False\n if i > 0 and S[0] != prev:\n flag = False\n s.add(S)\n prev = S[-1]\nif flag:\n print("Yes")\nelse:\n print("No")\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s063600392', 's426009218', 's928086163', 's428203354']
[3316.0, 3316.0, 3316.0, 3060.0]
[20.0, 20.0, 20.0, 18.0]
[231, 241, 241, 241]
p03261
u816631826
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['noOfWords= int(input())\nwords = []\nsatisfactor = True\nfor i in range(noOfWords):\n words.append(input())\n\nif len(set(words)) < len(words):\n print("NO") \n satisfactor = False \nelse:\n for i in range(len(words)-1):\n if words[i][len(words[i])-1] == words[i+1][0]:\n continue\n else:\n satisfactor = False\n print("NO")\n break\nif satisfactor :\n print("YES") \n\n', 'N=int(input())\ncount=0\nm=[]\ns=input()\nm.append(s)\nfor i in range(N-1):\n l=input()\n if l not in m and m[i][-1]==l[0]:\n count+=1\n m.append(l)\nif count==N-1:\n print("YES")\nelse:\n print("NO")\n\n', "N = int(input())\nword = list(str(input()) for _ in range(N))\nres = 'Yes'\nif len(word) != len(set(word)):\n print('No')\n exit()\nlast = (word[0])[0]\nfor i, x in enumerate(word):\n if last != x[0]:\n print('No')\n exit()\n last = x[-1]\nprint('Yes'", 'x=int(input())\nwords=[]\nfound=0\nword1=\'\'\nword2=\'\'\nfor i in range(x):\n words.append(input())\n\nfor j in range(x-1):\n for k in range(j+1,x):\n if words[j]==words[k]:\n found=-1\nfor c in range(x-1):\n word1=words[c]\n word2=words[c+1]\n if word1[-1]!=word2[0]:\n found=-1\nif found==-1:\n print("NO")\nelse:\n print("YES")', 'x=int(input())\nwords=[]\nfound=0\nword_1=\'\'\nword_2=\'\'\nfor i in range(x):\n words.append(input())\n\nfor j in range(x-1):\n for k in range(j+1,x):\n if words[j]==words[k]:\n found=-1\nfor c in range(x-1):\n word_1=words[c]\n word_2=words[c+1]\n if word_1[-1]!=word_2[0]:\n found=-1\nif found==-1:\n print("NO")\nelse:\n print("YES")', 'a=int(input())\nc=0\nz=[]\ny=[]\nb=[]\nfor i in range(a):\n x=str(input())\n z.append(x[0])\n y.append(x[-1])\n if i==0:\n b.append(x)\n if x not in b and z[i]==y[i-1]:\n b.append(x)\n c+=1\nif c==a-1:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s295714678', 's296524547', 's398544904', 's729308933', 's951592949', 's620040436']
[3060.0, 3060.0, 3060.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0, 18.0, 18.0, 18.0]
[438, 211, 265, 354, 360, 262]
p03261
u835732324
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["n=int(input())\nl=[str(input()) for i in range(n)]\nans = 0\nfor i in range(n):\n if list(l[i])[-1] == list(l[i+1])[0] and l.count(l[i]) == 1:\n ans += 1\n else:\n ans += 0\nprint('Yes' if ans==n else'N0')", "n=int(input())\nl=[str(input()) for i in range(n)]\nans = 0\nfor i in range(n-1):\n if list(l[i])[-1] == list(l[i+1])[0] and l.count(l[i]) == 1:\n ans += 1\n else:\n ans += 0\nprint('Yes' if ans==n-1 else'N0')", "n=int(input())\nl=[str(input()) for i in range(n)]\nans = 'Yes'\nfor i in range(1,n):\n if l[i][0] != l[i-1][-1]:\n ans = 'No'\n break\nif len(set(l)) != n:\n ans = 'No'\nprint(ans)\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s313335422', 's792229924', 's424031953']
[3060.0, 3060.0, 2940.0]
[18.0, 19.0, 17.0]
[217, 221, 191]
p03261
u844005364
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n = int(input())\nwords = [input() for _ in range(n)]\nprint("Yes" if all([y[0] == x[-1] for x, y in zip(words, words[1:]) and len(set(words)) == n else "No")', 'n = int(input())\nwords = [input() for _ in range(n)]\nprint("Yes" if all([y[0] == x[-1] for x, y in zip(words, words[1:])) and len(set(words)) == n else "No")', 'n = int(input())\nwords = [input() for _ in range(n)]\nprint("Yes" if all([y[0] == x[-1] for x, y in zip(words, words[1:]]) and len(set(words)) == n else "No")', 'n = int(input())\nwords = [input() for _ in range(n)]\nprint("Yes" if all([y[0] == x[-1] for x, y in zip(words, words[1:])]) and len(set(words)) == n else "No")']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s021731815', 's241623516', 's337275674', 's795460656']
[2940.0, 2940.0, 3064.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[156, 157, 157, 158]
p03261
u846226907
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['import numpy as np\nimport sys\n\ninput = sys.stdin.readline\n\nN = int(input())\n\nx = []\n\nres = True\nfor i in range(N):\n w = input()\n w = w[:(len(w)-1)]\n if w in x:\n res = False\n x.append(w)\n print(w,w[0],x[i-1][-1],res)\n if i > 0: \n if w[0] != x[i-1][-1]:\n res = False\n \n\nif res:print("Yes")\nelse:print("No")\n', 'import numpy as np\nimport sys\n\ninput = sys.stdin.readline\n\nN = int(input())\n\nx = []\n\nres = True\nfor i in range(N):\n w = input()\n w = w[:(len(w)-1)]\n if w in x:\n res = False\n x.append(w)\n if i > 0: \n if w[0] != x[i-1][-1]:\n res = False\n \n\nif res:print("Yes")\nelse:print("No")\n']
['Wrong Answer', 'Accepted']
['s487414905', 's362974451']
[14536.0, 21748.0]
[152.0, 309.0]
[355, 322]
p03261
u855985627
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["N=int(input())\nW=[]\nfor i in range(N):\n W.append(input())\nfor i in range(N-1):\n if W[i][-1] != W[i+1][0]:\n print('No')\n return\n for j in range(i+1, N):\n if W[i]==W[j]:\n print('No')\n return\nprint('Yes')", "N=int(input())\nW=[]\nfor i in range(N):\n W.append(input())\nfor i in range(N-1):\n if W[i][-1] != W[i+1][0]:\n print('No')\n exit()\n for j in range(i+1, N):\n if W[i]==W[j]:\n print('No')\n exit()\nprint('Yes')"]
['Runtime Error', 'Accepted']
['s658882825', 's712981686']
[3060.0, 3060.0]
[17.0, 18.0]
[223, 223]
p03261
u856232850
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["n = int(input())\n\nans = 'Yes'\n\nw = []\n\nfor i in range(n):\n\ta = input()\n\tif a in w:\n\t\tans = 'No'\n\telse:\n\t\tw.append(a)\n\nif n == 2:\n\tif w[0][-1] != w[1][0]:\n\t\tans = 'No'\nelif n == 3:\n\tif w[0][-1] != w[1][0]:\n\t\tans = 'No'\n\tif w[1][-1] != w[2][0]:\n\t\tans = 'No'\nelse:\n\tfor i in range(1,n-2):\n\t\tprint(i)\n\t\tif b[-1] == w[i][0]:\n\t\t\tb = w[i]\n\t\telse:\n\t\t\tans = 'No'\nprint(ans)\n", "n = int(input())\n\nans = 'Yes'\n\nw = []\n\nfor i in range(n):\n\ta = input()\n\tif a in w:\n\t\tans = 'No'\n\telse:\n\t\tw.append(a)\nb = w[0]\nc = w[1:]\nfor i in c:\n\tif i[0] == b[-1]:\n\t\tb = i\n\telse:\n\t\tans = 'No'\n\t\tbreak\nprint(ans)"]
['Runtime Error', 'Accepted']
['s190875195', 's243161849']
[3188.0, 3064.0]
[18.0, 17.0]
[365, 213]
p03261
u857148155
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n=int(input())\nws=[]\nfor i in range(n):\n w=input()\n if w in ws or w[0]!=ws[i-1][-1]:\n print("No")\n break\nelse:\n print("Yes")', 'n=int(input())\nws=[input()]\nfor i in range(1,n):\n w=input()\n if w in ws or w[0]!=ws[i-1][-1]:\n print("No")\n break\n ws.append(w)\nelse:print("Yes")']
['Runtime Error', 'Accepted']
['s661021327', 's912895730']
[3060.0, 3060.0]
[17.0, 17.0]
[133, 154]
p03261
u863370423
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n=int(input())\ns=[]\nfla=True\ns.append(input())\nfor i in range(1,n):\n s.append(input())\n if fla :\n if s[i][0]==s[i-1][len(s[i-1])-1]:\n for j in range(i):\n if s[j]==s[i]:\n fla=False\n else:\n fla=False\nif fla:\n print("YES")\nelse :\n print("NO")\n', "import sys \nfrom collections import Counter\nf = open('pokemon', 'r')\nnames = []\nfor line in f:\n names.append(line)\nmax_length = 0\npokemon = ''\nfor i in range(len(names)):\n p = [names[i]]\n start = names[i][-2]\n shiritori = True\n count = 1\n while shiritori == True:\n shiritori = False\n for j in range(len(names)):\n if i != j and names[j][0] == start and not names[j] in p:\n count += 1\n start = names[j][-2]\n shiritori = True\n p.append(names[j])\n if count > max_length:\n max_length = count\n pokemon = names[i]\n break\n print (p)\nprint (pokemon + str(max_length))", 'N=int(input())\nW=[]\nsame=[]\nfor i in range(N):\n W.append(input())\n\nfor i in range(len(W)):\n for x in range(i+1,len(W)):\n if W[i]==W[x]:\n same.append(W[i])\n \nfor i in range(len(W)-1):\n if len(same)!=0:\n print("NO")\n break\n \n if W[i][-1]==W[i+1][0]:\n print("YES")\n break\n \n else:\n print("NO")\n break\n', 'n = int(input())\nl= []\nx = 0\nfor elt in range(n):\n inp = input()\n l.append(inp)\nfor elt in range(len(l)):\n if l.count(l[elt]) > 1 :\n print("NO")\n x+=1\n break\n\n else:\n if elt < len(l)-1:\n if l[elt][-1] != l[elt+1][0]:\n print("NO")\n x += 1\n break\nif x == 0:\n print("YES")\n\n\n\n', 'noOfWords= int(input())\nwords = []\nsatisfactor = True\nfor i in range(noOfWords):\n word = input()\n words.append(word)\n\nif len(set(words)) < len(words):\n print("No") \n satisfactor = False \nelse:\n for i in range(len(words)-1):\n if words[i][len(words[i])-1] == words[i+1][0]:\n continue\n else:\n satisfactor = False\n print("No")\n break\nif satisfactor :\n print("Yes") \n\n']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s060108111', 's179952356', 's410821103', 's741443477', 's180709316']
[3060.0, 3444.0, 3064.0, 3060.0, 3060.0]
[18.0, 21.0, 18.0, 17.0, 17.0]
[322, 732, 384, 372, 454]
p03261
u864197622
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['N = int(input())\nW = [input() for i in range(N)]\n\nif [W[i][-1] for i in range(N-1)] == [W[i+1][0] for i in range(N-1)] and len(list(set(W))) = len(W):\n print ("Yes")\nelse:\n print ("No")', 'N = int(input())\nW = [input() for i in range(N)]\n\nif [W[i][-1] for i in range(N-1)] == [W[i+1][0] for i in range(N-1)] and len(list(set(W))) == len(W):\n print ("Yes")\nelse:\n print ("No")']
['Runtime Error', 'Accepted']
['s736371093', 's780255972']
[2940.0, 3060.0]
[17.0, 17.0]
[191, 192]
p03261
u867848444
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["n=int(input())\nw=[input() for i in range(n)]\ncount=0\nif len(w)==len(set(w)):\n for i in range(n-1):\n if w[i][-1]==w[i+1][0]:\n count+=1\nelse:\n print('No')\nprint('Yes' if count>0 else 'No')", "n=int(input())\nw=[input() for i in range(n)]\ncount=0\nif len(w)==len(set(w)):\n for i in range(n-1):\n if w[i][-1]==w[i+1][0]:\n count+=1\n else:\n count=count*0\n break\nelse:\n count=count*0\n \nprint('Yes' if count>0 else 'No')"]
['Wrong Answer', 'Accepted']
['s242573666', 's615682854']
[3060.0, 3060.0]
[17.0, 17.0]
[210, 275]
p03261
u869265610
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['N = int(input())\nW=[]\nss=True\nfor i in range (N):\n W.append(input())\n\n\nfor t in range (N):\n if W[t-1][-1]==W[t][0]:\n ss=True\n else:\n ss=False \nif len(W)!=N: \n ss=False\n \nif ss==False:\n print("No")\nelse:\n print("Yes")\n', "N=int(input())\nH=input()\nword=[]\nfor i in range(N-1):\n S=input()\n if S in word:\n print('No')\n exit()\n else:\n if H[-1]==S[0]:\n H=S\n word.append(H)\n else:\n print('No')\n exit()\nprint('Yes')", "N=int(input())\nH=input()\nword=[]\nword.append(H)\nfor i in range(N-1):\n S=input()\n if S in word:\n print('No')\n exit()\n else:\n if H[-1]==S[0]:\n H=S\n word.append(H)\n else:\n print('No')\n exit()\nprint('Yes')"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s062733232', 's928964905', 's807506520']
[3060.0, 9004.0, 9136.0]
[17.0, 26.0, 27.0]
[243, 221, 236]
p03261
u872887731
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['N = int(input().split())\na = []\nflag = 1\nfor i in range(N):\n a.append(str(input().split()))\n if i != 0:\n for j in range(i):\n if a[i] == a[j]:\n flag =0\n\n\nback = a[0][-1]\nfor i in range(1,N):\n front = a[i][0]\n if front != back:\n flag = 0\n break\n back = a[i][-1]\n\nif flag == 0:\n print("No") \nelse:\n print("Yes")', 'N = int(input())\na = []\nflag = 1\nfor i in range(N):\n a.append(str(input()))\n if i != 0:\n for j in range(i):\n if a[i] == a[j]:\n flag =0\n\n\nback = a[0][-1]\nfor i in range(1,N):\n front = a[i][0]\n if front != back:\n flag = 0\n break\n back = a[i][-1]\n\nif flag == 0:\n print("No") \nelse:\n print("Yes")']
['Runtime Error', 'Accepted']
['s141185704', 's915223397']
[3064.0, 3064.0]
[17.0, 18.0]
[376, 360]
p03261
u874741582
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n=int(input())\nB=[]\nS = 0\nfor i in range(0,n):\n B.append((input()))\nfor m in range(n-1):\n if B[m][-1] == B[m+1][0]:\n S += 1\nif S == n-1:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\nB=[]\nS = 0\nfor i in range(0,n):\n B.append((input()))\nC = set(B)\nif len(B) != len(C):\n print("No")\nelse:\n for m in range(n-1):\n if B[m][-1] == B[m+1][0]:\n S += 1\n if S == n-1:\n print("Yes")\n else: \n print("No")']
['Wrong Answer', 'Accepted']
['s970641255', 's372014302']
[3060.0, 3060.0]
[17.0, 17.0]
[188, 271]
p03261
u879674287
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["def main():\n n = input()\n before = ''\n words = set()\n\n for i in range(n):\n w = input()\n if w not in words:\n words.add(w)\n else:\n print('No')\n return\n\n if before == '':\n before = w\n continue\n\n if before[-1] != w[0]:\n print('No')\n return\n\n print('Yes')\n\n\nmain()\n", "def main():\n n = int(input())\n before = ''\n words = set()\n\n for i in range(n):\n w = input()\n if w not in words:\n words.add(w)\n else:\n print('No')\n return\n\n if before == '':\n before = w\n continue\n\n if before[-1] != w[0]:\n print('No')\n return\n before = w\n\n print('Yes')\n\n\nmain()\n"]
['Runtime Error', 'Accepted']
['s888349400', 's494917485']
[3056.0, 3060.0]
[17.0, 17.0]
[387, 411]
p03261
u879870653
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['N = int(input())\ncounter = 0\nqq = 0\nL = []\nfor i in range(N) :\n if i == 0 :\n w = input()\n L.append(w)\n q = w[-1]\n if i != 0 :\n w = input()\n if w in L :\n qq += 1\n p = w[0]\n if p == q :\n q = w[-1]\n counter += 1\n\n \n \nif counter == N-1 and qq != 0 :\n print("Yes")\nelse :\n print("No")\n\n', 'N = int(input())\ncounter = 0\nqq = 0\nL = []\nfor i in range(N) :\n if i == 0 :\n w = input()\n L.append(w)\n q = w[-1]\n if i != 0 :\n w = input()\n if w in L :\n qq += 1\n L.append(w)\n p = w[0]\n if p == q :\n q = w[-1]\n counter += 1\n\n \n \nif counter == N-1 and qq == 0 :\n print("Yes")\nelse :\n print("No")\n\n']
['Wrong Answer', 'Accepted']
['s728522503', 's123477599']
[3060.0, 3064.0]
[17.0, 18.0]
[397, 417]
p03261
u883203948
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['#data input\nn = int(input())\ni = 0\nstr = [0] * n \nwhile i < n: \n str[i] = input()\n i += 1\n \n\n\ni = 0\ncount = 0\nx = ""\nwhile i < n-1:\n if str[i][-1] == str[i+1][0]:\n i += 1\n else:\n print("no")\n count = 1\n break\ni = 0\nwhile i < n:\n x = str.count(str[i])\n if x >= 2:\n print("no")\n count = 1\n break\n i += 1\n\n\n\nif count == 0:\n print("yes")\n', '#data input\nn = int(input())\ni = 0\nstr = [0] * n \nwhile i < n: \n str[i] = input()\n i += 1\n \n\n\ni = 0\ncount = 0\nx = ""\nwhile i < n-1:\n if str[i][-1] == str[i+1][0]:\n i += 1\n else:\n print("No")\n count = 1\n break\ni = 0\nwhile i < n:\n x = str.count(str[i])\n if x >= 2:\n print("No")\n count = 1\n break\n i += 1\n\n\n\nif count == 0:\n print("Yes")\n']
['Wrong Answer', 'Accepted']
['s308322779', 's497526379']
[3064.0, 3064.0]
[18.0, 17.0]
[436, 436]
p03261
u890807039
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n,w,temp = int(input()),[],[]\nfor i in range(n):\n w.append(input())\n print(w[-1])\n if w[-1] in temp:\n print("No")\n exit()\n else:\n temp.append(w[-1])\n if i > 1 and w[i-1][0] != w[i][-1]:\n print("No")\n exit()\nprint("Yes")', 'n,w,temp = int(input()),[],[]\nfor i in range(n):\n w.append(input())\n if w[-1] in temp:\n print("No")\n exit()\n else:\n temp.append(w[-1])\n if i>0 and w[i-1][-1] != w[i][0]:\n print("No")\n exit()\nprint("Yes")']
['Wrong Answer', 'Accepted']
['s672796958', 's812185352']
[3064.0, 3060.0]
[17.0, 18.0]
[269, 250]
p03261
u896791216
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n = int(input())\nw = [input() for _ in range(n)]\nres = True\nfor i in range(1,n):\n print(w[i-1][-1])\n print(w[i][0])\n print(w[i][0] == w[i-1][-1])\n if w[i][0] != w[i-1][-1]:\n res = False\n else:\n continue\nif res == True and len(w) == len(set(w)):\n print("Yes")\nelse:\n print("No")', 'n = int(input())\nw = [input() for _ in range(n)]\nres = True\nfor i in range(1,n):\n if w[i][0] != w[i-1][-1]:\n res = False\n else:\n continue\nif res == True and len(w) == len(set(w)):\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s862485876', 's320708880']
[3064.0, 3060.0]
[17.0, 17.0]
[312, 238]
p03261
u897436032
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['w = input().split(\'\\n\')\nvalid = False\nfor i in range(1,len(w))\n if w[i][-1] == w[i+1][0] and len(set(w)) == len(w) \n vaild = True\n else: \n vaild = False\n\nprint("Yes" if vaild else "NO")\n', "# coding: utf-8\ndef is_unique(seq):\n return len(seq) == len(set(seq))\n \n \ndef main():\n n = int(input())\n \n w = []\n for i in range(n):\n w.append(input())\n \n for i in range(n-1):\n if w[i][-1] != w[i + 1][0] and not is_unique(w)::\n return 'No'\n else:\n return 'Yes'\n \nif __name__ == '__main__':\n main()", 'w = input().split(\'\\n\')\nvalid = False\nfor i in range(1,len(w)):\n if w[i][-1] == w[i+1][0] and len(set(w)) == len(w):\n valid = True\n else:\n valid = False\n \n \n print("Yes" if valid else "No")', "# coding: utf-8\n\n\ndef is_unique(seq):\n return len(seq) == len(set(seq))\n\n\ndef main():\n n = int(input())\n shiri = True\n\n w = []\n for i in range(n):\n w.append(input())\n\n for i in range(n-1):\n if w[i][-1] != w[i + 1][0]:\n shiri = False\n break\n\n if not is_unique(w):\n shiri = False\n\n if shiri:\n print('Yes')\n else:\n print('No')\n\n\nif __name__ == '__main__':\n print(main())\n", "# coding: utf-8\ndef is_unique(seq):\n return len(seq) == len(set(seq))\n \n \ndef main():\n n = int(input())\n \n w = []\n for i in range(n):\n w.append(input())\n \n for i in range(n-1):\n if w[i][-1] != w[i + 1][0] or not is_unique(w):\n return 'No'\n else:\n return 'Yes'\n \nif __name__ == '__main__':\n main()\n", 'w = input().split(\'\\n\')\nvalid = False\nfor i in range(1,len(w)):\n if w[i][-1] == w[i+1][0] and len(set(w)) == len(w):\n valid = True\n return\n else:\n valid = False\n \n \n print("Yes" if valid else "No")', 'def is_unique(seq):\n return len(seq) == len(set(seq))\n\n\ndef main():\n n = int(input())\n valid = False\n w = []\n for i in range(n):\n w.append(input())\n\n for i in range(n-1):\n if w[i][-1] != w[i + 1][0] or not is_unique(w):\n valid = False\n break\n else:\n valid = True\n\n print("Yes" if valid else "No")\n\n\nif __name__ == \'__main__\':\n main()']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s193981690', 's314038565', 's516400344', 's586170351', 's763116012', 's969663499', 's454145403']
[2940.0, 2940.0, 2940.0, 3064.0, 2940.0, 3060.0, 3064.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 18.0]
[198, 359, 201, 455, 358, 212, 411]
p03261
u898917044
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['# abc109_b\n\nfrom collections import Counter\n\n\ndef solve(words):\n commons = Counter(words).most_common()\n if commons[0][1] > 1:\n return "No"\n else:\n # initial letter first word not important\n first_letters = list(map(lambda x: x[0], words[1:]))\n # final letter final word not important\n last_letters = list(map(lambda x: x[-1], words[:-1]))\n if first_letters == last_letters:\n return "Yes"\n else:\n return "No"\n\n\nif __name__ == "__main__":\n N = input("")\n words = input("").split(" ")\n print(solve(words))\n', '# abc109_b\n\nfrom collections import Counter\n\n\ndef solve(words):\n if Counter(words).most_common()[0][1] > 1: # repetition is present\n return "No"\n else:\n # initial letter first word not important\n # final letter final word not important\n if list(map(lambda x: x[0], words[1:])) == list(map(lambda x: x[-1], words[:-1])):\n return "Yes"\n else:\n return "No"\n\n\ndef solve2(words):\n for i in range(len(words) - 1):\n if words[i] in words[i + 1:]:\n return "No"\n else:\n if words[i][-1] != words[i + 1][0]:\n return "No"\n return "Yes"\n\n\nif __name__ == "__main__":\n N = int(input(""))\n words = [input("") for i in range(N)]\n print(solve2(words))\n']
['Wrong Answer', 'Accepted']
['s879339030', 's761969184']
[3316.0, 3316.0]
[21.0, 21.0]
[593, 763]
p03261
u902462889
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['\nN = int(input())\n\nlst_W = []\nfor i in range(N):\n lst_W.extend(input().split())\n\nans = "Yes"\n\nfor i in range(N - 1):\n if (lst_W[i])[-1:] != (lst_W[i+1])[:1]:\n ans = "No"\n break\n\nif len(lst_W) != len(set(lst_W)):\n \n\nprint(ans)', '\nN = int(input())\n\nlst_W = []\nfor i in range(N):\n lst_W.extend(input().split())\n\nans = "Yes"\n\nfor i in range(N - 1):\n if (lst_W[i])[-1:] != (lst_W[i+1])[:1]:\n ans = "No"\n break\n\nif len(lst_W) != len(set(lst_W)):\n ans = "No"\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s516448578', 's258092016']
[2940.0, 3064.0]
[17.0, 17.0]
[259, 258]
p03261
u911153222
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["def shiritori():\n n = int(input())\n words = [input() for _ in range(n)]\n print(words)\n for word in words:\n count = 0\n for w in words:\n if w == word:\n count += 1\n if count > 1:\n print('No')\n exit()\n \n for i in range(n):\n if i + 1 <= n - 1:\n x = words[i+1][0]\n y = words[i][-1]\n if x == y:\n continue\n else:\n print('No')\n exit()\n \n print('Yes')\n\n\nif __name__ == '__main__':\n shiritori()\n", "def shiritori():\n n = int(input())\n words = [input() for _ in range(n)]\n\n for word in words:\n count = 0\n for w in words:\n if w == word:\n count += 1\n if count > 1:\n print('No')\n exit()\n \n for i in range(n):\n if i + 1 <= n - 1:\n x = words[i+1][0]\n y = words[i][-1]\n if x == y:\n continue\n else:\n print('No')\n exit()\n \n print('Yes')\n\n\nif __name__ == '__main__':\n shiritori()\n"]
['Wrong Answer', 'Accepted']
['s061339019', 's490670701']
[3064.0, 3064.0]
[17.0, 18.0]
[576, 560]
p03261
u914116178
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['# coding: utf8\n\nif __name__ == "__main__":\n n = int(input())\n w = []\n flag = True\n for _ in range(n):\n a = input()\n last = w[len(w)-1]\n if a[0] != last[len(last)-1] and a in w:\n flag = False\n print("No")\n break\n w.append(a)\n if flag == True:\n print("Yes")\n\n', '# coding: utf8\n\nn = int(input())\nw = []\nflag = True\nfor _ in range(n):\n a = input()\n last = w[len(w)-1]\n if a[0] != last[len(last)-1] and a in w:\n flag = False\n print("No")\n break\n w.append(a)\nif flag == True:\n print("Yes")\n\n', '# coding: utf8\n\nif __name__ == "__main__":\n n = int(input())\n w = []\n flag = True\n for _ in range(n):\n a = input()\n if len(w) == 0:\n continue\n last = w[len(w)-1]\n if a[0] != last[len(last)-1] or a in w:\n flag = False\n print("No")\n break\n w.append(a)\n if flag == True:\n print("Yes")\n\n', '# coding: utf8\n\nif __name__ == "__main__":\n n = int(input())\n w = []\n flag = True\n for _ in range(n):\n a = input()\n if len(w) == 0:\n continue\n last = w[len(w)-1]\n if a[0] != last[len(last)-1] and a in w:\n flag = False\n print("No")\n break\n w.append(a)\n if flag == True:\n print("Yes")\n\n', '# coding: utf8\n\nif __name__ == "__main__":\n n = int(input())\n w = []\n flag = True\n for _ in range(n):\n a = input()\n if len(w) == 0:\n w.append(a)\n continue\n last = w[len(w)-1]\n if a[0] != last[len(last)-1] or a in w:\n flag = False\n break\n w.append(a)\n if flag == True:\n print("Yes")\n else:\n print("No")\n\n']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s052452099', 's415128468', 's682143255', 's926525118', 's759193614']
[3064.0, 3060.0, 3064.0, 3064.0, 3064.0]
[19.0, 18.0, 18.0, 18.0, 18.0]
[340, 261, 384, 385, 414]
p03261
u914330401
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['N = int(input())\nw_list = ""\nis_cor = True\nfor i in range(N):\n w_list[i] = input()\na = w_list[0]\nfor i in range(1, N-1):\n b = w_list\n b[i] = 0\n if a[len(a)-1] != w_list[i][0] or w_list[i] in b:\n print("No")\n is_cor = False\n break\nif is_cor:\n print("Yes")', 'N = int(input())\nw_list = [""]*N\nis_cor = True\nfor i in range(N):\n w_list[i] = input()\nfor i in range(N-1):\n b = w_list.copy()\n b[i] = ""\n if w_list[i][len(w_list[i])-1] != w_list[i+1][0] or w_list[i] in b:\n print("No")\n is_cor = False\n break\nif is_cor:\n print("Yes")']
['Runtime Error', 'Accepted']
['s140654335', 's510665506']
[3064.0, 3064.0]
[17.0, 17.0]
[268, 281]
p03261
u918859246
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["N = int(input())\nword_list = []\nfor i in range(N):\n w = str(input())\n if w not in word_list:\n word_list.append(w)\n elif w in word_list:\n print('No')\n break\n \n if i == 0:\n continue\n else:\n if w[0] == word_list[i-1][-1]:\n print('Yes')\n else:\n print('No')\n break", "N = int(input())\nword_list = []\nyes_or_no = []\nfor i in range(N):\n w = str(input())\n if w not in word_list:\n word_list.append(w)\n elif w in word_list:\n yes_or_no.append('No')\n \n if i == 0:\n continue\n else:\n if w[0] == word_list[i-1][-1]:\n yes_or_no.append('Yes')\n else:\n yes_or_no.append('No')\nif 'No' in yes_or_no:\n print('No')\nelse:\n print('Yes')"]
['Wrong Answer', 'Accepted']
['s203176186', 's129581719']
[3060.0, 3060.0]
[18.0, 18.0]
[356, 433]
p03261
u919127329
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['word_num = int(input())\n\nword_list=[]\nfor i in range(word_num):\n word_list.append(str(input()))\n\n# print(word_list)\ntemp = 0\nfor item in word_list:\n initial_word = item[0]\n last_word = item[-1]\n if(temp != initial_word and temp != 0):\n print("No")\n exit()\n temp = last_word\n # print("Ok")\nprint("Yes")\n', 'def is_unique(seq):\n return len(seq) == len(set(seq))\n\nword_num = int(input())\n\nword_list=[]\nfor i in range(word_num):\n word_list.append(str(input()))\n if(is_unique(word_list) == False):\n print("No")\n exit()\n\n\n\n# print(word_list)\ntemp = 0\nfor item in word_list:\n initial_word = item[0]\n last_word = item[-1]\n if(temp != initial_word and temp != 0):\n print("No")\n exit()\n temp = last_word\n # print("Ok")\nprint("Yes")\n']
['Wrong Answer', 'Accepted']
['s170163823', 's823307490']
[2940.0, 3064.0]
[17.0, 18.0]
[318, 446]
p03261
u919730120
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
[" w=[input() for _ in range(n)]\n chk=[]\n chk.append(w[0])\n ans='Yes'\n for i in range(1,n):\n if w[i-1][-1]!=w[i][0] or (w[i] in chk):\n ans='No'\n break\n chk.append(w[i])\n print(ans)\n\nif __name__ == '__main__':\n resolve()", "def resolve():\n n=int(input())\n w=[input() for _ in range(n)]\n chk=[]\n chk.append(w[0])\n ans='Yes'\n for i in range(1,n):\n if w[i-1][-1]!=w[i][0] or (w[i] in chk):\n ans='No'\n break\n chk.append(w[i])\n print(ans)\n\nif __name__ == '__main__':\n resolve()"]
['Runtime Error', 'Accepted']
['s613020595', 's487524471']
[2940.0, 3064.0]
[17.0, 18.0]
[274, 308]
p03261
u921615009
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['args = input().split("\\n")\ncount = args[0]\nwords = [word for word in args[1:]]\nresult = "Yes"\nif len(words) == len(list(set(words))):\n for i in range(len(words)-1):\n if words[i][-1] != words[i+1][0]:\n \tresult = "No"\nelse:\n result = "No"\nprint(result)\n\n\n', 'args = input().split("\\n")\ncount = args[0]\nwords = [word for word in args[1:]]\nresult = "Yes"\nif len(words) == len(list(set(words))):\n for i in range(len(words)-1):\n if words[i] != words[i+1]:\n \tresult = "No"\nelse:\n result = "No"\nprint(result)\n\n\n', 'N = int(input())\nWs = [input() for i in range(N)]\n\nif len(Ws) != len(list(set(Ws))):\n print("No")\n exit(0)\n\nfor i in range(N-1):\n if Ws[i][-1] != Ws[i+1][0]:\n print("No")\n exit(0)\n\nprint("Yes")\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s621377024', 's987259549', 's502710629']
[3060.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[261, 254, 217]
p03261
u928758473
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['import os\nimport sys\nfrom collections import defaultdict, Counter, deque\nfrom itertools import product, permutations,combinations, accumulate\nfrom operator import itemgetter\nfrom bisect import bisect_left,bisect\nfrom heapq import heappop,heappush,heapify\nfrom math import ceil, floor, sqrt\nfrom copy import deepcopy\n\n\ndef main():\n n = int(input())\n vectoer = []\n flag = True\n for i in range(n):\n s = input()\n vectoer.append(s)\n\n if len(vectoer) != len(set(vectoer)):\n flag = False\n\n print(n)\n for i in range(n-1):\n if vectoer[i][-1] != vectoer[i+1][0]:\n flag = False\n break\n\n if flag:\n print("Yes")\n else:\n print("No")\n \n\nif __name__ == \'__main__\':\n\tmain()\n', 'import os\nimport sys\nfrom collections import defaultdict, Counter, deque\nfrom itertools import product, permutations,combinations, accumulate\nfrom operator import itemgetter\nfrom bisect import bisect_left,bisect\nfrom heapq import heappop,heappush,heapify\nfrom math import ceil, floor, sqrt\nfrom copy import deepcopy\n\n\ndef main():\n n = int(input())\n vectoer = []\n flag = True\n for i in range(n):\n s = input()\n vectoer.append(s)\n\n if len(vectoer) != len(set(vectoer)):\n flag = False\n \n for i in range(n-1):\n if vectoer[i][-1] != vectoer[i+1][0]:\n flag = False\n break\n\n if flag:\n print("Yes")\n else:\n print("No")\n \n\nif __name__ == \'__main__\':\n\tmain()\n']
['Wrong Answer', 'Accepted']
['s932904472', 's752177365']
[9488.0, 9476.0]
[35.0, 32.0]
[752, 747]
p03261
u928784113
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['# -*- coding: utf-8 -*-\nN = int(input())\na = [input() for i in range(N)]\nfor i in range(N):\n if a[i][len(a[i])]==a[i+1][0]:\n continue\n else:\n break\n print("No")\nprint("Yes")', '# -*- coding: utf-8 -*-\nN = int(input())\na = [input() for i in range(N)]\nfor i in range(N):\n if a[i][len(a[i])]=a[i+1][0]:\n continue\n else:\n break\n print("No")\nprint("Yes")\n ', 'N = int(input())\nW = []\nfor i in range(N):\n W.append(str(input()))\nans = "No"\nstartwith = []\nendwith = []\nif len(set(W)) == len(W):\n for i in W:\n startwith.append(i[0])\n endwith.append(i[-1])\n startwith.pop(0)\n endwith.pop(-1)\n if startwith == endwith:\n ans = "Yes"\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s339352782', 's921618064', 's937369526']
[2940.0, 2940.0, 3064.0]
[18.0, 18.0, 18.0]
[184, 188, 303]
p03261
u931118906
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["n=int(input())\nw=[]\nws=[]\ncount=1\nfor i in range(n):\n w.append(input())\n ws.append(list(w[i]))\nfor i in range(n):\n if (w.count(w[i]))>1:\n count-=1\nfor j in range(n-1):\n if (ws[j][len(w[j])-1])==(ws[j+1][0]):\n count+=1\nif count==(n):\n print('Yes')\nelse:\n print('N0')", "n=int(input())\nw=[]\nws=[]\ncount=1\nfor i in range(n):\n w.append(input())\n ws.append(list(w[i]))\nfor i in range(n):\n if (w.count(w[i]))>1:\n count-=1\nfor j in range(n-1):\n if (ws[j][len(w[j])-1])==(ws[j+1][0]):\n count+=1\nif count==int(n):\n print('Yes')\nelse:\n print('No')"]
['Wrong Answer', 'Accepted']
['s688692370', 's978434365']
[3064.0, 3064.0]
[18.0, 18.0]
[297, 300]
p03261
u934788990
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['import collections\nn = int(input())\nk = []\nresult=[]\nfor i in range(n):\n a = input()\n k.append(a)\nans = collections.Counter(k)\nfor i in range(1,n):\n if k[i-1][-1] == k[i][0] and ans.most_common()[0][1] == 1:\n result.append("1")\n else:\n result.append("0")\nprint(result)\naim = collections.Counter(result)\nprint(aim.most_common()[0][1])\nif aim.most_common()[0][1] != n-1 or aim.most_common()[0][0] ==\'0\':\n print(\'No\')\nelse:\n print(\'Yes\')', 'import collections\nn = int(input())\nk = []\nresult=[]\nfor i in range(n):\n a = input()\n k.append(a)\nans = collections.Counter(k)\nfor i in range(1,n):\n if k[i-1][-1] == k[i][0] and ans.most_common()[0][1] == 1:\n result.append("1")\n else:\n result.append("0")\naim = collections.Counter(result)\nif aim.most_common()[0][1] != n-1 or aim.most_common()[0][0] ==\'0\':\n print(\'No\')\nelse:\n print(\'Yes\')\n']
['Wrong Answer', 'Accepted']
['s386061315', 's546913493']
[3316.0, 3444.0]
[22.0, 22.0]
[466, 422]
p03261
u935254309
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['N = int(input())\nW = {}\nlast=""\nflg = True\n\nw =[]\n\nfor i in range(N):\n w.append(str(input()))\n \n \nfor i in w:\n temp = i\n \n if temp in W:\n flg = False\n break\n else:\n W[temp] = 1\n \n if i !=0:\n if temp[0] == last:\n last = temp[-1]\n else:\n flg = False\n break\n else:\n last = temp[-1]\n \n \n \nif(flg == True):\n print("Yes")\nelse:\n print("No",last)\n ', 'N = int(input())\nW = {}\nlast=""\nflg = True\n\nfor i in range(N):\n temp = str(input())\n \n if temp in W:\n flg = False\n break\n else:\n W[temp] = 1\n \n if i !=0:\n if temp[0] == last:\n last = temp[-1]\n else:\n flg = False\n break\n else:\n last = temp[-1]\n \n \n \nif(flg == True):\n print("Yes")\nelse:\n print("No",last)', 'N = int(input())\nW = {}\nlast=""\nflg = True\n\nw =[]\n\nfor i in range(N):\n w.append(str(input()))\n \ncnt=0\nfor i in w:\n \n if i in W:\n flg = False\n break\n else:\n W[i] = 1\n \n if cnt !=0:\n if i[0] == last:\n last = i[-1]\n else:\n flg = False\n break\n else:\n last = i[-1]\n \n cnt+=1\n \nif(flg == True):\n print("Yes")\nelse:\n print("No")\n ']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s146112095', 's748826826', 's531838316']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[497, 443, 460]
p03261
u937529125
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n = int(input())\na = []\nflag = 1\nbefore = ""\nfor i in range(n):\n a1 = input()\n\n if i == 0:\n before = a1[len(a1)-1]\n continue\n if before != a1[0]:\n flag = 0\n before = a1[len(a1)-1]\nif flag==0:\n print("No")\nelse:\n print("Yes")', 'n = int(input())\na = []\nflag = 1\nbefore = ""\ndef is_unique(seq):\n return len(seq) == len(set(seq))\nfor i in range(n):\n a1 = input()\n a.append(a1)\n if i == 0:\n before = a1[len(a1)-1]\n continue\n if before != a1[0]:\n flag = 0\n before = a1[len(a1)-1]\nif is_unique(a) == False:\n flag = 0\nif flag==0:\n print("No")\nelse:\n print("Yes")']
['Wrong Answer', 'Accepted']
['s976000346', 's655483764']
[3060.0, 3064.0]
[19.0, 17.0]
[263, 375]
p03261
u940102677
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n = input()\nw = []\nFlag = Trure \nfor i in range(n):\n w.append(input())\nfor i in range(n-1):\n if w[i][-1] != w[i+1][0]:\n Flag = False\nif len(w) = len(set(w)):\n Flag = False\nprint("Yes" if Flag else "No")', 'n = int(input())\nw = []\nFlag = True \nfor i in range(n):\n w.append(input())\nfor i in range(n-1):\n if w[i][-1] != w[i+1][0]:\n Flag = False\nif len(w) != len(set(w)):\n Flag = False\nprint("Yes" if Flag else "No")']
['Runtime Error', 'Accepted']
['s906049097', 's124630664']
[2940.0, 3064.0]
[17.0, 17.0]
[208, 213]
p03261
u940279019
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["n = int(input())\nw = [input().rsprit() for i in range(n)]\nuse = [w[0]]\nfor i in range(1,n):\n if w[i][0] == w[i-1][-1] and w[i] not in use:\n use.append(w[i])\n else:\n print('No')\n exit()\nprint('Yes')", "n = int(input())\nw = [input().rstrip() for i in range(n)]\nuse = [w[0]]\nfor i in range(1,n):\n if w[i][0] == w[i-1][-1] and w[i] not in use:\n use.append(w[i])\n else:\n print('No')\n exit()\nprint('Yes')"]
['Runtime Error', 'Accepted']
['s257628750', 's294788929']
[3060.0, 3060.0]
[18.0, 18.0]
[208, 208]
p03261
u940332739
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['N = int(input())\nS = []\nfor i in range(N):\n S.append(input())\n\n\n\nwww = "YYY"\nfor i in range(N-2):\n\n if S[i][-1] != S[i+1][0]:\n www = "fuck"\n\n\nqqq = "ZZZ"\nS.sort()\nfor i in range(N-2):\n if S[i] == S[i+1]:\n qqq = "bich"\n\nif www == "YYY" and qqq == "ZZZ":\n print("Yes")\nelse:\n print("No")\n', 'N = int(input())\nS = []\nfor i in range(N):\n S.append(input())\n\n\n\nwww = "YYY"\nfor i in range(N-1):\n if S[i][-1] != S[i+1][0]:\n www = "fuck"\n\nqqq = "ZZZ"\nS.sort()\nfor i in range(N-1):\n if S[i] == S[i+1]:\n qqq = "bich"\n\nif www == "YYY" and qqq == "ZZZ":\n print("Yes")\nelse:\n print("No")\n']
['Wrong Answer', 'Accepted']
['s128735489', 's598368964']
[3060.0, 3060.0]
[18.0, 18.0]
[315, 313]
p03261
u945418216
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["n=int(input())\nww=[input() for i in range(n)]\n\nif len(set(ww))==n:\n print('No')\nelse:\n for i in range(1,n):\n if ww[i-1][-1] != ww[i][0]:\n print('No')\n break\n else:\n print('Yes')", "n = int(input())\n\nww = [input() for _ in range(n)]\n# print(ww)\n\nfor i,w in enumerate(ww[:-1]):\n if ww[i][-1] != ww[i+1][0] or ww.count(w)>1:\n print('No')\n # print(w)\n break\nelse:\n print('Yes')"]
['Wrong Answer', 'Accepted']
['s929474437', 's741350270']
[3064.0, 3060.0]
[19.0, 18.0]
[222, 219]
p03261
u945761460
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n=int(input())\na=[]\nx=str(input())\na[0]=x\nd=bool(True)\nfor i in range(1, n):\n y=str(input)\n if x[len(x)]!=y[0]:\n d=False\n for i in range(a.size()):\n if y==a[i]:\n d=False\n a.append(y)\n\nif d:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\na=[]\nx=str(input())\na.append(x)\nd=bool(True)\n\nfor i in range(1, n):\n y=str(input())\n if x[len(x)-1]!=y[0]:\n d=False\n \n for j in range(len(a)):\n if y==a[j]:\n d=False\n a.append(y)\n x=y\n\nif d==True:\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Accepted']
['s302953466', 's672975834']
[9192.0, 9196.0]
[26.0, 33.0]
[240, 265]
p03261
u949406263
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['count = input()\ninputed = []\nlast = ""\njudge = "Yes"\nfor i in range(int(count)):\n new_inputed = input()\n if i != 0 and (new_inputed[0] != last or new_inputed in inputed):\n judge = "No"\n print(last, new_inputed[-1], new_inputed in inputed)\n last = new_inputed[-1]\n inputed.append(new_inputed)\nprint(judge)', 'count = input()\ninputed = []\nlast = ""\njudge = "Yes"\nfor i in range(int(count)):\n new_inputed = input()\n if i != 0 and (new_inputed[0] != last or new_inputed in inputed):\n judge = "No"\n last = new_inputed[-1]\n inputed.append(new_inputed)\nprint(judge)']
['Wrong Answer', 'Accepted']
['s253143665', 's678670547']
[3060.0, 3060.0]
[17.0, 17.0]
[330, 269]
p03261
u951480280
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n=int(input())\nS=[input() for _ in range(n)]\nans=0\nfor i in range(n-1):\n if S[i][-1] != S[i+1][0]:\n ans = 1\n break\nprint("Yes" if ans == 0 else "No")', 'n=int(input())\nS=[input() for _ in range(n)]\nans=1\nfor i in range(n-1):\n if S[i][-1] == S[i+1][0]:\n ans += 1\nprint("Yes" if ans == n else "No")', 'n=int(input())\nS=[input() for _ in range(n)]\nans=1\nfor i in range(n-1):\n if (S[i][-1] == S[i+1][0])*(S[i+1] not in S[:i+1]):\n ans += 1\nprint("Yes" if ans == n else "No")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s151102730', 's936505908', 's086835710']
[2940.0, 3060.0, 3060.0]
[17.0, 18.0, 18.0]
[166, 153, 179]
p03261
u952588409
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["N=int(input())\nlast = input()\nwds = set([last])\nfor i in range(N-1):\n wd = input()\n if wd in wds or last[-1]!=wd[0]: \n print('No')\n break\n last = wd\n wds.add(wd)\nprint('Yes')", "N=int(input())\nlast = input()\nwds = set([last])\nfor i in range(N-1):\n print(i)\n wd = input()\n if wd in wds or last[-1]!=wd[0]: \n print('No')\n break\n last = wd\n wds.add(wd)\nprint('Yes')", 'N=int(input())\nlast = input()\nwds = set([last])\nres = "Yes"\nfor i in range(N-1):\n wd = input()\n if wd in wds or last[-1]!=wd[0]: \n res = "No"\n break\n last = wd\n wds.add(wd)\nprint(res)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s374585020', 's583657453', 's772648836']
[3060.0, 3060.0, 3060.0]
[17.0, 18.0, 17.0]
[200, 213, 209]
p03261
u964494353
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["import sys\nn = int(input())\nwords = input().split()\nfor i in range(n-1)\n for j in range(1, i):\n if words[i] == words[j]:\n print('No')\n sys.exit()\n if words[i][-1] != words[i+1][1]:\n print('No')\n sys.exit()\nprint('Yes')", "import sys\nn = int(input())\nwords=[]\nfor i in range(n):\n\twords += [input()]\nfor i in range(n-1):\n\tfor j in range(i+1, n):\n\t\tif words[i] == words[j]:\n\t\t\tprint('No')\n\t\t\tsys.exit()\n\tif words[i][-1] != words[i+1][0]:\n\t\tprint('No')\n\t\tsys.exit()\nprint('Yes')"]
['Runtime Error', 'Accepted']
['s686054858', 's904687217']
[2940.0, 3060.0]
[17.0, 18.0]
[275, 252]
p03261
u970107703
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["N = int(input())\nflag = False\ndic = []\n\nword = input()\ndic.append(word)\n\nfor i in range(N-1):\n word = input()\n if(word not in dic and word[0] == dic[-1][-1]):\n dic.append(word)\n else:\n flag = True\n break\nif(flag == True):\n print('NO')\nelse:\n print('YES')", "N = int(input())\nflag = False\ndic = []\n\nword = input()\ndic.append(word)\n\nfor i in range(N-1):\n word = input()\n if(word not in dic and word[0] == dic[-1][-1]):\n dic.append(word)\n else:\n flag = True\n break\nif(flag == True):\n print('No')\nelse:\n print('Yes')"]
['Wrong Answer', 'Accepted']
['s228699911', 's520496601']
[3064.0, 3064.0]
[17.0, 18.0]
[290, 290]
p03261
u970899068
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["n=int(input())\nw=[input() for i in range(n)] \ncount=0\nif len(set(w))<len(w):\n print('No')\nelse:\n for i in range(n-1):\n if w[i][-1]==w[i+1][0]:\n count+=1\n if count==n-1:\n print('Yes')\n else:\n print('No')\nprint(count)", "n=int(input())\nw=[input() for i in range(n)] \ncount=0\nif len(set(w))<len(w):\n print('No')\nelse:\n for i in range(n-1):\n if w[i][-1]==w[i+1][0]:\n count+=1\n if count==n-1:\n print('Yes')\n else:\n print('No')"]
['Wrong Answer', 'Accepted']
['s761118591', 's941579604']
[3064.0, 3060.0]
[17.0, 17.0]
[262, 249]
p03261
u972658925
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n = int(input())\nlst = [iuput() for _ in range(n-1)]\nlstset = set(lst)\nif len(lst) != len(lstset):\n print("No")\nelse:\n cnt = 0\n for i in range(n-1):\n if lst[i][-1] == lst[i][0]:\n cnt += 1\n else:\n break\n if cnt == len(lst):\n print(\'Yes\')\n else:\n print(\'No\')\n ', 'n = int(input())\nlst = [input() for _ in range(n)]\nlstset = set(lst)\n\nif len(lst) != len(lstset):\n print("No")\nelse:\n cnt = 0\n for i in range(n-1):\n if lst[i][-1] == lst[i + 1][0]:\n cnt += 1\n else:\n break\n if cnt + 1 == len(lst):\n print(\'Yes\')\n else:', 'n = int(input())\nlst = [input() for _ in range(n)]\nlstset = set(lst)\n\nif len(lst) != len(lstset):\n print("No")\nelse:\n cnt = 0\n for i in range(n-1):\n if lst[i][-1] == lst[i + 1][0]:\n cnt += 1\n else:\n break\n if cnt + 1 == len(lst):\n print(\'Yes\')\n else:\n print(\'No\')']
['Runtime Error', 'Runtime Error', 'Accepted']
['s730910129', 's927731923', 's801799034']
[3060.0, 3064.0, 3060.0]
[18.0, 17.0, 18.0]
[326, 308, 328]
p03261
u973840923
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["N = int(input())\nW = [input() for i in range(N)]\n\nword_stock = []\n\nfor word in W:\n \n if word in word_stock:\n print('No')\n \n try:\n if word_stock[-1][-1] != word[0]:\n print('No')\n except:\n pass\n word_stock.append(word)\n\nprint('Yes')", "for word in word_list:\n \n if word in word_stock:\n print('No')\n \n try:\n if word_stock[-1][-1] != word[0]:\n print('No')\n except:\n pass\n word_stock.append(word)\n\nprint('Yes')", "N = int(input())\nW = [input() for i in range(N)]\n\nword_stock = []\n\nfor word in word_list:\n \n if word in word_stock:\n print('No')\n \n try:\n if word_stock[-1][-1] != word[0]:\n print('No')\n except:\n pass\n word_stock.append(word)\n\nprint('Yes')", "N = int(input())\nW = [input() for i in range(N)]\n\nfor word in word_list:\n \n if word in word_stock:\n print('No')\n \n try:\n if word_stock[-1][-1] != word[0]:\n print('No')\n except:\n pass\n word_stock.append(word)\n\nprint('Yes')", "N = int(input())\nW = [input() for i in range(N)]\n\nstock = []\nlast = W[0][0]\n\nfor i in range(0,len(W)):\n \n if W[i] in stock:\n print('No')\n break\n \n if W[i][0] != last:\n print('No')\n break\n stock.append(W[i])\n last = W[i][-1]\n \n if i+1 == len(W):\n print('Yes')"]
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s293283909', 's310962288', 's496059158', 's565822615', 's239994622']
[3060.0, 2940.0, 3060.0, 3060.0, 3064.0]
[19.0, 19.0, 18.0, 19.0, 17.0]
[324, 265, 332, 315, 455]
p03261
u982473248
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['def si():\n\n n = int(input()) \n tk = [input() for i in range(n)]\n tu = len(set(tk))\n l =[]\n k = []\n\n \n \n oo = 0\n\n\n while oo < tu:\n t = tk[oo]\n l.append(t[0])\n k.append(t[-1])\n oo += 1\n \n oo = 0\n\n\n while oo < tu-1:\n if k[oo] != l[oo+1]:\n return False\n \n oo += 1\n\n\n if tu != n:\n print(tu)\n print(n)\n \n return False\n \n return True\n \nif si():\n print("Yes")\nelse:\n print("No")', 'def si():\n\n n = int(input()) \n tk = [input() for i in range(n)]\n tu = len(set(tk))\n l =[]\n k = []\n\n \n \n oo = 0\n\n\n while oo < tu:\n t = tk[oo]\n l.append(t[0])\n k.append(t[-1])\n oo += 1\n \n oo = 0\n\n\n while oo < tu-1:\n if k[oo] != l[oo+1]:\n return False\n \n oo += 1\n\n\n if tu != n:\n return False\n \n return True\n \nif si():\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s333790785', 's976817103']
[3064.0, 3064.0]
[18.0, 17.0]
[517, 473]
p03261
u985041094
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["def check_words(w):\n if len(w) != len(set(w)):\n return False\n for i in range(n-1):\n if w[i][-1] != w[i+1][0]:\n return False\n return True\n\nn = int(input())\nw = list(map(str, input().split()))\nret = 'Yes' if check_words(w) else 'No'\nprint(ret)", "n = int(input())\nw = list(map(str, input().split()))\nret = 'Yes'\nif len(w) == len(set(w)):\n for i in range(len(w)-1):\n if w[i][-1] != w[i+1][0]:\n ret = 'No'\n break\nelse:\n ret = 'No'\nprint(ret)", "def check_words(w):\n if len(w) != len(set(w)):\n return False\n for i in range(n-1):\n if w[i][-1] != w[i+1][0]:\n return False\n return True\n\nn = int(input())\nw = list(map(str, input().split()))\nif check_words(w):\n ret = 'Yes'\nelse:\n ret = 'No'\nprint(ret)", "n = int(input())\nw = [input() for i in range(N)]\n\nif n != len(set(w)):\n print('No')\n exit()\nfor i in range(n-1):\n if w[i][-1] != w[i+1][0]:\n print('No')\n exit()\n\nprint('Yes')", "def check_words(w):\n if len(w) != len(set(w)):\n return False\n for i in range(n-1):\n if w[i][-1] != w[i+1][0]:\n return False\n return True\n\nn = int(input())\nw = list(map(str, input().split()))\nret = 'Yes' if check_words(w) else 'No'\nprint(ret)", "n = int(input())\nw = [input() for i in range(n)]\n\nif n != len(set(w)):\n print('No')\n exit()\nfor i in range(n-1):\n if w[i][-1] != w[i+1][0]:\n print('No')\n exit()\n\nprint('Yes')"]
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s344448258', 's495212273', 's519685521', 's812703475', 's893890150', 's050411432']
[3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 18.0, 17.0, 18.0, 18.0]
[275, 227, 291, 197, 275, 197]
p03261
u985963315
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n = int(input())\nresult = "Yes"\nw = list(input())\nfor i in range(n - 1):\n s = input()\n if s in w:\n result = "No"\n elif s[0] != w[-1][-1]:\n result = "No"\n else:\n w.append(s)\nprint(result)', 'n = int(input())\nresult = "Yes"\nw = list(input())\nfor i in range(n - 1):\n s = input()\n if s in w:\n result = "No"\n break\n elif s[0] != w[-1][-1]:\n result = "No"\n break\n else:\n w.append(s)\nprint(result)', 'n = int(input())\nresult = "Yes"\nw = []\ns = input()\nw.append(s)\nfor i in range(n - 1):\n s = input()\n if s in w:\n result = "No"\n break\n elif s[0] != w[-1][-1]:\n result = "No"\n break\n else:\n w.append(s)\nprint(result)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s684360025', 's975831633', 's650198973']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[199, 219, 232]
p03261
u987164499
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['from sys import stdin\nimport fractions\n\nn = int(stdin.readline().rstrip())\n\nli = [stdin.readline().rstrip() for _ in range(n)]\nk = len(li)\nlin = list(set(li))\n\nif len(li) != k:\n print("No")\n exit()\n\nfor i in range(len(li)-1):\n if li[i][-1] != li[i+1][0]:\n print("No")\n exit()\nprint("Yes")\n', 'from sys import stdin\nimport fractions\n\nn = int(stdin.readline().rstrip())\n\nli = [stdin.readline().rstrip() for _ in range(n)]\nk = len(li)\nlin = list(set(li))\n\nif len(lin) != k:\n print("No")\n exit()\n\nfor i in range(len(li)-1):\n if li[i][-1] != li[i+1][0]:\n print("No")\n exit()\nprint("Yes")\n']
['Wrong Answer', 'Accepted']
['s271551083', 's459938162']
[5052.0, 5308.0]
[36.0, 38.0]
[312, 313]
p03261
u989157442
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
["# Shiritori\nn = int(input())\nli = []\nfor i in range(n):\n li.append(list(input()))\nfor j in range(n):\n if li[j][-1] != li[j+1][0]:\n print('No1')\n exit()\n for k in range(j):\n if li[j] == li[k]:\n print('No2')\n exit()\nprint('Yes')\n", "# Shiritori\nn = int(input())\nli = []\nfor i in range(n):\n li.append(list(input()))\nfor j in range(n-1):\n if li[j][-1] != li[j+1][0]:\n print('No1')\n exit()\n for k in range(j):\n if li[j] == li[k]:\n print('No2')\n exit()\nprint('Yes')\n", "# Shiritori\nn = int(input())\nli = []\nfor i in range(n):\n li.append(list(input()))\nfor j in range(n-1):\n if li[j][-1] == li[j+1][0]:\n for k in range(j):\n if li[j] == li[k] or li[-1] == li[k]:\n print('No')\n exit()\n else:\n print('No')\n exit()\nprint('Yes')\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s699993926', 's705723745', 's586864027']
[3060.0, 3064.0, 3060.0]
[18.0, 18.0, 18.0]
[279, 281, 324]
p03261
u993435350
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['N = int(input())\n\nW = [input() for w in range(N)]\n\nfor i in range(1,len(W)):\n if (W[i-1][-1] != W[i][0]) or (W[i] in W[:i] == True):\n print("No")\n break\nelse:print("Yes")', 'N = int(input())\n\nW = [input() for w in range(N)]\n\nfor i in range(1,len(W)):\n if (W[i-1][-1] != W[i][0]) or (W[i] in W[:i]):\n print("No")\n break\nelse:print("Yes")']
['Wrong Answer', 'Accepted']
['s256040025', 's066634827']
[3060.0, 3064.0]
[18.0, 17.0]
[177, 169]
p03261
u999503965
2,000
1,048,576
Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.
['n=int(input())\nl=[input() for i in range(n)]\n\nif l.most_common()[0][1] != 1:\n ans="No"\nelse:\n l_head = [i[0] for i in l]\n l_tail = [i[-1] for i in l]\n if l_head == l_tail:\n ans="Yes"\n else:\n ans="No"\n \nprint(ans)\n ', 'from collections import Counter\n\nn=int(input())\nl=[input() for i in range(n)]\n\nif Counter(l).most_common()[0][1] != 1:\n ans="No"\nelse:\n l_head = [l[i+1][0] for i in range(n-1)]\n l_tail = [l[i][-1] for i in range(n-1)]\n if l_head == l_tail:\n ans="Yes"\n else:\n ans="No"\n \nprint(ans)\n ']
['Runtime Error', 'Accepted']
['s022039351', 's210863185']
[9156.0, 9268.0]
[25.0, 29.0]
[229, 297]
p03262
u003501233
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['def gcd(a,b):\n while b:\n a,b = b, a % b\n return a\n\nN,X=map(int,input().split())\nx=list(map(int,input().split()))\n\nans = x[0] - X\n\nfor i in range(1,N):\n ans = gcd(ans, x[i] - X)\n\nprint(abs(ans))', 'def gcd(a,b):\n while b:\n a,b = b, a % b\n return a\n\nN,X=map(int,input().split())\nx=list(map(int,input().split()))\n\nans = x[0] - X\n\nfor i in range(1,N):\n ans = gcd(ans, x[i] - X)\n\nprint(abs(ans))']
['Wrong Answer', 'Accepted']
['s120165682', 's525450492']
[14252.0, 14252.0]
[75.0, 82.0]
[201, 199]
p03262
u013408661
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['n,x=map(int,input().split())\nX=list(map(int,input().split()))\nfor i in X:\n i=abs(i-x)\ndef gcd(x,y):\n if y==0:\n return x\n else:\n return(y,x%y)\nstack=X[0]\nfor i in range(n-1):\n stack=gcd(stack,X[i+1])\nprint(stack)', 'n,x=map(int,input().split())\nX=list(map(int,input().split()))\nfor i in range(n):\n X[i]=abs(X[i]-x)\ndef gcd(x,y):\n if y==0:\n return x\n else:\n return(y,x%y)\nstack=X[0]\nfor i in range(n-1):\n stack=gcd(stack,X[i+1])\nprint(stack)', 'n,x=map(int,input().split())\nX=list(map(int,input().split()))\nfor i in range(n):\n X[i]=abs(X[i]-x)\ndef gcd(p,q):\n if q==0:\n return p\n else:\n return gcd(q,p%q)\nstack=X[0]\nfor i in range(n-1):\n stack=gcd(stack,X[i+1])\nprint(stack)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s140139088', 's982387910', 's471607402']
[14252.0, 15020.0, 15020.0]
[54.0, 66.0, 110.0]
[221, 234, 238]
p03262
u013629972
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\n\n\nsys.setrecursionlimit(10**7)\ninf = 10 ** 20\neps = 1.0 / 10**10\nmod = 10**9+7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef I(): return int(sys.stdin.readline())\ndef F(): return float(sys.stdin.readline())\ndef S(): return input()\ndef pf(s): return print(s, flush=True)\n\n\nN, X = LI()\nX_list = LI()\nX_list.sort()\n\nbisect.insort_left(X_list, X)\n# print(X_list)\nX_diff = [j-i for i, j in zip(X_list[:-1], X_list[1:])]\nprint(min(X_diff)\n', 'import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\n\n\nsys.setrecursionlimit(10**7)\ninf = 10 ** 20\neps = 1.0 / 10**10\nmod = 10**9+7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef LS(): return sys.stdin.readline().split()\ndef I(): return int(sys.stdin.readline())\ndef F(): return float(sys.stdin.readline())\ndef S(): return input()\ndef pf(s): return print(s, flush=True)\n\n\nN, X = LI()\nX_list = LI()\nX_list.sort()\n\nbisect.insort_left(X_list, X)\n# print(X_list)\nX_diff = [j-i for i, j in zip(X_list[:-1], X_list[1:])]\nresult = min(X_diff)\n\n\n\n\nfor i in range(result+1, 0, -1):\n if all(x % i == 0 for x in X_diff):\n print(i)\n exit()\n\n']
['Runtime Error', 'Accepted']
['s604270272', 's405625312']
[3064.0, 16636.0]
[18.0, 359.0]
[872, 1095]
p03262
u017063101
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['def A(a,b):\n if a<b:\n tmp = a\n a = b\n b = tmp\n r = a % b\n while r!=0:\n a = b\n b = r\n r = a % b\n return b\nn,X=map(int,input().split())\nx=list(map(int,input().split()))\nx.append(X)\nx.sort()\nx2=[]\nfor i in range(1,n+1):\n x2.append(x[i]-x[i-1])\nprint(x2)\nif len(x2)==1:\n p=x2[0]\nelse:\n for i in range(n):\n if i==0:\n p=A(x2[i-1],x2[i])\n elif i!=1:\n p=A(p,x2[i])\nprint(p)\n\n', 'def A(a,b):\n if a<b:\n tmp = a\n a = b\n b = tmp\n r = a % b\n while r!=0:\n a = b\n b = r\n r = a % b\n return b\nn,X=map(int,input().split())\nx=list(map(int,input().split()))\nx.append(X)\nx.sort()\nx2=[]\nfor i in range(1,n+1):\n x2.append(x[i]-x[i-1])\nif len(x2)==1:\n p=x2[0]\nelse:\n for i in range(n):\n if i==0:\n p=A(x2[i-1],x2[i])\n elif i!=1:\n p=A(p,x2[i])\nprint(p)\n\n']
['Wrong Answer', 'Accepted']
['s613814506', 's241846603']
[19852.0, 20020.0]
[121.0, 118.0]
[460, 450]
p03262
u023077142
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['def gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\nN, X = [int(n) for n in input().split()]\nxs = [int(n) - X for n in input().split()]\n\nif all([n == xs[0] for n in xs]):\n m = min(xs)\n xs = [n - m for n in xs]\n g = gcd(max(xs[0], xs[1]), min(xs[0], xs[1]))\n for n in xs[2:]:\n g = gcd(max(g, n), min(g, n))\n print(g)\nelse:\n print(xs[0])\n', 'def gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\nN, X = [int(n) for n in input().split()]\nxs = [int(n) for n in input().split()]\n\nxs.append(X)\n\nm = min(xs)\nxs = [n - m for n in xs]\ng = gcd(max(xs[0], xs[1]), min(xs[0], xs[1]))\nfor n in xs[2:]:\n g = gcd(max(g, n), min(g, n))\nprint(g)']
['Runtime Error', 'Accepted']
['s212636152', 's547368857']
[14224.0, 14252.0]
[56.0, 124.0]
[394, 322]
p03262
u029022354
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['#coding: utf-8\nimport numpy as np\nimport fraction\nfrom functools import reduce\n\nn,x = list(map(int,input().split()))\n\ny = np.asarray(list(map(int,input().split())))\ny -= x\n\nprint(reduce(fraction.gcd, y))\n\n', '\n#coding: utf-8\nimport numpy as np\nfrom functools import reduce\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\nn,x = list(map(int,input().split()))\n\ny = np.asarray(list(map(int,input().split())))\ny -= x\ny = map(abs,y)\n\nprint(reduce(gcd, y))\n']
['Runtime Error', 'Accepted']
['s589689122', 's069354326']
[13668.0, 23112.0]
[152.0, 824.0]
[205, 261]
p03262
u037221289
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
["N,X = map(int,input().split(' '))\nL = list(map(int,input().split(' ')))\n\ndef algGCF(a,b):\n if a % b == 0:\n return b\n else:\n return algGCF(b,a%b)\nGCF = abs(X-L[0])\nfor i in range(1,N):\n GCF = algGCF(GCF,X-L[i])\nprint(GCF) ", "N,X = map(int,input().split(' '))\nL = list(map(int,input().split(' ')))\n\ndef algGCF(a,b):\n if a % b == 0:\n return b\n else:\n return algGCF(b,a%b)\nGCF = abs(X-L[0])\nfor i in range(1,N):\n GCF = algGCF(GCF,abs(X-L[i]))\nprint(GCF) \n \n "]
['Wrong Answer', 'Accepted']
['s204559426', 's963047812']
[14224.0, 14224.0]
[99.0, 91.0]
[231, 242]
p03262
u044952145
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['import math\nfrom functools import reduce\n\nN, X = [int(c) for c in input().split()]\nx = [int(c) for c in input().split()]\n\nif N == 1:\n print(abs(x[0] - X))\nelse:\n x.append(X)\n x.sort()\n print(x)\n x = [n - x[0] for n in x]\n print(x)\n D = reduce(math.gcd, x)\n print(D)', '#import math\nfrom functools import reduce\n\nN, X = [int(c) for c in input().split()]\nx = [int(c) for c in input().split()]\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\nif N == 1:\n print(abs(x[0] - X))\nelse:\n x.append(X)\n x.sort()\n x = [n - x[0] for n in x]\n D = reduce(gcd, x)\n print(D)']
['Runtime Error', 'Accepted']
['s684677683', 's956994765']
[14756.0, 14724.0]
[121.0, 114.0]
[289, 325]
p03262
u044964932
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['from fractions import gcd\n\n\ndef main():\n n, s = map(int, input().split())\n xs = sorted(list(map(int, input().split())))\n\n for i, x in enumerate(xs):\n if i == 0:\n ans = x-s\n else:\n ans = gcd(ans, x-s)\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'from math import gcd\n\n\ndef main():\n n, x = map(int, input().split())\n xs = list(map(int, input().split()))\n xs.append(x)\n xs.sort()\n diff = []\n for i in range(1, n+1):\n diff.append(xs[i] - xs[i-1])\n ans = diff[0]\n for i in range(1, n):\n ans = gcd(ans, diff[i])\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s192155747', 's739885148']
[21516.0, 20372.0]
[165.0, 92.0]
[300, 354]
p03262
u077337864
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['N, X = map(int, input().strip().split())\nxs = list(map(int, input().strip().split()))\n\nfor i in range(len(xs)):\n xs[i] = abs(xs[i] - X)\n\nisis = False\nif N == 1:\n print(xs[0] - X)\n isis = True\n\nmax_dis = max(abs(xs[i] - xs[i+1]) for i in range(len(xs) - 1))\nmin_dis = min(abs(xs[i] - xs[i+1]) for i in range(len(xs) - 1))\na, b = max_dis, min_dis\nwhile isis:\n if b == 0:\n print(a)\n break\n c = a % b\n if c == 0:\n print(b)\n break\n a = b\n b = c', 'n, x = map(int, input().split())\nxlist = list(map(int, input().split()))\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a % b)\n\nmx = abs(xlist[0] - x)\nfor _x in xlist[1:]:\n mx = gcd(max(abs(_x-x), mx), min(abs(_x-x), mx))\nprint(mx)']
['Runtime Error', 'Accepted']
['s552901534', 's917750414']
[14100.0, 14252.0]
[99.0, 129.0]
[459, 253]
p03262
u092278825
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['N, X = map(int, input().split())\ncities = [int(i) for i in input().split()]\ncities.sort()\ndist = [int(abs(i-X)) for i in cities]\ndist.sort()\nprint(dist)\n \nif N==1:\n print(max(dist))\nelse:\n while len(dist)>0:\n m = min(dist)\n dist = [int(i%m) for i in dist]\n dist.sort()\n while len(dist)>0 and dist[0]==0:\n dist.remove(0)\n if len(dist)==0:\n break\n else:\n dist.append(m)\n print(m)', 'N, X = map(int, input().split())\ncities = [int(i) for i in input().split()]\ncities.sort()\ndist = [int(abs(i-X)) for i in cities]\ndist.sort()\n \nif N==1:\n print(max(dist))\nelse:\n while len(dist)>0:\n m = min(dist)\n dist = [int(i%m) for i in dist]\n dist.sort()\n while len(dist)>0 and dist[0]==0:\n dist.remove(0)\n if len(dist)==0:\n break\n else:\n dist.append(m)\n print(m)']
['Wrong Answer', 'Accepted']
['s147810270', 's716207997']
[16268.0, 14864.0]
[1648.0, 1652.0]
[461, 449]
p03262
u102126195
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['import fraction\nN, X = map(int, input().split())\nx = list(map(int, input().split()))\nx.sort()\nif N > 1:\n mini = x[1] - x[0]\n if mini > abs(X - x[0]) and abs(X - x[0]) != 0:\n mini = abs(X - x[0])\nelif N == 1:\n mini = abs(x[0] - X)\nfor i in range(1, N):\n if mini > x[i] - x[i - 1]:\n mini = x[i] - x[i - 1]\n if mini> abs(X - x[i]) and abs(X - x[i]) != 0:\n mini = abs(X - x[i])\n if (x[i] - x[i - 1]) % mini != 0:\n #break\n mini = fraction.gcd(mini, x[i] - x[i - 1])\n if abs(X - x[i]) % mini != 0:\n #break\n mini = fraction.gcd(mini, X - x[i])\n \n\nprint(mini)\n', 'import fractions\nN, X = map(int, input().split())\nx = list(map(int, input().split()))\nx.sort()\nif N > 1:\n mini = x[1] - x[0]\n if mini > abs(X - x[0]) and abs(X - x[0]) != 0:\n mini = abs(X - x[0])\nelif N == 1:\n mini = abs(x[0] - X)\nfor i in range(1, N):\n if mini > x[i] - x[i - 1]:\n mini = x[i] - x[i - 1]\n if mini> abs(X - x[i]) and abs(X - x[i]) != 0:\n mini = abs(X - x[i])\n if (x[i] - x[i - 1]) % mini != 0:\n #break\n mini = fractions.gcd(mini, x[i] - x[i - 1])\n if abs(X - x[i]) % mini != 0:\n #break\n mini = fractions.gcd(mini, X - x[i])\n \n\nprint(mini)\n']
['Runtime Error', 'Accepted']
['s289596601', 's152730701']
[3064.0, 16240.0]
[17.0, 176.0]
[629, 632]
p03262
u102242691
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['\nn,x = map(int,input().split())\nx = list(map(int,input().split()))\nl = [abs(i-x) for i in x]\n\n\ndef gcd(x,y):\n if y == 0:\n return x\n else:\n return gcd(y,x%y)\n\nans = l[0]\nfor i in range(1,n):\n ans = gcd(l[i],ans)\nprint(ans)', '\nn,x = map(int,input().split())\nx = list(map(int,input().split()))\nl = [abs(i-x) for i in x]\n\n\ndef gcd(x,y):\n if y == 0:\n return\n else:\n return gcd(y,x%y)\n\nans = l[0]\nfor i in range(1,n):\n ans = gcd(l[i],ans)\nprint(ans)', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\nnew_lst=[abs(i-x) for i in a]\n\ndef gcd(x,y):\n if y==0:\n return x\n else:\n return gcd(y,x%y)\n\nans=new_lst[0]\nfor i in range(1,n):\n\tans =gcd(new_lst[i],ans)\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s063071061', 's992919209', 's563047989']
[14224.0, 14252.0, 14224.0]
[42.0, 42.0, 90.0]
[272, 270, 251]
p03262
u102902647
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
["N, X = map(int, input().split())\nx_lst = [int(i) for i in input().split()]\n# N, X = map(int, '3 81'.split())\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\nres = [x_list[0]]\nfor i in range(1, N):\n res.append(gcd(res[i-1], x_list[i]))\nprint(min(res))", "N, X = map(int, input().split())\nx_list = [abs(int(i) - X) for i in input().split()]\n# N, X = map(int, '3 81'.split())\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\nres = [x_list[0]]\nfor i in range(1, N):\n res.append(gcd(res[i-1], x_list[i]))\nprint(min(res))"]
['Runtime Error', 'Accepted']
['s795607997', 's114943986']
[14252.0, 14252.0]
[46.0, 98.0]
[328, 338]
p03262
u107091170
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['N,X=map(int,input().split())\nx = list(map(int,input().split()))\nif not X in x:\n x.append(X)\nx.sort()\nd = []\nfor i in range(len(x)-1):\n d.append( x[i+1] - x[i] )\n\ndef GCD(a,b):\n if a%b==0: return b\n return GCD(b,a%b)\n\ng = d[0]\nlcm = d[0]\nfor i in range( len(d)-1 ):\n lcm = g * d[i+1] // GCD(g,d[i+1])\nprint(lcm)\n\n', 'N,X=map(int,input().split())\nx = list(map(int,input().split()))\nif not X in x:\n x.append(X)\nx.sort()\nd = []\nfor i in range(len(x)-1):\n d.append( x[i+1] - x[i] )\n\ndef GCD(a,b):\n if a%b==0: return b\n return GCD(b,a%b)\n\ng = d[0]\nfor i in range( len(d)-1 ):\n g = GCD(g,d[i+1])\nprint(g)\n']
['Wrong Answer', 'Accepted']
['s828605046', 's517101894']
[14252.0, 14252.0]
[188.0, 150.0]
[327, 297]
p03262
u116038906
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['\nimport math\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\n\nimport sys\n\nN,X = map(int, input().split())\nx = list(map(int, input().split()))\n\n\nx_div =[abs(X-x[0])] \nfor i in range(N):\n x_div.append(abs(x[i] -x[i+1]))\n\n\nif N ==1:\n ans =abs(x[0] -X)\nelse:\n ans =gcd_list(x_div)\nprint(ans)', '\nimport math\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\n\nimport sys\n\nN,X = map(int, input().split())\nx = list(map(int, input().split()))\n\n\nx_div =[abs(X-x[0])] \nfor i in range(N-1):\n x_div.append(abs(x[i] -x[i+1]))\n\n\nif N ==1:\n ans =abs(x[0] -X)\nelse:\n ans =gcd_list(x_div)\nprint(ans)']
['Runtime Error', 'Accepted']
['s512400919', 's438308122']
[20448.0, 20408.0]
[76.0, 79.0]
[569, 571]
p03262
u118642796
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['import fraction\n\nN,X = map(int,input().split())\nx = [int(i) for i in input().split()]\nans = abs(X-x[0])\nnow = X\nfor i in x:\n if abs(now - i) % ans:\n ans = fraction.gcd(ans, abs(now-i))\n now = i\n\nprint(ans)', 'def gcd(a,b):\n while b:\n a, b = b, a % b\n return a\nN,X = map(int,input().split())\nx = [int(i) for i in input().split()]\nans = abs(X-x[0])\nnow = X\nfor i in x:\n ans = gcd(ans, abs(now-i))\n now = i\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s484835905', 's211878352']
[3060.0, 14252.0]
[17.0, 87.0]
[218, 225]
p03262
u123745130
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['import fractions\nfrom functools import reduce\n\nn,x = map(int,input().split())\nlst=list(map(int,input().split()))\nnew_lst=[abs(i-x) for i in lst]\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\ndef gcd_list(numbers):\n return reduce(math.gcd, numbers)\n\nprint(gcd(*new_lst))\n', 'n,x = map(int,input().split())\nlst=list(map(int,input().split()))\nnew_lst=[abs(i-x) for i in lst]\n\ndef gcd(x,y):\n if y==0 : return x\n else: return gcd(y,x%y)\n#print(gcd(n,x))\n\nans=new_lst[0]\nfor i in range(1,n):\n\tans =gcd(new_lst[i],ans)\n \nprint(ans)']
['Runtime Error', 'Accepted']
['s274182519', 's229262011']
[16304.0, 15020.0]
[74.0, 88.0]
[280, 257]
p03262
u134387396
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['import math\nimport sys\n\nn, x = list(map(lambda x : int(x),input().split()))\n\nzahyo = list(map(lambda x : int(x),input().split()))\n\nzahyo.append(x)\nzahyo.sort()\n\nmin = zahyo[1] - zahyo[0]\n\nis_odd = False\nis_even = False\n\nodds = list()\n\nfor i in range(n):\n diff = zahyo[i+1] - zahyo[i]\n\n if diff % 2 == 0:\n is_even == True\n else:\n is_odd = True\n odds.append(diff)\n\n if diff < min:\n min = zahyo[i+1] - zahyo[i]\n\n# print(is_odd)\n# print(is_even)\nif len(odds) >= 1:\n for i in range(if len(odds)):\n for j in range(len(odds)):\n if math.gcd(odds[i], odds[j]) == 1:\n print(1)\n sys.exit()\n\n\nif is_odd == True and is_even == True:\n print(1)\nelse:\n print(min)\n', 'import math\nfrom functools import reduce\nimport fractions\nimport sys\n\n\ndef gcd(*numbers):\n return reduce(fractions.gcd,numbers)\n\nn, x = list(map(lambda x : int(x),input().split()))\n\nzahyo = list(map(lambda x : int(x),input().split()))\n\nzahyo.append(x)\nzahyo.sort()\n\nmin = zahyo[1] - zahyo[0]\n\nis_odd = False\nis_even = False\n\nodds = list()\n\nfor i in range(n):\n diff = zahyo[i+1] - zahyo[i]\n\n if diff % 2 == 0:\n is_even == True\n else:\n is_odd = True\n odds.append(diff)\n\n if diff < min:\n min = zahyo[i+1] - zahyo[i]\n\n# print(is_odd)\n# print(is_even)\nif is_odd == True and is_even == True or gcd(*odds) == 1:\n print(1)\n sys.exit()\n\n# print(gcd(*odds))\n\nprint(min)\n', 'import math\nfrom functools import reduce\nfrom fraction import gcd\nimport sys\n\n\ndef gcd(*numbers):\n return reduce(gcd,numbers)\n\nn, x = list(map(lambda x : int(x),input().split()))\n\nzahyo = list(map(lambda x : int(x),input().split()))\n\nzahyo.append(x)\nzahyo.sort()\n\nmin = zahyo[1] - zahyo[0]\n\nis_odd = False\nis_even = False\n\nodds = list()\n\nfor i in range(n):\n diff = zahyo[i+1] - zahyo[i]\n\n if diff % 2 == 0:\n is_even == True\n else:\n is_odd = True\n odds.append(diff)\n\n if diff < min:\n min = zahyo[i+1] - zahyo[i]\n\n# print(is_odd)\n# print(is_even)\nif is_odd == True and is_even == True or gcd(*odds) == 1:\n print(1)\n sys.exit()\n\n# print(gcd(*odds))\n\nprint(min)\n', 'import math\nfrom functools import reduce, gcd\nimport sys\n\n\ndef gcd(*numbers):\n return reduce(gcd,numbers)\n\nn, x = list(map(lambda x : int(x),input().split()))\n\nzahyo = list(map(lambda x : int(x),input().split()))\n\nzahyo.append(x)\nzahyo.sort()\n\nmin = zahyo[1] - zahyo[0]\n\nis_odd = False\nis_even = False\n\nodds = list()\n\nfor i in range(n):\n diff = zahyo[i+1] - zahyo[i]\n\n if diff % 2 == 0:\n is_even == True\n else:\n is_odd = True\n odds.append(diff)\n\n if diff < min:\n min = zahyo[i+1] - zahyo[i]\n\n# print(is_odd)\n# print(is_even)\nif is_odd == True and is_even == True or gcd(*odds) == 1:\n print(1)\n sys.exit()\n\n# print(gcd(*odds))\n\nprint(min)\n', 'import math\nfrom functools import reduce\nimport fractions\nimport sys\n\n\ndef gcd(*numbers):\n return reduce(fractions.gcd,numbers)\n\n\nn, x = list(map(lambda x : int(x),input().split()))\n\nzahyo = list(map(lambda x : int(x),input().split()))\n\nzahyo.append(x)\nzahyo.sort()\n\nmin = zahyo[1] - zahyo[0]\n\nis_odd = False\nis_even = False\n\nodds = list()\n\nfor i in range(n):\n diff = zahyo[i+1] - zahyo[i]\n\n if diff % 2 == 0:\n is_even == True\n else:\n is_odd = True\n odds.append(diff)\n\n if diff < min:\n min = zahyo[i+1] - zahyo[i]\n\n# print(is_odd)\n# print(is_even)\nif is_odd == True and is_even == True:\n print(1)\n sys.exit()\n\nelif is_odd == True:\n print(gcd(*odds))\nelse:\n\n print(min)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s054654870', 's219029814', 's892508787', 's965320866', 's525506872']
[3064.0, 16296.0, 3672.0, 3668.0, 16296.0]
[17.0, 158.0, 23.0, 23.0, 159.0]
[745, 709, 707, 687, 724]
p03262
u135197221
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['def mapt(fn, *args):\n return list(map(fn, *args))\n\n\ndef Input():\n return mapt(int, input().split(" "))\n\ndef main():\n N, X = Input()\n if N == 1:\n print(abs(N-X))\n exit()\n \n x = Input()\n x.append(X)\n x.sort()\n data = [abs(x[i] - x[i+1]) for i in range(N)]\n\n ans = data[0]\n for i in range(1, N):\n ans = gcd(data[i], ans)\n print(ans)\n\n\n\nmain()', 'def mapt(fn, *args):\n return list(map(fn, *args))\n\n\ndef Input():\n return mapt(int, input().split(" "))\n\ndef main():\n N, X = Input()\n x = Input()\n\n if N == 1:\n print(abs(x[0] - X))\n exit()\n\n x.append(X)\n x.sort()\n data = [abs(x[i] - x[i+1]) for i in range(N)]\n\n ans = data[0]\n for i in range(1, N):\n ans = gcd(data[i], ans)\n print(ans)\n\n\n\nmain()', 'def mapt(fn, *args):\n return list(map(fn, *args))\n\n\ndef Input():\n return mapt(int, input().split(" "))\n\ndef main():\n N, X = Input()\n x = Input()\n\n data = [abs(X - x[i]) for i in range(N)]\n ans = data[0]\n for i in range(1, len(data)):\n ans = gcd(data[i], ans)\n print(ans)\n\n\n\nmain()', 'def gcd(a, b):\n \n if b == 0: return a\n return gcd(b, a % b)\n \n\ndef mapt(fn, *args):\n return list(map(fn, *args))\n \n \ndef Input():\n return mapt(int, input().split(" "))\n \ndef main():\n N, X = Input()\n x = Input()\n \n if N == 1:\n print(abs(x[0] - X))\n exit()\n \n x.append(X)\n x.sort()\n data = [abs(x[i] - x[i+1]) for i in range(N)]\n \n ans = data[0]\n for i in range(1, N):\n ans = gcd(data[i], ans)\n print(ans)\n \n \n \nmain()']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s609527449', 's646350271', 's961721764', 's471323630']
[19976.0, 19932.0, 19976.0, 20388.0]
[80.0, 79.0, 62.0, 102.0]
[400, 398, 311, 501]
p03262
u141786930
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['# C - Skip\n\nimport numpy as np\nimport fractions\n\nN, X = map(int, input().split())\nx = list(int(x) for x in input().split())\nx.append(X)\nx.sort()\nx = np.array(x)\nx = x - x[0]\n\nans = 10**18\nif N == 1:\n print(x[1] - x[0])\nelse:\n for i in range(N-1):\n ans = min(ans, fractions.gcd(x[i], x[i+1]))\n print(ans)', '# C - Skip\n\nimport numpy as np\nimport fractions\n\nN, X = map(int, input().split())\nx = list(int(x) for x in input().split())\nx.append(X)\nx.sort()\nx = np.array(x)\nx = x - x[0]\n\nans = 10**18\nif N == 1:\n print(x[1] - x[0])\nelse:\n for i in range(N):\n ans = fractions.gcd(ans, fractions.gcd(x[i], x[i+1]))\n print(ans)', '# C - Skip\n\ndef gcd(x, y):\n if x == 0:\n return y\n else:\n return gcd(y%x, x)\n\nN, X = map(int, input().split())\nx = list(int(x) for x in input().split())\nx.append(X)\nx.sort()\nstnd = x[0]\nfor i in range(N+1):\n x[i] -= stnd\n\nans = gcd(x[0], x[1])\nfor i in range(1, N):\n ans = gcd(ans, gcd(x[i], x[i+1]))\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s090083833', 's463963973', 's158156459']
[25008.0, 24908.0, 14252.0]
[433.0, 495.0, 204.0]
[319, 327, 336]
p03262
u163320134
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['def gcd(a,b):\n if b==0:\n return a\n else:\n return gcd(b,a%b)\n \nn,x=map(int,input().split())\narr=list(map(int,input().split()))\narr.append(x)\narr=sorted(arr)\narr2=[]\nfor i in range(n-1):\n arr2.append(arr[i+1]-arr[0])\nif n==1:\n print(abs(arr[0]-x))\nelse:\n ans=gcd(arr2[0],arr2[1])\n for i in range(1,n):\n ans=gcd(ans,arr2[i])\n print(ans)', 'def gcd(a,b):\n if b==0:\n return a\n else:\n return gcd(b,a%b)\n \nn,x=map(int,input())\narr=list(map(int,input().split()))\narr.append(x)\narr=sorted(arr)\narr2=[]\nfor i in range(n-1):\n arr2.append(arr[i+1]-arr[0])\nif n==1:\n print(abs(arr[0]-x))\nelse:\n ans=gcd(arr2[0],arr2[1])\n for i in range(1,n):\n ans=gcd(ans,arr2[i])\n print(ans)', 'def gcd(a,b):\n if b==0:\n return a\n else:\n return gcd(b,a%b)\n \nn,x=map(int,input().split())\narr=list(map(int,input().split()))\narr.append(x)\narr=sorted(arr)\narr2=[]\nfor i in range(n):\n arr2.append(arr[i+1]-arr[0])\nif n==1:\n print(arr2[0])\nelse:\n ans=gcd(arr2[0],arr2[1])\n for i in range(1,n):\n ans=gcd(ans,arr2[i])\n print(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s309540864', 's773815344', 's728779604']
[14224.0, 3064.0, 14252.0]
[151.0, 17.0, 148.0]
[350, 342, 342]
p03262
u165133750
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['from functools import reduce\nfrom math import gcd\n\nn, x = map(int, input().split())\na = [abs(int(A) - x) for A in input().split()]\na.sort()\nprint(a)\nprint(reduce(gcd, a))\n', 'from functools import reduce\nfrom math import gcd\n\nn, x = map(int, input().split())\na = [abs(int(A) - x) for A in input().split()]\na.sort()\nprint(reduce(gcd, a))\n']
['Wrong Answer', 'Accepted']
['s702583232', 's102311047']
[20612.0, 20632.0]
[105.0, 77.0]
[171, 162]
p03262
u172035535
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['N,A = map(int,input().split())\nX = sorted(map(int,input().split()))\nY = []\nfor x in X:\n Y.append(abs(A-x))\nans = Y[0]%Y[1]\nfor y in Y:\n for i in range(y-1,0,-1):\n if y%i == 0:\n ans = max(ans,i)\n break\nprint(ans)', 'N,S = map(int,input().split())\nX = list(map(int,input().split()))\n\ndef gcd(a,b):\n if b == 0:\n return a\n return gcd(b,a%b)\n\nnew_X = []\nfor x in X:\n new_X.append(abs(S-x))\n\nans = new_X[0]\nfor x in new_X:\n ans = min(ans,gcd(ans,x))\nprint(ans)']
['Runtime Error', 'Accepted']
['s408762655', 's375298899']
[15020.0, 14252.0]
[2104.0, 128.0]
[246, 258]
p03262
u177040005
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['def gcd(a,b):\n if b == 0:\n return abs(a)\n else:\n return gcd(b, a%b)\n\n\nN,St = map(int, input().split())\nX = list(map(int,input().split()))\n\nif not(St in X):\n X.append(St)\nX = sorted(X)\n\ndel_X = []\nfor i in range(len(X)-1):\n del_X.append(X[i+1] - X[i])\ndel_X = sorted(list(set(del_X)))\n\n# print(X)\n# print(del_X)\n\nfor i in range(len(del_X)):\n if i == 0:\n tmp = gcd(del_X[i],del_X[i])\n else:\n tmp = gcd(tmp, X_del[i])\nprint(tmp)\n', 'def gcd(a,b):\n if b == 0:\n return abs(a)\n else:\n return gcd(b, a%b)\n\n\nN,St = map(int, input().split())\nX = list(map(int,input().split()))\n\nX.append(St)\nX = sorted(X)\n\ndel_X = []\nfor i in range(N):\n del_X.append(X[i+1] - X[i])\ndel_X = sorted(list(set(del_X)))\n\n# print(X)\n# print(del_X)\n\nfor i in range(len(del_X)):\n if i == 0:\n tmp = gcd(del_X[i],0)\n else:\n tmp = gcd(tmp, del_X[i])\nprint(tmp)\n']
['Runtime Error', 'Accepted']
['s428143895', 's727785931']
[14252.0, 14252.0]
[111.0, 126.0]
[472, 437]
p03262
u189188797
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['import fractions\nn,m=map(int,input().split())\ntosi = list(map(int,input().split()))\nfor i in range(n):\n tosi[i]=abs(m-tosi[i])\nanswer=min(tosi)\nprint(tosi)\nwhile max(tosi)!=0:\n for i in range(n):\n if tosi[i]%answer==0:\n tosi[i]=0\n else:\n answer=fractions.gcd(answer,tosi[i])\nprint(answer)', 'import fractions\nn,m=map(int,input().split())\ntosi = list(map(int,input().split()))\nfor i in range(n):\n tosi[i]=abs(m-tosi[i])\nanswer=min(tosi)\nwhile max(tosi)!=0:\n for i in range(n):\n if tosi[i]%answer==0:\n tosi[i]=0\n else:\n answer=fractions.gcd(answer,tosi[i])\nprint(answer)']
['Wrong Answer', 'Accepted']
['s543035035', 's278781752']
[16280.0, 16280.0]
[136.0, 123.0]
[330, 318]
p03262
u192541825
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['def gcd(a,b):\n if b==0:\n return a\n else:\n gcd(b,a%b)\n\n\nn,x=map(int,input().split())\n\nif n==1:\n a=int(input())\n print(abs(a-x))\n exit()\nelse:\n str=input()\n lst=str.split(" ")\n a=int(lst[0])\n b=int(lst[1])\n maxim=gcd(abs(a-x),abs(b-x))\n for i in range(2,n):\n c=int(lst[i])\n maxim=gcd(maxim,abs(c-x))\nprint(maxim)\n', 'def gcd(a,b):\n if b==0:\n return a\n else:\n return gcd(b,a%b)\n\n\nn,x=map(int,input().split())\n\nif n==1:\n a=int(input())\n print(abs(a-x))\n exit()\nelse:\n str=input()\n lst=str.split(" ")\n a=int(lst[0])\n b=int(lst[1])\n maxim=gcd(abs(a-x),abs(b-x))\n for i in range(2,n):\n c=int(lst[i])\n maxim=gcd(maxim,abs(c-x))\nprint(maxim)\n']
['Runtime Error', 'Accepted']
['s422954692', 's258712313']
[11096.0, 11096.0]
[26.0, 103.0]
[372, 379]
p03262
u212952060
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['n, x = map(int, input().split())\nc = list(map(int, input().split()))\nc = set([abs(x-c[i]) for i in range(n)])\nl = min(c)\nf = [l]\nif l < 999999999:\n for i in range(1, l):\n if l % i == 0:\n f.append(i)\nfor i in range(len(f), 0, -1):\n d = True\n for item in c:\n if item % f[i-1] != 0:\n d = False\n if d:\n print(f[i-1])\n break', 'n, x = map(int, input().split())\nc = list(map(int, input().split()))\nc = set([abs(x-c[i]) for i in range(n)])\nl = min(c)\nf = [l]\nif n > 1:\n for i in range(1, l):\n if l % i == 0:\n f.append(i)\nfor i in range(len(f), 0, -1):\n d = True\n for item in c:\n if item % f[i-1] != 0:\n d = False\n if d:\n print(f[i-1])\n break', 'n, x = map(int, input().split())\nc = list(map(int, input().split()))\nc = set([abs(x-c[i]) for i in range(n)])\nl = min(c)\nf = [l]\nif l < 100000000:\n for i in range(1, l):\n if l % i == 0:\n f.append(i)\nfor i in range(len(f), 0, -1):\n d = True\n for item in c:\n if item % f[i-1] != 0:\n d = False\n if d:\n print(f[i-1])\n break\n', 'n, x = map(int, input().split())\nc = list(map(int, input().split()))\nc = set([abs(x-c[i]) for i in range(n)])\nl = min(c)\nfor i in range(l+1, 0, -1):\n if l % i == 0:\n d = True\n for item in c:\n if item % i != 0:\n d = False\n if d:\n print(i)\n break']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s150441613', 's736337648', 's788071903', 's345734833']
[17680.0, 17680.0, 17836.0, 17836.0]
[1786.0, 1780.0, 1782.0, 1826.0]
[381, 373, 382, 316]
p03262
u219180252
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['from functools import reduce\nN, X = map(int, input().split())\nloc = list(map(int, input().split()))\n\na = min([abs(l-X) for l in loc])\nb = reduce(lambda x, y: abs(x-y), sorted(loc)[:2])\nprint(a,b)\nif max([a,b]) % min([a,b]):\n print(abs(min(loc)-X))\nelse:\n print(min([a,b]))', 'from functools import reduce\nN, X = map(int, input().split())\nloc = list(map(int, input().split()))\n\n\ndef gcd(a,b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\n\nprint(reduce(gcd, [abs(l-X) for l in loc]))']
['Wrong Answer', 'Accepted']
['s508397757', 's106926038']
[14596.0, 14748.0]
[97.0, 88.0]
[278, 230]
p03262
u231095456
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['def gcd(n,m):\n n,m = max(n,m),min(n,m)\n r = n % m\n while r > 0:\n n,m = m,r\n r = n % m\n return m\nN,X = map(int,input().split())\nx = [X - y for y in list(map(int,input().split()))]\nans = x[0]\nfor i in range(1,N):\n ans = gcd(ans, x[i])\nprint(abs(ans))', 'from math import gcd\nN,X = map(int,input().split())\ng = None\nfor x in map(int,input().split()):\n if g == None:\n g = x-X\n else:\n g = gcd(g,x-X)\nprint(abs(g))']
['Wrong Answer', 'Accepted']
['s583771138', 's522107157']
[14252.0, 17176.0]
[110.0, 64.0]
[277, 176]
p03262
u231936499
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['N,X=map(int,input().split())\nx_list=list(map(int,input().split()))\n\nx_list.append(X)\nx_list_new=sorted(x_list)\nx_list_new_dif=[x_list_new[i+1]-x_list_new[i] for i in range(len(x_list_new)-1)]\n\nmin(x_list_new_dif)', 'def gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return(a)\n\nN,X=map(int,input().split())\nx_list=list(map(int,input().split()))\n\n#x_list.append(X)\n\nx_list_new_dif=[abs(x_list_new[i]-X) for i in range(len(x_list_new))]\n\nfor i in range(len(x_list_new_dif)):\n if i==0:\n skip=x_list_new_dif[0]\n else:\n skip=gcd(skip,x_list_new_dif[i])\nprint(skip)', 'def gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return(a)\n\nN,X=map(int,input().split())\nx_list=list(map(int,input().split()))\n\n#x_list.append(X)\nx_list_new=sorted(x_list)\nx_list_new_dif=[abs(x_list_new[i]-X) for i in range(len(x_list_new))]\n\nfor i in range(len(x_list_new_dif)):\n if i==0:\n skip=x_list_new_dif[0]\n else:\n skip=gcd(skip,x_list_new_dif[i])\nprint(skip)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s036177929', 's701389932', 's283502541']
[15020.0, 14228.0, 14224.0]
[95.0, 43.0, 129.0]
[212, 390, 389]
p03262
u239342230
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['N, X = map(int, input().split())\nx_list = list(map(int, input().split()))\n\ndef gcd(l):\n x = max(l)\n y = min(l)\n if x % y == 0:\n return y\n else:\n while x%y!=0:\n z = x%y\n x = y\n y = z\n else:\n return z\n \nif N == 1:\n print(x_list[0] - X)\n exit()\n\nvalues = np.sort(np.array(x_list))[1:] - min(x_list)\nprint(gcd(values))\n\n', 'N, X = map(int, input().split())\nx_list = list(map(int, input().split()))\nx_list.append(X)\ndef gcd_1(l):\n x = max(l)\n y = min(l)\n if x % y == 0:\n return y\n else:\n while x%y!=0:\n z = x%y\n x = y\n y = z\n else:\n return z\n \nif N == 1:\n print(x_list[0] - X)\n exit()\n\nvalues = np.sort(np.array(x_list))[1:] - min(x_list)\n\nif N == 2:\n print(values[0])\n exit()\n\nprint(gcd_1(values))\n\n', 'N,X=map(int,input().split())\nx=list(map(int,input().split()))\nx.append(X)\nmx=min(x)\nx=list(map(lambda t:t-mx,x))\ndef gcd(a,b):\n while b:\n a,b=b,a%b\n return(a)\na=10**10\nfor i,j in zip(x,x[1:]):\n a=min(a,gcd(i,j))\nprint(a)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s270826553', 's561321290', 's665327570']
[14252.0, 14252.0, 14252.0]
[42.0, 48.0, 180.0]
[406, 471, 236]
p03262
u247211039
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['import math\nfrom functools import reduce\nN, X = map(int, input().slpit())\nx = list(map(int,input().split()))\n \nfor i in range(N):\n x[i] = abs(x[i]-X)\n \nx = sorted(x)[::-1]\ncnt = 0\n \nfor i in range(N):\n cnt = math.gcd(cnt, x[i])\n \nprint(cnt)', 'import fractions\nfrom functools import reduce\nN, X = map(int, input().split())\nx = [int(input()) for i in range(N)]\n\n\nx.insert(0,X)\nx = sorted(x)\n\ny = [0 for i in range(N)]\n\nfor i in range(N):\n y[i] = x[i+1]-x[i]\n\ndef gcd(*numbers):\n return reduce(fractions.gcd, numbers)\n\ndef gcd_list(numbers):\n return reduce(fractions.gcd, numbers)\n\nprint(gcd(*y))', 'import fractions\nfrom functools import reduce\nN, X = map(int, input().split())\nx = [int(input()) for i in range(N)]\n \n \nx.insert(0,X)\nx = sorted(x)\n \ny = [0]*N\n \nfor i in range(N):\n y[i] = x[i+1]-x[i]\n \ndef gcd(*numbers):\n return reduce(fractions.gcd, numbers)\n \ndef gcd_list(numbers):\n return reduce(fractions.gcd, numbers)\n \nprint(gcd(*y))', 'import math\nfrom functools import reduce\nN, X = map(int, input().slpit())\nx = [int(input()) for i in range(N)]\n\nfor i in range(N):\n x[i] = abs(x[i]-X)\n\nx = sorted(x)[::-1]\ncnt = 0\n\nfor i in range(N):\n cnt = math.gcd(cnt, x[i])\n\nprint(cnt)', 'import math\nfrom functools import reduce\nN, X = map(int, input().split())\nx = list(map(int,input().split()))\n \nfor i in range(N):\n x[i] = abs(x[i]-X)\n \nx = sorted(x)[::-1]\ncnt = 0\n \nfor i in range(N):\n cnt = math.gcd(cnt, x[i])\n \nprint(cnt)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s137046905', 's266516778', 's635710666', 's678317295', 's929540492']
[9288.0, 12084.0, 12048.0, 9428.0, 20324.0]
[32.0, 38.0, 41.0, 27.0, 106.0]
[246, 359, 350, 244, 246]
p03262
u255898796
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['def make_divisors(n):\n lower_divisors , upper_divisors = [], []\n i = 1\n while i*i <= n:\n if n % i == 0:\n lower_divisors.append(i)\n if i != n // i:\n upper_divisors.append(n//i)\n i += 1\n return lower_divisors + upper_divisors[::-1]\n \na = [int(s) for s in input().split()]\nN = a[0]\nst = a[1]\nmini = int(-1)\nb = [int(s) for s in input().split()]\n\nfor i in range(N):\n if abs(b[i] - st) < mini or mini == -1:\n mini = abs(b[i] - st)\n\nyakulist = make_divisors(mini)\ngyakulist = sorted(yakulist, reverse=True)\nkazu = len(gyakulist)\nprint(kazu)\nflag = int(0)\n\nfor i in range(kazu):\n for j in range(N):\n if abs(b[j] - st) % gyakulist[i] != 0:\n flag = 1\n else:\n pass\n if flag == 0:\n print(gyakulist[i])\n break\n ', 'def make_divisors(n):\n lower_divisors , upper_divisors = [], []\n i = 1\n while i*i <= n:\n if n % i == 0:\n lower_divisors.append(i)\n if i != n // i:\n upper_divisors.append(n//i)\n i += 1\n return lower_divisors + upper_divisors[::-1]\n \na = [int(s) for s in input().split()]\nN = a[0]\nst = a[1]\nmini = int(-1)\nb = [int(s) for s in input().split()]\n\nfor i in range(N):\n if abs(b[i] - st) < mini or mini == -1:\n mini = abs(b[i] - st)\n\nyakulist = make_divisors(mini)\ngyakulist = sorted(yakulist, reverse=True)\nkazu = len(gyakulist)\nflag = int(0)\n\nfor i in range(kazu):\n for j in range(N):\n if abs(b[j] - st) % gyakulist[i] != 0:\n flag = 1\n else:\n pass\n if flag == 0:\n print(gyakulist[i])\n break\n else:\n flag = 0']
['Wrong Answer', 'Accepted']
['s399733443', 's770535415']
[20444.0, 20340.0]
[605.0, 150.0]
[834, 844]
p03262
u259755734
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['N, X = map(int, input().split())\nX = list(map(int, input().split())\n\nmin_dist = abs(X - min(L))\n\nans = 1\n\nfor d in range(min_dist, 0, -1):\n b = all((x - X) % d == 0 for x in L)\n if b:\n print(d)\n break\n', 'N, X = map(int, input().split())\nX = list(map(int, input().split()))\n\nmin_dist = abs(X - min(L))\n\nans = 1\n\nfor d in range(min_dist, 0, -1):\n b = all((x - X) % d == 0 for x in L)\n if b:\n print(d)\n break\n', 'import math\nfrom functools import reduce\n\ndef gcd(ns):\n return reduce(math.gcd, ns)\n\nN, X = map(int, input().split())\nL = list(map(int, input().split()))\n\ndiff = [abs(x - X) for x in L]\n\nif len(diff) == 1:\n print(diff[0])\nelse:\n print(gcd(diff))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s570582494', 's971021551', 's841579057']
[8956.0, 20044.0, 20336.0]
[28.0, 47.0, 68.0]
[221, 222, 255]
p03262
u267325300
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['import fraction\n\nN, X = map(int, input().split())\n\nx = list(map(int, input().split()))\n\ndist_list = [abs(X - e) for e in x]\nans = dist_list[0]\nfor e in dist_list:\n ans = fraction.gcd(e, ans)\n\n\nprint(ans)\n', 'def gcd(x, y):\n while y != 0:\n temp = y\n y = x % y\n x = temp\n return x\n\n\nN, X = map(int, input().split())\n\nx = list(map(int, input().split()))\n\ndist_list = [abs(X - e) for e in x]\n\nans = dist_list[0]\nfor e in dist_list:\n ans = gcd(ans, e)\n\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s329573155', 's766179257']
[2940.0, 14224.0]
[17.0, 86.0]
[207, 282]
p03262
u275934251
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
["def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\nN, X = map(int, input().split())\nx = [int(_) for _ in input().split(' ')]\n\ndist = [abs(i - X) for i in x]\n\nans = dist[0]\n\nfor i in range(N):\n ans = gcd(ans, dist[i])\n\nprint(ans)", "N, X = map(int, input().split())\n \narr = [int(_) for _ in input().split(' ')]\narr.sort()\n \na = 1000000000000\n \n \nfor i in range(N-1):\n if abs(arr[i+1]-arr[i]) < a:\n a = abs(arr[i+1]-arr[i])\n \nfor j in range(N):\n if abs(arr[j] - X) < a:\n a = abs(arr[j] - X)\n\nif X > arr[N] or X < arr[0]:\n a = 1\n \nprint(a)", "def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\nN, X = map(int, input().split())\nx = [int(_) for _ in input().split(' ')]\n\ndist = [abs(i - X) for i in x]\n\nans = dist[0]\n\nfor i in range(N-1):\n ans = gcd(ans, dist[i+1])\n\nprint(ans)"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s416559248', 's605080369', 's761101199']
[14252.0, 14224.0, 14252.0]
[79.0, 124.0, 88.0]
[250, 327, 250]
p03262
u277236383
2,000
1,048,576
There are N cities on a number line. The i-th city is located at coordinate x_i. Your objective is to visit all these cities at least once. In order to do so, you will first set a positive integer D. Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like: * Move 1: travel from coordinate y to coordinate y + D. * Move 2: travel from coordinate y to coordinate y - D. Find the maximum value of D that enables you to visit all the cities. Here, to visit a city is to travel to the coordinate where that city is located.
['def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n divisors.sort()\n return divisors\n\ndef make_codivisors(n):\n divisors = []\n n0divisors = make_divisors(n[0])\n n0len = len(n0divisors)\n for i in n0divisors:\n for j in range(1, len(n)):\n if n[j] % i != 0:\n break\n if j == len(n)-1:\n divisors.append(i)\n \n \n return max(divisors)\n\n\nn, x = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(x)\na.sort()\nb = [a[i]-a[i-1] for i in range(1, n+1)]\n\nprint(b)\nprint(a)\n\nprint(make_codivisors(b))', 'def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n divisors.sort()\n return divisors\n\ndef make_codivisors(n):\n divisors = []\n n0divisors = make_divisors(n[0])\n n0len = len(n0divisors)\n for i in n0divisors:\n for j in range(1, len(n)):\n if n[j] % i != 0:\n break\n if j == len(n)-1:\n divisors.append(i)\n \n \n return max(divisors)\n\n\nn, x = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(x)\na.sort()\nb = [a[i]-a[i-1] for i in range(1, n+1)]\n\n#print(b)\n#print(a)\nif len(b) >= 2:\n print(make_codivisors(b))\nelse:\n print(b[0])']
['Runtime Error', 'Accepted']
['s712011112', 's443952363']
[15376.0, 14480.0]
[363.0, 335.0]
[768, 807]