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
u480172743
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\ns = [input() for i in range(n)]\n\ndef shiritori(s):\n if len(s) != len(set(s)):\n return "No"\n \n for i in range(n-1):\n if s[i][-1] != s[i+1][0]:\n return "No"\n \n return "Yes"\n\nshiritori()', 'n = int(input())\n\ns_list = []\nfor i in range(n):\n s = input()\n s_list.append(s)\n\ndef shiritori():\n if len(s_list) != len(set(s_list)):\n return "No"\n \n for i in range(n-1):\n if s_list[i][-1] != s_list[i+1][0]:\n return "No"\n \n return "Yes"', 'n = int(input())\n\ns = [input() for i in range(n)]\n\ndef shiritori(s):\n if len(s) != len(set(s)):\n return False\n \n for i in range(n-1):\n if s[i][-1] != s[i+1][0]:\n return False\n \n return True\n\nif __name__ == \'__main__\':\n if shiritori(s):\n print("Yes")\n else:\n print("No")']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s790347199', 's949702102', 's705711502']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[217, 255, 293]
p03261
u484856305
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 i in range(N)]\nprint(S)\nans='Yes'\nif len(set(S))!=N:\n ans='No'\nfor i in range(N-1):\n if S[i][-1]!=S[i+1][0]:\n ans='No'\nprint(ans)", "N=int(input())\nS=[input() for i in range(N)]\nans='Yes'\nif len(set(S))!=N:\n ans='No'\nfor i in range(N-1):\n if S[i][-1]!=S[i+1][0]:\n ans='No'\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s550147736', 's633543490']
[3064.0, 3060.0]
[18.0, 17.0]
[172, 163]
p03261
u486251525
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())\npast = []\nlast = ""\nfor i in range(N):\n W = input()\n print("past:", past)\n print("W[0]:", W[0])\n print("last[-1]:", last[-1:])\n if last == "":\n past.append(W)\n last = W\n elif W in past or W[0] != last[-1:]:\n print("No")\n exit()\n else:\n past.append(W)\n last = W\nprint("Yes")\n', 'N = int(input())\npast = []\nlast = ""\nSuccess = True\nfor i in range(N):\n W = input()\n # print("past:", past)\n # print("W[0]:", W[0])\n \n if last == "":\n past.append(W)\n last = W\n elif W in past or W[0] != last[-1:]:\n Success = False\n else:\n past.append(W)\n last = W\n\nif Success == True:\n print("Yes")\nelse:\n print("No")\n']
['Wrong Answer', 'Accepted']
['s895761254', 's847618174']
[3060.0, 3060.0]
[19.0, 17.0]
[354, 411]
p03261
u494058663
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\nimport collections\n\nN = int(input())\nList = [list(input()) for i in range(N)]\ntmp = []\n\nfor i in range(1,N-1):\n if (List[i][0] != List[i-1][-1]):\n print('No')\n sys.exit()\n tmp.append(str(List[i]))\n\n\nList_dict = collections.Counter(tmp)\nfor i,j in List_dict.items():\n if j != 1:\n print('No')\n sys.exit()\nprint('Yes')", "import sys\nN = int(input())\nList = [list(input()) for i in range(N)]\n\nfor i in range(1,N-1):\n if (List[i][0] != List[i-1][-1]):\n print('No')\n sys.exit()\n\nprint('Yes')", "import sys\nimport collections\n\nN = int(input())\nList = [list(input())]\nfor i in range(1,N):\n tmp = list(input())\n if (tmp in List) == True:\n print('No')\n sys.exit()\n List.append(list(tmp))\n \n if tmp[0] != List[i-1][-1]:\n print('No')\n sys.exit()\n\n\nprint('Yes')"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s190254474', 's249650539', 's378794624']
[3316.0, 3060.0, 3316.0]
[21.0, 17.0, 22.0]
[363, 183, 302]
p03261
u497625442
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 collecions\n\nN = int(input())\nW = [input() for i in range(N)]\nc = collecions.Counter(W)\n\nfor i in range(N-1):\n if W[i][-1] != W[i+1][1]:\n print("No")\n exit()\nif len(c) != N:\n print("No")\n exit()\nprint("Yes")', 'import collections\n\nN = int(input())\nW = [input() for i in range(N)]\nc = collections.Counter(W)\n\nfor i in range(N-1):\n if W[i][-1] != W[i+1][0]:\n print("No")\n exit()\nif len(c) != N:\n print("No")\n exit()\nprint("Yes")']
['Runtime Error', 'Accepted']
['s788113453', 's838022981']
[3064.0, 3444.0]
[17.0, 88.0]
[236, 238]
p03261
u502486340
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\nappeared = []\nprev = input()\nfor i in range(N-1):\n S = input()\n if prev[-1] != S[0] or S in appeared:\n print('No')\n exit()\n prev = S\n appeared += [S]\nprint('Yes')\n", "N = int(input())\n\nappeared = []\nprev = input()\nfor i in range(N-1):\n appeared += [prev]\n S = input()\n if prev[-1] != S[0] or S in appeared:\n print('No')\n exit()\n prev = S\nprint('Yes')\n"]
['Wrong Answer', 'Accepted']
['s904823633', 's589381200']
[2940.0, 2940.0]
[18.0, 18.0]
[207, 210]
p03261
u514894322
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())\nsl = [input() for _ in [0]*n]\nans = 'Yes'\nfor i in range(1,n):\n if sl[i-1][-1] != sl[i][0]:\n ans = 'No'\nprint(ans)", "n = int(input())\nsl = [input() for _ in [0]*n]\nans = 'Yes'\nfor i in range(1,n):\n if sl[i-1][-1] != sl[i][0] or sl.count(sl[i]) != 1 :\n ans = 'No'\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s011056896', 's275552793']
[3060.0, 3060.0]
[17.0, 17.0]
[135, 160]
p03261
u515952036
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 = []\nfor i in range(n):\n\tword.append(input())\n\nif is_unique(word) == False:\n\tprint("No")\n\texit()\n\nfor i in range(1,len(word)):\n\tif word[i-1][-1] != word[i][0]:\n\t\tprint("No")\n\t\texit()\n\nprint("Yes")', 'n = int(input())\nword = []\nfor i in range(n):\n\tword.append(input())\n\nif is_unique(word) == False:\n\tprint("No")\n\texit()\n\nfor i in range(1,len(word)):\n\tif word[i-1][-1] != word[i][-1]:\n\t\tprint("No")\n\t\texit()\n\nprint("Yes")', 'n = int(input())\nword = []\nfor i in range(n):\n\tword.append(input())\n\nif len(word) != len(set(word)):\n\tprint("No")\n\texit()\n\nfor i in range(1,len(word)):\n\tif word[i-1][-1] != word[i][0]:\n\t\tprint("No")\n\t\texit()\n\nprint("Yes")']
['Runtime Error', 'Runtime Error', 'Accepted']
['s068815923', 's212215826', 's308846984']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[218, 219, 221]
p03261
u518042385
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=[list(input())]\nb=True\nfor i in range(n-1):\n w=list(input())\n if l[-1][-1]==w[0]:\n l.append(w)\n else:\n b=False\n break\nif len(set(l))=n and b==True:\n print("Yes")\nelse:\n print("No")\n \n\n ', 'i=int(input())\nl=[]\nc=True\nfor k in range(1,i+1):\n l.append(list(input())\nif len(l)==len(set(l)):\n for k in range(0,i):\n if l[k][-1]!=l[k+1][0]:\n c=False\n break\nelse:\n c=False\nif c==False:\n print("No")\nelse:\n print("Yes")\n \n \n', 'n=int(input())\nl=[list(input())]\nb=True\nfor i in range(n-1):\n w=list(input())\n if l[-1][-1]==w[0]:\n l.append(w)\n else:\n b=False\n break\nif len(set(l))==n and b==True:\n print("Yes")\nelse:\n print("No")\n \n\n \n', 'i=int(input())\nl=[]\nc=True\nfor k in range(1,i+1):\n l.append(list(input())\nif len(l)==set(l):\n for k in range(0,i):\n if l[k][-1]!=l[k+1][0]:\n c=False\n break\nelse:\n c=False\nif c==False:\n print("No")\nelse:\n print("Yes")\n \n ', 'n=int(input())\nb=True\nl=[]\nw=input()\nl.append(w)\nfor i in range(n-1):\n w=input()\n if w in l or w[0]!=l[-1][-1]:\n b=False\n break\n else:\n l.append(w)\nif b:\n print("Yes")\nelse:\n print("No")\n ']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s319533601', 's686246627', 's803071839', 's930738616', 's539707813']
[2940.0, 2940.0, 3060.0, 2940.0, 3060.0]
[17.0, 17.0, 19.0, 17.0, 17.0]
[218, 257, 220, 251, 205]
p03261
u523964576
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=[]\nfor i in range(n):\n a.append(input())\nflag=0\nfor i in range(n):\n s=a[i]\n \n if i==0:\n continue\n else:\n if last!=a[i][len(a[i])-1]:\n flag=1\n \n last=a[i][len(a[i])-1]\nif flag==1:\n print("No")\nelse:\n print("Yes")', 'n=int(input())\na=[]\nfor i in range(n):\n a.append(input())\nb=[]\nflag=0\nfor i in range(n):\n s=a[i]\n if i!=0:\n if s[0]!=last:\n flag=1\n last=s[len(s)-1]\n if s in b:\n flag=1\n break\n b.append(s)\n \n \nif flag==1:\n print("No")\nelse:\n print("Yes")\n\n \n ']
['Runtime Error', 'Accepted']
['s584064709', 's637027552']
[3060.0, 3060.0]
[17.0, 17.0]
[280, 314]
p03261
u527261492
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())\nw=[input() for i in range(n)]\nif all(w[j][len(w[j])]==w[j+1][0] for j in range(n-1)) and len(set(w))==n:\n print('Yes')\n sys.exit()\nprint('No')", "import sys\nn=int(input())\nw=[input() for i in range(n)]\nif all(w[j][len(w[j])-1]==w[j+1][0] for j in range(n-1)) and len(set(w))==n:\n print('Yes')\n sys.exit()\nprint('No')\n"]
['Runtime Error', 'Accepted']
['s585345824', 's183018425']
[3060.0, 3060.0]
[18.0, 17.0]
[170, 173]
p03261
u527464580
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 = []\nflag = True\nword.append(input())\nfor _ in range(N - 1):\n w = input()\n if w in word:\n flag = False\n elif word[-1][-1] != w[0]:\n flag = False\n else:\n word.append(w)\n\nif flag:\n print('YES')\nelse:\n print('NO')\n", "N = int(input())\nword = []\nflag = True\nword.append(input())\nfor _ in range(N - 1):\n w = input()\n if w in word:\n flag = False\n elif word[-1][-1] != w[0]:\n flag = False\n else:\n word.append(w)\n\nif flag:\n print('Yes')\nelse:\n print('No')\n"]
['Wrong Answer', 'Accepted']
['s359498512', 's112257761']
[3060.0, 3060.0]
[18.0, 18.0]
[272, 272]
p03261
u527993431
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=[]\ncount=0\nfor i in range (N):\n\tL.append(int(input()))\nif len(set(L))!=N:\n\tprint("No")\nelse:\n\tfor i in range (N-1):\n\t\tif L[i][-1]!=L[i+1][0]:\n\t\t\tcount+=1\n\tif count==0:\n\t\tprint("Yes")\n\telse:\n\t\tprint("No")', 'N=int(input())\nL=[]\ncount=0\nfor i in range(N):\n\tL.append(input())\nM=len(set(L))\nfor i in range(N-1):\n\tif L[i][-1]==L[i+1][0]:\n\t\tcount+=1\nif M==N and count==N-1:\n\tprint("Yes")\nelse:\n\tprint("No")']
['Runtime Error', 'Accepted']
['s213339314', 's876814537']
[3060.0, 3064.0]
[17.0, 18.0]
[220, 193]
p03261
u529725069
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\n\na = []\nfor line in sys.stdin:\n a.append(int(line))\nN = len(a)\ncount = 0\nflag = True\nfor i in range(N):\n a_i = a[i]\n a_ii = a[i+1]\n if ai[-1] != a_ii[0]:\n flag = None\n break\n for j in range(i+1, N):\n if a[i] == a[j]:\n flag = None\n break\nif flag:\n print('Yes')\nelse:\n print('No')", "N = int(input())\na = []\nfor i in range(N):\n a.append(input())\nflag = True\nfor j in range(N-1):\n a_i = a[j]\n a_ii = a[j+1]\n if a_i[-1] != a_ii[0]:\n flag = None\n break\n for k in range(j+1, N):\n if a[j] == a[k]:\n flag = None\n break\nif flag:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s345660372', 's931722226']
[3064.0, 3064.0]
[17.0, 18.0]
[353, 334]
p03261
u533885955
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())\nshiri = []\nflag = 0\nfor i in range(N):\n tugi = str(input())\n tlist = list(tugi)\n if i!=0:\n if tugi in shiri:\n flag = 1\n break\n else:\n mae = list(shiri[i-1])\n if tlist[0]!=mae[-1]:\n flag = 1\n break\n else:\n shiri,append(tugi)\n else:\n shiri.append(tugi)\nif flag == 0:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nshiri = []\nfor i in range(N):\n tugi = str(input())\n tlist = list(tugi)\n if i!=0:\n if tugi in shiri:\n break\n else:\n mae = list(shiri[i-1])\n if tlist[0]!=mae[-1]:\n break\n else:\n shiri,append(tugi)\n else:\n shiri.append(tugi)', 'N = int(input())\nshiri = []\nflag = 0\nfor i in range(N):\n tugi = str(input())\n tlist = list(tugi)\n if i!=0:\n if tugi in shiri:\n flag = 1\n break\n else:\n mae = list(shiri[i-1])\n if tlist[0]!=mae[-1]:\n flag = 1\n break\n else:\n shiri.append(tugi)\n else:\n shiri.append(tugi)\nif flag == 0:\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Runtime Error', 'Accepted']
['s129108733', 's332842609', 's058491512']
[3064.0, 3060.0, 3064.0]
[18.0, 18.0, 18.0]
[453, 345, 453]
p03261
u535827181
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 = []\nfor i in range(N):\n A.append(input())\n\nfor i in range(N-1):\n S = 0\n if A[i][-1] == A[i+1][0]:\n S += 1\nfor i in range(N):\n for j in range(N):\n if i != j:\n if A[i] == A[j]:\n A == 1\n else:\n A == 0\n\nif S == 1 and A == 0:\n print('Yes')\nelse:", "N = int(input())\nA = []\nfor i in range(N):\n A.append(input())\nS = 0\nfor i in range(N-1):\n if A[i][-1] == A[i+1][0]:\n S += 1\nB = 0\nfor i in range(N):\n for j in range(N):\n if A[i] == A[j]:\n B += 1\n else:\n B += 0\n\nif S == N-1 and B == N:\n print('Yes')\nelse:\n print('No')", "N = int(input())\nA = []\nfor i in range(N):\n A.append(input())\nS = 0\nfor i in range(N-1):\n if A[i][-1] == A[i+1][0]:\n S += 1\n\nfor i in range(N):\n for j in range(N):\n if i != j:\n if A[i] == A[j]:\n B = 1\n else:\n B = 0\n\nif S == N-1 and B == 0:\n print('Yes')\nelse:\n print('No')", "N = int(input())\nA = []\nfor i in range(N):\n A.append(input())\nS = 0\nfor i in range(N-1):\n if A[i][-1] == A[i+1][0]:\n S += 1\nB = 0\nfor i in range(N):\n for j in range(N):\n if A[i] == A[j]:\n B += 1\n else:\n B += 0\n\nif S == N-1 and B == N:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s072618915', 's389926448', 's849106639', 's787622088']
[2940.0, 2940.0, 3064.0, 3064.0]
[17.0, 17.0, 19.0, 20.0]
[306, 332, 352, 324]
p03261
u536377809
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)]\n\nif len(set(w))!=len(w):\n print("No")\nelse:\n for i in range(1,n):\n if w[i][0]!=w[i-1][-1]:\n print("No")\n exit()\n\nprint("Yes")', 'n=int(input())\nw=[input() for _ in range(n)]\n\nif len(set(w))!=len(w):\n print("No")\nelse:\n for i in range(1,n):\n if w[i][0]!=w[i-1][-1]:\n print("No")\n exit()\n \n print("Yes")']
['Wrong Answer', 'Accepted']
['s845180248', 's481150858']
[3060.0, 3060.0]
[17.0, 17.0]
[185, 193]
p03261
u538739837
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.
['flag=True\nfor i in range(n):\n w.append(input())\n \nfor i in range(n-1):\n if w[i][-1]!=w[i+1][0]:\n #print(i,"out1")\n flag=False\n\nfor i in range(n-1):\n for j in range(i+1,n):\n if(w[i]==w[j]):\n #print(i,j,"out2")\n flag=False\n\nif flag==True:\n print("Yes")\nelse:\n print("No")\n\n\n', 'n=int(input())\nw=[]\nflag=True\nfor i in range(n):\n w.append(input())\n \nfor i in range(n-1):\n if w[i][-1]!=w[i+1][0]:\n #print(i,"out1")\n flag=False\n\nfor i in range(n-1):\n for j in range(i+1,n):\n if(w[i]==w[j]):\n #print(i,j,"out2")\n flag=False\n\nif flag==True:\n print("Yes")\nelse:\n print("No")\n\n\n']
['Runtime Error', 'Accepted']
['s447998382', 's680872350']
[3060.0, 3060.0]
[17.0, 18.0]
[333, 353]
p03261
u538808095
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\nshiritori_set = set()\n\nshiritori = input()\nhead = shiritori[len(shiritori) -1]\n\nans = "Yes"\n\nfor i in range(N-1):\n shiritori = input()\n if (shiritori[0] == head and shiritori not in shiritori_set):\n head = shiritori[len(shiritori)-1]\n shiritori_set.add(shiritori)\n continue\n else:\n ans = "No"\n break\n\nprint(ans)\n\n\n \n ', 'N = int(input())\n\nshiritori_set = set()\n\nshiritori = input()\nhead = shiritori[len(shiritori) -1]\n\nans = "Yes"\n\nfor i in range(N-1):\n shiritori = input()\n if (shirotori[0] == head and shiritori in shiritori_set):\n head = shiritori[len(shiritori)-1]\n shiritori_set.add(shiritori)\n continue\n else:\n ans = "No"\n break\n\nprint(ans)\n\n\n \n ', 'N = int(input())\n\nshiritori_set = set()\n\nshiritori = input()\nhead = shiritori[len(shiritori) -1]\n\nans = "Yes"\nshiritori_set.add(shiritori)\nfor i in range(N-1):\n shiritori = input()\n if shiritori[0] == head and shiritori not in shiritori_set:\n head = shiritori[len(shiritori)-1]\n shiritori_set.add(shiritori)\n else:\n ans = "No"\n break\n\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s760113097', 's978837026', 's948090228']
[3060.0, 3188.0, 3064.0]
[19.0, 18.0, 18.0]
[355, 351, 360]
p03261
u545368057
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 = [input()]\n\nflg = True\nfor i in range(N-1):\n Wi = input()\n if Wi in ws:\n flg = False\n elif ws[-1] != Wi[0]:\n flg = False\n ws.append(Wi)\n\n', 'N = int(input())\nws = [input()]\n\nflg = True\nfor i in range(N-1):\n Wi = input()\n if Wi in ws:\n flg = False\n elif ws[-1][-1] != Wi[0]:\n flg = False\n ws.append(Wi)\n\nif flg:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s079000600', 's170806077']
[2940.0, 3060.0]
[17.0, 17.0]
[184, 234]
p03261
u548303713
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=input()\nb=a[len(a)-1]\nword1=[a]\nword2=[b]\nc=0\n\nfor i in range(n-1):\n aa=input()\n bb=aa[0]\n if aa not in word1 and word2[i]==bb:\n word1.append(aa)\n top=aa[len(aa)-1]\n word2.append(top)\n else:\n c=1\n \nprint("Yes" if c==0 else "No")', 'n=int(input())\na=input()\nb=a[len(a)-1]\nword1=[a]\nword2=[b]\nc=0\n\nfor i in range(n-1):\n aa=input()\n bb=aa[0]\n if aa not in word1 and word2[i]==bb:\n word1.append(aa)\n top=aa[len(aa)-1]\n word2.append(top)\n else:\n c=1\n break\n \nprint("Yes" if c==0 else "No")']
['Runtime Error', 'Accepted']
['s412042950', 's090278303']
[3064.0, 3064.0]
[18.0, 18.0]
[292, 306]
p03261
u548624367
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)]\nflag=True\nfor s in w:\n if w.count(s) > 1:\n flag = False\nfor i in range(1,n)\n if w[i][0] != w[i-1][len(w[i-1])-1]:\n flag = False\nprint("Yes" if flag else "No")\n', 'n=int(input())\nw=[input() for i in range(n)]\nflag=True\nfor s in w:\n if w.count(s) > 1:\n flag = False\nfor i in range(1,n)\n if list(w[i])[0] != reversed(list(w[i-1]))[0]:\n flag = False\nprint("Yes" if flag else "No")', 'n = int(input())\ns = [input() for i in range(n)]\nif len(set(s)) < n:\n\tprint("No")\nelse:\n\tflag = True\n\tfor i in range(1,n):\n\t\tif s[i-1][-1] != s[i][0]:\n\t\t\tflag = False\n\tprint("Yes" if flag else "No")']
['Runtime Error', 'Runtime Error', 'Accepted']
['s330042039', 's469292753', 's588512789']
[2940.0, 2940.0, 3060.0]
[20.0, 17.0, 19.0]
[224, 233, 198]
p03261
u549383771
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 = []\nflag = True\nfor i in range(n):\n word = input()\n if word_list == []:\n word_list.append(word)\n else:\n if word_list[-1][-1] == word[0]:\n word_list.append(word)\n else:\n flag = False\n break\n \nif flag:\n print('Yes')\nelse:\n print('No')", "n = int(input())\nword_list = []\nflag = True\nfor i in range(n):\n word = input()\n if word_list == []:\n word_list.append(word)\n else:\n if (word_list[-1][-1] == word[0]) and (word not in word_list):\n word_list.append(word)\n else:\n flag = False\n break\n \nif flag:\n print('Yes')\nelse:\n print('No')"]
['Wrong Answer', 'Accepted']
['s390298817', 's380149510']
[3060.0, 3060.0]
[17.0, 17.0]
[340, 370]
p03261
u550943777
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 = [input() for _ in range(N)]\ns = set(word)\nif len(s) != N:\n print('No')\n exit\nok = True\nfor i in range(1,N):\n if word[i][0] != word[i-1][-1] :\n ok = False\nprint('Yes' if ok else 'No')\n", "N = int(input())\nword = [input() for _ in range(N)]\ns = set(word)\nok = True\nif len(s) != N:\n ok = False\nfor i in range(1,N):\n if word[i][0] != word[i-1][-1] :\n ok = False\nprint('Yes' if ok else 'No')\n"]
['Wrong Answer', 'Accepted']
['s810479817', 's399231506']
[3060.0, 3060.0]
[18.0, 19.0]
[213, 207]
p03261
u556589653
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())\nls = []\nw = []\nfor i in range(N):\n ls.append(str(input())\nfor j in range(1,N):\n if ls[j-1][(len(ls[j])-1):] and ls[j][(len(ls[j])-1):]\n if ls[j-1] in w:\n print("No")\n else:\n w.append(ls[j-1])\n else:\n print("No")\n break', 'N = int(input())\nw = []\nw1 = ""\nflag = 0\nfor i in range(N):\n s = input()\n if i == 0:\n w1 = s\n w.append(w1)\n else:\n if s[0] == w[i-1][-1] and s not in w:\n w1 = s\n w.append(w1)\n else:\n flag += 1\n break\nprint("No") if flag == 1 else print("Yes")']
['Runtime Error', 'Accepted']
['s991535838', 's374251933']
[2940.0, 9112.0]
[17.0, 25.0]
[260, 277]
p03261
u556594202
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)]\n\nflag=True\nif len(set(w))!=n:\n flag=False\n \nfor i in range(n-1):\n print(flag)\n if w[i][-1]!=w[i+1][0]:\n flag=False\n\nprint("Yes" if flag else "No")\n', 'n = int(input())\nw = [input() for _ in range(n)]\n\nflag=True\nif len(set(w))!=n:\n flag=False\n \nfor i in range(n-1):\n print(flag)\n if w[i][-1]!=w[i+1][0]:\n flag=False\n\nprint("Yes" if flag else "No")\n', 'n = int(input())\nw = [input() for _ in range(n)]\n\nflag=True\nif len(set(w))!=n:\n flag=False\n \nfor i in range(n-1):\n if w[i][-1]!=w[i+1][0]:\n flag=False\n\nprint("Yes" if flag else "No")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s135750145', 's423708508', 's977570485']
[9136.0, 9140.0, 9168.0]
[29.0, 30.0, 33.0]
[215, 215, 198]
p03261
u556712459
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 = True\ns = []\nw1 = input()\ne = w1[-1]\nprint(e)\nfor i in range(n-1):\n wi = input()\n if e != wi[0]:\n flag = False\n e = wi[-1]\n print(e)\n\nif flag:\n print("Yes")\nelse:\n print("No")', 'n = int(input())\nflag = True\ns = []\nwords = []\nw1 = input()\nwords.append(w1)\ne = w1[-1]\nprint(e)\nfor i in range(n-1):\n wi = input()\n if e != wi[0]:\n flag = False\n for w in words:\n if w == wi:\n flag = False\n words.append(wi)\n e = wi[-1]\n print(e)\n\nif flag:\n print("Yes")\nelse:\n print("No")', 'n = input()\nflag = True\ns = []\nw1 = input()\ne = w1[-1]\nfor i in range(n-1):\n wi = input()\n if e != wi[-1]:\n flag = False\n \n e = wi[-1]\n \nif flag:\n print("Yes")\n \nelse:\n print("No")', 'n = int(input())\nflag = True\ns = []\nwords = []\nw1 = input()\nwords.append(w1)\ne = w1[-1]\n\nfor i in range(n-1):\n wi = input()\n if e != wi[0]:\n flag = False\n for w in words:\n if w == wi:\n flag = False\n words.append(wi)\n e = wi[-1]\n\n\nif flag:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s035444120', 's097018240', 's175086096', 's676327938']
[3064.0, 3064.0, 3060.0, 3064.0]
[18.0, 19.0, 17.0, 18.0]
[219, 333, 191, 313]
p03261
u558782626
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 = input()\nfor i in range(N-1):\n b = input()\n if a[-1] != b[0]:\n print("No")\n else:\n a = b\n\nprint("Yes")\n \n ', 'N = int(input())\nwords = [input() for _ in range(N)]\na = words[0]\nif len(set(words)) != N:\n print("No")\n exit()\nfor i in range(1, N):\n b = words[i]\n if a[-1] != b[0]:\n print("No")\n exit()\n else:\n a = b\n\nprint("Yes")\n ']
['Wrong Answer', 'Accepted']
['s361823387', 's602971462']
[2940.0, 3060.0]
[17.0, 17.0]
[138, 231]
p03261
u561828236
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 copy\nn = int(input())\n\nword = [input() for _ in range(n)]\nword2 = copy.deepcopy(word)\nword2.append("pogyaaaaaaaaaaaaaaaaaaa")\nflag = 0\n\n\nfor index, q in enumerate(word):\n for index2, w in enumerate(word):\n if index == index2:\n continue\n \n if q == w:\n flag += 1\n else:\n flag = 0\n \ni = 0\nfor i in range(n-1):\n if word[i][-1] == word2[i+1][0]:\n flag = 0\n else:\n flag += 1\n\nif flag != 0:\n print("No")\nelse:\n print("Yes")\n', 'import copy\nn = int(input())\n\nword = [input() for _ in range(n)]\nword2 = copy.deepcopy(word)\nword2.append("koredeiinokasira...tukareta")\nflag = 0\n\n\nfor index, q in enumerate(word):\n for index2, w in enumerate(word):\n \n \n if q == w:\n if index == index2:\n continue\n flag += 1\n \n \n\ni = 0\nfor i in range(n-1):\n if word[i][-1] == word2[i+1][0]:\n flag += 0\n else:\n flag += 1\n\n\nif flag != 0:\n print("No")\nelse:\n print("Yes")\n']
['Wrong Answer', 'Accepted']
['s449721827', 's281301339']
[3444.0, 3444.0]
[25.0, 25.0]
[559, 557]
p03261
u567124995
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 = list(input() for i in range(N))\nfor i in range(N):\n\t\tif a[i+1] == a[i]:\n\t\t\tprint('No')\n\t\t\tbreak\n\t\telif a[i+1][0:1] != a[i][-1:]:\n\t\t\tprint('No')\n\t\t\tbreak\n\t\telif N == 1:\n\t\t\tprint('Yes')\n\t\t\tbreak\n\t\telse:\n\t\t\tprint('Yes')\n\t\t\tbreak", "N = int(input())\na = list(input() for i in range(N)) \nk = 0\nfor i in range(N-1): \n if a.count(a[i]) != 1:\n print('No')\n break\n elif (a[i+1][0:1]) != (a[i][-1:]): \n print('No')\n break\n else:\n k = k + 1\n\nif k == (N-1):\n print('Yes')\n"]
['Wrong Answer', 'Accepted']
['s916525883', 's931865535']
[3060.0, 3060.0]
[17.0, 18.0]
[246, 345]
p03261
u575431498
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)]\n\nprev = ''\nif len(set(W)) != len(W):\n exit(0)\n\nprev = W[0]\nfor w in W[1:]:\n if prev[-1] != w[0]:\n print(prev[-1], w[0])\n print('No')\n exit(0)\n prev = w\nprint('Yes')", "N = int(input())\nW = [input() for _ in range(N)]\n\nprev = ''\nif len(set(W)) != len(W):\n exit(0)\n\nprev = W[0]\nfor w in W[1:]:\n if prev[-1] != w[0]:\n print('No')\n exit(0)\n prev = w\nprint('Yes')", "N = int(input())\nW = [input() for _ in range(N)]\n\nif len(set(W)) != len(W):\n print('No')\n exit(0)\n\nprev = W[0]\nfor w in W[1:]:\n if prev[-1] != w[0]:\n print('No')\n exit(0)\n prev = w\nprint('Yes')"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s369690250', 's740856835', 's371677282']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[243, 213, 219]
p03261
u576917603
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)]\nlast=""\nwl=[]\nans="Yes"\nfor x,i in enumerate(w):\n if x==0:\n last=i[-1]\n continue\n if i in wl:\n ans="No"\n if i[0]!=last:\n ans="No"\n last=i[-1]\n wl.append(i)\nprint(ans)', 'n=int(input())\nw=[input() for i in range(n)]\nlast=""\nwl=[]\nans="Yes"\nfor x,i in enumerate(w):\n if x==0:\n last=i[-1]\n wl.append(i)\n continue\n if i in wl:\n ans="No"\n if i[0]!=last:\n ans="No"\n last=i[-1]\n wl.append(i)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s349820693', 's426983285']
[3064.0, 3064.0]
[17.0, 17.0]
[254, 275]
p03261
u578489732
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 -*-\nimport sys\nn = int(input());\nwords = []\n\nfor i in range(n):\n words.append(input())\n\n\n if (len(words) > len(set(words))):\n print('No')\n sys.exit(0)\n\nbefore_word = words.pop(0)\nwhile( len(words) > 0 ):\n after_word = words.pop(0)\n \n if (before_word[-1] != after_word[0]):\n print('No')\n sys.exit(0)\n before_word = after_word\nprint('Yes')", "# -*- coding: utf-8 -*-\nimport sys\nn = int(input());\nwords = []\n\nfor i in range(n):\n words.append(input())\n\nif (len(words) > len(set(words))):\n print('No')\n sys.exit(0)\n\nbefore_word = words.pop(0)\nwhile( len(words) > 0 ):\n after_word = words.pop(0)\n if (before_word[-1] != after_word[0]):\n print('No')\n sys.exit(0)\n before_word = after_word\nprint('Yes')"]
['Runtime Error', 'Accepted']
['s263858750', 's559108134']
[2940.0, 3064.0]
[18.0, 18.0]
[513, 385]
p03261
u580362735
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\n\nN = int(input())\nW = [input() for i in range(N)]\nw = collections.Counter(W)\nprint(w)\nif len(w.values()) != len(W):\n print('No')\nelse:\n for i in range(len(W)-1):\n s = W[i]\n tmp = s[len(s)-1]\n s_next = W[i+1]\n if tmp != s_next[0]:\n print('No')\n break\n else:\n print('Yes')\n", "import collections\n\nN = int(input())\nW = [input() for i in range(N)]\nw = collections.Counter(W)\nif sum(w.values()) > len(W):\n print('No')\nelse:\n for i in range(len(W)-1):\n s = W[i]\n tmp = s[len(s)-1]\n s_next = W[i+1]\n if tmp != s_next[0]:\n print('No')\n break\n else:\n print('Yes')", "import collections\n\nN = int(input())\nW = [input() for i in range(N)]\nw = collections.Counter(W)\nif len(w.values()) != len(W):\n print('No')\nelse:\n for i in range(len(W)-1):\n s = W[i]\n tmp = s[len(s)-1]\n s_next = W[i+1]\n if tmp != s_next[0]:\n print('No')\n break\n else:\n print('Yes')\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s777732703', 's994702848', 's638888346']
[3316.0, 3316.0, 3316.0]
[22.0, 21.0, 21.0]
[318, 307, 309]
p03261
u581403769
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=True\na=0\nl=[]\nfor i in range(n):\n b=a\n l.append(b)\n a=list(input())\n if i>0:\n if a[0]!=b[-1] or a in l:\n flag=False\nif flag:\n print('Yes')\nelse:\n print('No')", "n=int(input())\nflag=True\na=0\nl=[]\nfor i in range(n):\n b=a\n l.append(b)\n a=list(input())\n if i>0:\n if a[0]!=b[-1] or a in l:\n flag=False\nif flag:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s391797979', 's970062692']
[2940.0, 3060.0]
[17.0, 18.0]
[211, 213]
p03261
u585101972
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\n#include <utility>\n#include <numeric>\n#include <functional>\n#include <stdio.h>\n#include <math.h>\n#include <string>\n#include <algorithm>\n#include <deque>\n\n#include <map>\n\n#define rep(i, m, n) for (int (i)(m); (i)<(n); ++(i))\n#define repr(i, m, n) for (int (i)(m - 1); (i)>=(n); --(i))\n#define repv(i, v) for (unsigned (i)(0); (i)<(v.size()); ++(i))\n#define all(v) (v).begin(), (v).end()\n#define sortv(v) sort(all(v))\n#define sortgi(v) sort(all(v), greater<int>())\n#define sortgd(v) sort(all(v), greater<double>())\n#define sortgll(v) sort(all(v), greater<ll>())\n\n\nusing namespace std;\nusing pii = pair<int, int>;\nusing pss = pair<string, string>;\nusing vi = vector<int>;\nusing vvi = vector<vi>;\nusing vvvi = vector<vvi>;\nusing vd = vector<double>;\nusing vvd = vector<vd>;\nusing vs = vector<string>;\nusing ll = long long;\nusing pllll = pair<ll, ll>;\nusing vll = vector<ll>;\nusing vvll = vector<vll>;\nusing vb = vector<bool>;\nusing vvb = vector<vb>;\nusing vvvb = vector<vvb>;\nusing vpii = vector<pii>;\nusing pqi = priority_queue<int>;\nusing pqd = priority_queue<double>;\nusing pqll = priority_queue<ll>;\nusing pqvi = priority_queue<vi>;\nusing pqvll = priority_queue<vll>;\n\nint main() {\n\tint n;\n\tcin >> n;\n\tvs w;\n\trep(i, 0, n) {\n\t\tstring s;\n\t\tcin >> s;\n\t\tw.push_back(s);\n\t}\n\tstring s0(w[0]);\n\trepv(i, w) {\n\t\trepv(j, w) {\n\t\t\tif (w[i] == w[j] && i != j) {\n\t\t\t\tcout << "No" << endl;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\trep(i, 1, n) {\n\t\tstring s1 = w[i];\n\t\tif (s0[s0.size() - 1] != s1[0]) {\n\t\t\tcout << "No" << endl;\n\t\t\treturn 0;\n\t\t}\n\t\ts0 = s1;\n\t}\n\tcout << "Yes" << endl;\n}\n', "import sys\nN = int(input())\ns = []\nfor i in range(N):\n s.append(input())\nfor i, s0 in enumerate(s):\n for j, s1 in enumerate(s):\n if i != j and s0 == s1:\n print('No')\n sys.exit()\ns0 = s[0]\nfor i in range(1, len(s)):\n s1 = s[i]\n if s0[-1] != s1[0]:\n print('No')\n sys.exit()\n s0 = s1\nprint('Yes')\n"]
['Runtime Error', 'Accepted']
['s879893857', 's589183909']
[2940.0, 3064.0]
[17.0, 19.0]
[1657, 352]
p03261
u588081069
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 = str(input())\nw_end = w[-1]\n\ntmp = []\ntmp.append(w)\nresult = False\n\nfor i in range(N - 1):\n w = str(input())\n if w[0] == w_end and w not in tmp:\n result = True\n else:\n print("not ok: {}".format(w))\n result = False\n w_end = w[-1]\n\nif result is True:\n print("Yes")\nelse:\n print("No")\n', 'N = int(input())\n\nw = str(input())\nw_end = w[-1]\n\ntmp = []\ntmp.append(w)\n\nfor i in range(N - 1):\n w = str(input())\n if w[0] == w_end and w not in tmp:\n pass\n else:\n print("No")\n exit()\n w_end = w[-1]\n tmp.append(w)\n\nprint("Yes")\n']
['Wrong Answer', 'Accepted']
['s372692317', 's113837561']
[3064.0, 3060.0]
[19.0, 19.0]
[342, 265]
p03261
u589381719
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=[]\nflg=True\n\nbefore=input()\nN=N-1\n\nfor i in range(N):\n s=input()\n if before[-1] != s[0]:\n flg=False\n words.append(s)\n if len(words) != len(set(words)):\n flg=False\n before=s\nprint("Yes" if flg else "No")', 'N=int(input())\nwords=[]\nflg=True\n\nbefore=input()\nwords.append(before)\nN=N-1\n\nfor i in range(N):\n s=input()\n if before[-1] != s[0]:\n flg=False\n words.append(s)\n before=s\nif len(words) != len(set(words)):\n flg=False\nprint("Yes" if flg else "No")']
['Wrong Answer', 'Accepted']
['s680210460', 's381476074']
[3064.0, 3060.0]
[17.0, 18.0]
[252, 265]
p03261
u598530761
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\nword = [word.append(input()) for i in range(N)]\n\n\nfor i in range(1, N):\n if word[i][0] != word[i - 1][-1] or word.count(word[i]) != 1:\n print('No')\n exit()\n\nprint('Yes')\n\n", "N = int(input())\n\nword = [input() for i in range(N)]\n#word = []\n\n\n\nfor i in range(1, N):\n if word[i][0] != word[i - 1][-1] or word.count(word[i]) != 1:\n print('No')\n exit()\n\nprint('Yes')\n\n"]
['Runtime Error', 'Accepted']
['s409152631', 's979478552']
[3056.0, 2940.0]
[17.0, 18.0]
[206, 249]
p03261
u600402037
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)]\nbl = True\nif len(W) != len(set(W)):\n bl = False\nfor i in range(N-1):\n if W[i][-1] != W[i+1][0]:\n bl = False\nprint(bl)\n', "N = int(input())\nW = [input() for _ in range(N)]\nbl = True\nif len(W) != len(set(W)):\n bl = False\nfor i in range(N-1):\n if W[i][-1] != W[i+1][0]:\n bl = False\nprint('Yes' if bl else 'NO')\n", "# coding: utf-8\nimport sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nN = ir()\nW = [sr() for _ in range(N)]\nbl = True\nif len(set(W)) != N:\n bl = False\nfor i in range(N-1):\n if W[i][-1] != W[i+1][0]:\n bl = False\nprint('Yes' if bl else 'No')"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s139517823', 's718499398', 's756995564']
[3060.0, 3060.0, 3064.0]
[17.0, 17.0, 18.0]
[180, 199, 319]
p03261
u606033239
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 = []\na = input()\nw.append(a)\n\nfor i in range(n):\n b = input()\n if b[0] != a[-1] or b in count:\n print("No")\n quit()\n count.append(b)\n a=b\nprint("Yes")', 'n = int(input())\nw=[input() for _ in range(n)]\nfor i in range(n-1):\n if w[i][-1] != w[i+1][0]:\n print("No")\n exit()\nprint("Yes" if len(set(w))==n else "No")\n']
['Runtime Error', 'Accepted']
['s486544062', 's416094602']
[3060.0, 2940.0]
[18.0, 18.0]
[195, 174]
p03261
u607865971
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 = []\nfor n in range(N):\n W.append(input())\n\nret = "Yes"\n\ndict = {}\nfor w in W:\n if w in dict:\n dict[w] += 1\n if dict[w] >= 2:\n # print("Duplicated!")\n print("No")\n exit\n else:\n dict[w] = 1\n# print(dict)\n\ncurrent = W[0]\nret = "Yes"\nfor i in range(1, N):\n if (current[-1] != W[i][0]):\n # print("Not Connected: " + current + "," + W[i])\n ret = "No"\n break\n current = W[i]\n\nprint(ret)\n', 'N = int(input())\n\nL = []\n\nans = "Yes"\nfor i in range(N):\n w = input()\n if i != 0:\n if w in L or L[-1][-1] != w[0]:\n ans = "No"\n break\n L.append(w)\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s407560335', 's726709891']
[3064.0, 3060.0]
[18.0, 21.0]
[511, 197]
p03261
u609814378
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())\nshiritori = [str(input())]\n\nshiritori.append(w)\n\nans = "Yes"\n\nfor i in shiritori:\n if shiritori.count(i) != 1:\n ans = "No"\n break\n \nfor k in range(N-1):\n first = shiritori[k]\n second = shiritori[k+1]\n if first[-1] != second[0]:\n ans = "No"\n break\n\n\n \nprint(ans)', 'N = int(input())\nw = input()\nshiritori = []\n\nshiritori.append(w)\n\nans = "Yes"\n\nfor i in shiritori:\n if shiritori.count(i) != 1:\n ans = "No"\n break\n \nfor k in range(N-1):\n first = shiritori[k]\n second = shiritori[k+1]\n if first[-1] != second[0]:\n ans = "No"\n break\n\n\n \nprint(ans)', 'N = int(input())\nshiritori = [input() for i in range(n)]\n\n\nans = "Yes"\n\nfor i in shiritori:\n if shiritori.count(i) != 1:\n ans = "No"\n break\n \nfor k in range(N-1):\n first = shiritori[k]\n second = shiritori[k+1]\n if first[-1] != second[0]:\n ans = "No"\n break\n\n\n \nprint(ans)\n', 'N = int(input())\nshiritori = [input() for i in range(n)]\n\nshiritori.append(w)\n\nans = "Yes"\n\nfor i in shiritori:\n if shiritori.count(i) != 1:\n ans = "No"\n break\n \nfor k in range(N-1):\n first = shiritori[k]\n second = shiritori[k+1]\n if first[-1] != second[0]:\n ans = "No"\n break\n\n\n \nprint(ans)', 'N = int(input())\nshiritori = list()\n\nfor a in range(N):\n\tshiritori.append(input())\n\nans = "Yes"\n\nfor i in shiritori:\n if shiritori.count(i) != 1:\n ans = "No"\n break\n \nfor k in range(N-1):\n first = shiritori[k]\n second = shiritori[k+1]\n if first[-1] != second[0]:\n ans = "No"\n break\n\n\n \nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s226648972', 's253639272', 's454079330', 's457666487', 's145477628']
[3064.0, 3064.0, 3060.0, 3064.0, 3064.0]
[18.0, 17.0, 17.0, 17.0, 18.0]
[324, 324, 318, 337, 342]
p03261
u614710626
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())\nlist = []\nfor n in range(0, N):\n input = input()\n if n == 0:\n list.append(input)\n else:\n if input in list:\n print('No')\n break\n else:\n list.append(input)\n if n == N-1:\n print('Yes')\n", "N = int(input())\nls = []\nflag = True\nfor n in range(0, N):\n char = input()\n if n == 0:\n ls.append(char)\n else:\n if (char in ls) or (ls[n-1][-1:1] == char[0:1]):\n flag == False\n ls.append(char)\nif flag == True:\n print('Yes')\nelse:\n print('No')\n", 'N = int(input())\nls = []\nflag = True\nbChar = ""\nfor n in range(0, N):\n char = input()\n if n == 0:\n ls.append(char)\n else:\n if (char in ls) or (bChar[-1:] == char[0:1]):\n flag == False\n ls.append(char)\n bChar = char\nif flag == True:\n print(\'Yes\')\nelse:\n print(\'No\')\n', 'N = int(input())\nls = []\nflag = True\nbChar = ""\nfor n in range(0, N):\n char = input()\n if n == 0:\n ls.append(char)\n else:\n if (char in ls) or (bChar[-1:1] == char[0:1]):\n flag == False\n ls.append(char)\n bChar = char\nif flag == True:\n print(\'Yes\')\nelse:\n print(\'No\')\n', 'N = int(input())\nls = []\nflag = True\nbChar = ""\nfor n in range(0, N):\n ch = input()\n if n == 0:\n ls.append(ch)\n else:\n if (ch in ls) or (bChar[-1:] != ch[0:1]):\n flag = False\n ls.append(ch)\n bChar = ch\nif flag == True:\n print(\'Yes\')\nelse:\n print(\'No\')\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s062482382', 's557620617', 's582120477', 's783253620', 's119701480']
[2940.0, 3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[230, 262, 285, 286, 270]
p03261
u620846115
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())\nalist = [input() for i in range(n)]\n \nif len(set(alist))==n:\n if all(alist[i][-1]==alist[i+1][0])for i in range(n-1):\n print("Yes")\n else:\n print("No")', 'n = int(input())\nalist = [input() for i in range(n)]\n\nfor i in range(n):\n if all(alist[i][-1]==alist[i+1][0]):\n if len(set(alist))==n:\n print("Yes")\n else:\n print("No")', 'n = int(input())\nalist = [input() for i in range(n)]\n \nif len(set(alist))==n:\n if all(alist[i][-1]==alist[i+1][0] for i in range(n-1)):\n print("Yes")\n else:\n print("No")', 'n = int(input())\nalist = [input() for i in range(n)]\n \nif len(set(alist))==n:\n if all(alist[i][-1]==alist[i+1][0] for i in range(n-1)):\n print("Yes")\n exit()\nprint("No")']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s284802039', 's650368362', 's878229023', 's974708819']
[8932.0, 9184.0, 9116.0, 9176.0]
[24.0, 23.0, 27.0, 29.0]
[176, 185, 177, 176]
p03261
u620945921
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 is_unique(seq):\n return len(seq) == len(set(seq))\n\nn=int(input())\nw=[input() for i in range(n)]\n\nflag=0\n\nif is_unique(w)=='false':\n flag=1\n\nfor j in range(n-1):\n if w[j][-1] != w[j+1][0]:\n flag=1\n\nif flag==1:\n print('No')\nelse:\n print('Yes')\n", "def is_unique(seq):\n return len(seq) == len(set(seq))\n\nn=int(input())\nw=[input() for i in range(n)]\nprint(n)\nprint(w)\n\nflag=0\n\nif is_unique(w)=='false':\n flag=1\n\nfor j in range(n-1):\n if w[j][-1] != w[j+1][0]:\n flag=1\n\nif flag==1:\n print('No')\nelse:\n print('Yes')\n", "def is_unique(seq):\n return len(seq) == len(set(seq))\n\nn=int(input())\nw=[input() for i in range(n)]\n#print(n)\n#print(w)\nflag=0\nif is_unique(w)=='False':\n flag=1\nfor j in range(n-1):\n if w[j][-1] != w[j+1][0]:\n flag=1\n\nif flag==1:\n print('No')\nelse:\n print('Yes')\n", "def is_unique(seq):\n return len(seq) == len(set(seq))\n\nn=int(input())\nw=[input() for i in range(n)]\n\nflag=0\nprint(is_unique(w))\nif is_unique(w)=='False':\n flag=1\nfor j in range(n-1):\n if w[j][-1] != w[j+1][0]:\n flag=1\n\nif flag==1:\n print('No')\nelse:\n print('Yes')\n", "def is_unique(seq):\n return len(seq) == len(set(seq))\n\nn=int(input())\nw=[input() for i in range(n)]\n\nflag=0\n\nif is_unique(w)=='False':\n flag=1\nfor j in range(n-1):\n if w[j][-1] != w[j+1][0]:\n flag=1\n\nif flag==1:\n print('No')\nelse:\n print('Yes')\n", "def is_unique(seq):\n return len(seq) == len(set(seq))\n\nn=int(input())\nw=[input() for i in range(n)]\n#print(n)\n#print(w)\n\nflag=0\n\nif is_unique(w)=='false':\n flag=1\n\nfor j in range(n-1):\n if w[j][-1] != w[j+1][0]:\n flag=1\n\nif flag==1:\n print('No')\nelse:\n print('Yes')\n", "n=int(input())\nw=[input() for i in range(n)]\n#print(n)\n#print(w)\nflag=0\nif len(w)==len(set(w)):\n flag=0\nelse:\n flag=1\n\nfor j in range(n-1):\n if w[j][-1] != w[j+1][0]:\n flag=1\n\nif flag==1:\n print('No')\nelse:\n print('Yes')\n"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s005297685', 's151796433', 's153732995', 's344630018', 's586762327', 's694569919', 's836061156']
[3060.0, 3060.0, 3060.0, 3064.0, 3060.0, 3060.0, 3060.0]
[18.0, 18.0, 18.0, 17.0, 18.0, 17.0, 19.0]
[256, 274, 273, 274, 255, 276, 231]
p03261
u623349537
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_set = set()\nvalid = True\nwords = ["" for i in range(N)]\nfor i in range(N):\n words[i] = input()\n \nfor i in range(1, N):\n if words[i-1][-1] != words[i][0] or words[i] in word_set:\n valid = False\n break\n word_set.add(words[i])\n \nif valid:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nword_set = set()\nvalid = True\nwords = ["" for i in range(N)]\nfor i in range(N):\n words[i] = input()\n\nword_set.add(words[0])\nfor i in range(1, N):\n if words[i-1][-1] != words[i][0] or words[i] in word_set:\n valid = False\n break\n word_set.add(words[i])\n \nif valid:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s219697286', 's790845937']
[3064.0, 3064.0]
[18.0, 17.0]
[325, 344]
p03261
u623687794
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())\nshiritori = [list(input()) for i in range(n)]\nfor i in range(n-1):\n if shiritori[i][-1] != shiritori[i+1][0]:\n print("No")\n break\n if i =n-2:\n print("Yes")', 'n = int(input())\nshiritori = [list(input()) for i in range(n)]\nfor i in range(n-1):\n if shiritori[i][-1] != shiritori[i+1][0]:\n print("No")\n break\n if i==n-2:\n print("Yes")\n', 'n=int(input())\nshiritori=[]\nfor i in range(n):\n shiritori.append(input())\ncheck=set(shiritori)\nif len(check)!=n:\n print("No")\nelse:\n flag=0\n for i in range(n-1):\n if shiritori[i][-1]!=shiritori[i+1][0]:\n flag=1\n break\n if flag==0:\n print("Yes")\n else:\n print("No")']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s418544800', 's935038003', 's207924581']
[2940.0, 2940.0, 3064.0]
[17.0, 18.0, 17.0]
[183, 184, 289]
p03261
u626228246
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())\nS = [input() for s in range(N)]\ns = set(S)\nif len(S) != len(s):\n print("No")\nfor i in range(N-1):\n if S[i][-1] != S[i+1][0]:\n print("No")\n sys.exit()\nprint("Yes")\n \n\n ', 'import sys\nN = int(input())\nS = [input() for s in range(N)]\ns = set(S)\nif len(S) != len(s):\n\tprint("No")\n\tsys.exit()\nfor i in range(N-1):\n\tif S[i][-1] != S[i+1][0]:\n\t\tprint("No")\n\t\tsys.exit()\nprint("Yes")']
['Wrong Answer', 'Accepted']
['s132342667', 's951485931']
[8940.0, 9076.0]
[27.0, 25.0]
[205, 204]
p03261
u627530854
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 valid(words):\n used = set()\n last = ""\n\n for w in words:\n if w in used:\n return False\n if last != "" and last[-1] != w[0]:\n return False\n last = w\n used.append(w)\n return True\n\nn = int(input())\nwords = [input() for _ in range(n)]\nprint("Yes" if valid(words) else "No")', 'def valid(words):\n used = set()\n last = ""\n\n for w in words:\n if w in used:\n return False\n if last != "" and last[-1] != w[0]:\n return False\n last = w\n used.add(w)\n\n return True\n\n\nn = int(input())\nwords = [input() for _ in range(n)]\nprint("Yes" if valid(words) else "No")\n']
['Runtime Error', 'Accepted']
['s891863786', 's970087885']
[3060.0, 3060.0]
[18.0, 17.0]
[298, 298]
p03261
u629350026
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())\ntemp=str(input())\ntempl=list(temp)\ntempb=templ[len(templ)-1]\nw=[0]*n\nw[0]=temp\nfor i in range(0,n-1):\n temp=str(input())\n templ=list(temp)\n if temp in w or tempb!=templ[0]:\n print("No")\n break\n tempb=templ[len(templ)-1]\n w[i]=temp\nelse:\n print("Yes")\n ', 'n=int(input())\ntemp=str(input())\ntempl=list(temp)\ntempb=templ[len(templ)-1]\nw=[0]*n\nw[0]=temp\nfor i in range(0,n-1):\n temp=str(input())\n templ=list(temp)\n if temp in w or tempb!=templ[0]:\n print("No")\n break\n tempb=templ[len(templ)-1]\n w[i+1]=temp\nelse:\n print("Yes")\n ']
['Wrong Answer', 'Accepted']
['s493749708', 's534007469']
[3064.0, 3064.0]
[18.0, 18.0]
[280, 282]
p03261
u629540524
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)]\nif n == len(set(w)) and w[i-1][-1] == w[i][0] for i in range(1,n):\n print('Yes')\nelse:\n print('No')", "n = int(input())\nw = [input() for i in range(n)]\nif all(n == len(set(w)) and w[i-1][-1] == w[i][0] for i in range(1,n)):\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s078494929', 's947090016']
[2940.0, 3060.0]
[17.0, 17.0]
[154, 165]
p03261
u630657312
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*w,=open(0).read().split()\nfor i in range(1,n):\n if w.count(w[i]) == 1 and w[i-1][-1] == w[i][0]:\n pass\n else:\n print('No')\n break\n if i == n-1:\n print('Yes')\n else:\n pass", "n = int(input())\n*w, = open(0).read().split()\nfor i in range(1,n):\n if w.count(w[i]) > 1 or w[i-1][-1] == w[i][0]:\n print('No')\n break\n else: \n print('Yes')", "n = int(input())\n*w, = open(0).read().split()\nfor i in range(1,n):\n if w.count(w[i])==1 and w[i-1][-1] == w[i][0]:\n pass\n else:\n print('No')\n break\n if i == n-1:\n print('Yes)", "n = int(input())\nw=[]\nfor i in range(n):\n w.append(input())\na=0\nfor i in range(1,n):\n if w.count(w[i])==1 and w[i-1][-1]==w[i][0]:\n a += 1\n else:\n print('No')\n break\n if a==n-1:\n print('Yes')\n else:\n pass"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s574588542', 's690681965', 's979857299', 's977757559']
[2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[207, 167, 189, 253]
p03261
u635974378
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.
["already = {}\nn = int(input())\nlast = ''\nfor i in range(n):\n s = input()\n if i != 0 and s[0] != last[-1]:\n print('No')\n break\n last = s\nelse:\n print('Yes')", "already = {}\nn = int(input())\nlast = ''\nfor i in range(n):\n s = input()\n if (i != 0 and s[0] != last[-1]) or (s in already) :\n print('No')\n break\n last = s\n already[s] = 1\nelse:\n print('Yes')"]
['Wrong Answer', 'Accepted']
['s180080168', 's409911362']
[3060.0, 3060.0]
[18.0, 17.0]
[164, 202]
p03261
u636775911
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())\ndata=[]\ncheck=True\ndata.append(input())\nfor i in range(1,n-1):\n data.append(input())\n for j in range(1,i):\n if(data[i]==data[j]):\n check=False\n if(data[i-1][len(data[i-1])-1]!=data[i][0]):\n check=False\nif(check==False):\n print("No")\nelse:\n print("Yes")', '#coding;utf-8\nn=int(input())\ndata=[]\ncheck=True\ndata.append(input())\nfor i in range(1,n):\n data.append(input())\n for j in range(i):\n if(data[i]==data[j]):\n check=False\n if(data[i-1][len(data[i-1])-1]!=data[i][0]):\n check=False\nif(check==False):\n print("No")\nelse:\n print("Yes")\n']
['Wrong Answer', 'Accepted']
['s833457600', 's333046798']
[3064.0, 3060.0]
[18.0, 18.0]
[297, 294]
p03261
u640922335
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=[]\nfor _ in range(N):\n W=input()\n if W in A:\n print('No')\n exit()\n else:\n W.append(A)\n\nfor i in range(N-1):\n if A[i][-1]!=A[i+1][-1]:\n print('No')\n exit()\nprint('Yes')", "N=int(input())\nA=[]\nfor _ in range(N):\n W=input()\n if W in A:\n print('No')\n exit()\n else:\n A.append(W)\n\nfor i in range(N-1):\n if A[i][-1]!=A[i+1][0]:\n print('No')\n exit()\nprint('Yes')"]
['Runtime Error', 'Accepted']
['s164365475', 's446538776']
[3060.0, 3060.0]
[17.0, 17.0]
[231, 230]
p03261
u642528832
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)]\nWs =[]\nans = 'Yes'\n\nfor i in range(N):\n Ws.append(W[i])\n for j in range(1,N+1)\n if W[i][-1] == W[j][0]:\n break\n else:\n ans = 'No'\n break\n \n\n\nif len(set(W)) != len(Ws):\n ans = 'No'\nprint(ans) ", 'N = int(input())\nW = [input() for _ in range(N)]\nans = "Yes"\n\nfor i in range(N-1):\n if W[i][-1] != W[i+1][0] or W.count(W[i]) != 1:\n ans = "No"\n\nprint(ans)\n\n']
['Runtime Error', 'Accepted']
['s848388087', 's669914258']
[8964.0, 9172.0]
[24.0, 27.0]
[314, 167]
p03261
u650909164
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.
['x = int(input())\n\nANS = "Yes"\ns = []\ndef se(s):\n\treturn \nfor i in range(x):\n\ts.append(input())\n\nprint(s)\nfor i in range(x-1):\n\tif s[i+1][0] != s[i][-1]:\n\t\tprint(s[i][-1],s[i][0],s[i+1][-1])\n\t\tANS = "No"\n\t\tbreak\nif len(s) == len(set(s)):\n\tprint(ANS)\nelse:\n\tprint("No")', 'x = int(input())\nANS = "Yes"\ns = []\n\nfor i in range(x):\n\ts.append(input())\nfor i in range(x-1):\n\tif s[i+1][0] != s[i][-1]:\n\t\tANS = "No"\n\t\tbreak\nif len(s) == len(set(s)):\n\tprint(ANS)\nelse:\n\tprint("No")']
['Wrong Answer', 'Accepted']
['s650319976', 's854938553']
[3064.0, 3060.0]
[18.0, 17.0]
[267, 200]
p03261
u655048024
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 = []\nans = "Yes"\nfor i in range(N):\n s = str(input())\n if(i>0):\n if(s[0]==w[-1][-1]):\n None\n else:\n ans = "No"\n break\n w.append(s)\nj = set(N)\nl = len(list(j))\nif(len(N)==l):\n None\nelse:\n ans="No"\nprint(ans)', 'N = int(input())\nw = []\nans = "Yes"\nfor i in range(N):\n s = str(input())\n if(i>0):\n if(s[0]==w[-1][-1]):\n None\n else:\n ans = "No"\n break\n w.append(s)\nj = set(w)\nl = len(list(j))\nif(N==l):\n None\nelse:\n ans="No"\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s158892108', 's076430473']
[3064.0, 3060.0]
[18.0, 17.0]
[251, 247]
p03261
u657611449
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())\n if i ==0:\n continue\n if w[i][0] != w[i-1][-1]:\n print('No')\n return\n\nif N == len(set(w)):\n print('Yes')\nelse:\n ", "N = int(input())\nw = []\nfor i in range(N):\n w.append(input())\n if i ==0:\n continue\n if w[i][0] != w[i-1][-1]:\n print('No')\n return\n\nif N == len(set(w)):\n print('Yes')\nelse:\n print('No')\n", "def main():\n N = int(input())\n w = []\n for i in range(N):\n w.append(input())\n if i == 0:\n continue\n if w[i][0] != w[i-1][-1]:\n print('No')\n return\n\n if N == len(set(w)):\n print('Yes')\n else:\n print('No')\n\nmain()"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s538051485', 's716557477', 's860012757']
[2940.0, 2940.0, 2940.0]
[18.0, 18.0, 18.0]
[211, 223, 294]
p03261
u657818166
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\n\nn=int(input())\nl=[]\nfor x in range(n):\n\tl.append(str(input()))\n\tif x>0:\n\t\tif not(l[x-1][-1] == l[x][0]) or (l[:x] in l):\n\t\t\tprint("No")\n\t\t\tsys.exit()\nprint("Yes")\n', 'import sys\n\nn=int(input())\nl=[]\nfor x in range(n):\n\tl.append(str(input()))\n\tif x>0:\n\t\tif not(l[x-1][-1] == l[x][0]) or (l[x] in l[:x]):\n\t\t\tprint("No")\n\t\t\tsys.exit()\nprint("Yes")\n']
['Wrong Answer', 'Accepted']
['s224819704', 's192064020']
[2940.0, 2940.0]
[17.0, 17.0]
[175, 178]
p03261
u663014688
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\nl = []\nfor i in range(N):\n l.append(input())\n\n\nif len(set(l)) != n:\n print("No")\n exit()\n\n\nfor i in range(n-1):\n if l[i][-1] != l[i+1][0]:\n print("No")\n exit()\n\nprint("Yes")\n\n\n \n', 'N = int(input())\n\nl = []\nfor i in range(N):\n l.append(input())\n\n\nif len(set(l)) != N:\n print("No")\n exit()\n\n\nfor i in range(N-1):\n if l[i][-1] != l[i+1][0]:\n print("No")\n exit()\n\nprint("Yes")\n\n\n \n']
['Runtime Error', 'Accepted']
['s660599812', 's472521116']
[3060.0, 3060.0]
[17.0, 18.0]
[269, 269]
p03261
u663101675
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 X = input()\n W.append(X)\n if i >= 1:\n if W[i-1][len(W[i-1])-1] != W[i][0]:\n print("No1")\n exit()\n for j in range(i):\n if W[i] == W[j]:\n print("No2")\n exit()\nelse:\n print("Yes")\n', 'N = int(input())\nW = []\nfor i in range(N):\n X = input()\n W.append(X)\n if i >= 1:\n if W[i-1][len(W[i-1])-1] != W[i][0]:\n print("No")\n exit()\n for j in range(i):\n if W[i] == W[j]:\n print("No")\n exit()\nelse:\n print("Yes")\n']
['Wrong Answer', 'Accepted']
['s274330856', 's174120277']
[3060.0, 3060.0]
[19.0, 18.0]
[294, 292]
p03261
u666844906
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(input() for _ in range(N))\n\ncnt = 0\nfor i in range(N-1):\n\tfirst = W[i]\n\tnext = W[i+1]\n\tif first[-1] == next[0]:\n\t\tcnt += 1\n\telse:\n\t\tcnt = cnt\n\nif cnt == N-1:\n\tprint('Yes')\nelse:\n\tprint('No')\n\t\t", "N = int(input())\nW = list(input() for _ in range(N))\n\ncnt = 0\nif len(set(W)) == len(W):\n\tfor i in range(N-1): \n\t\tif W[i][0] == W[i+1][-1]:\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tcnt = cnt\nelse:\n\tprint('No')\n\nif cnt == N-1:\n\tprint('Yes')\nelse:\n\tprint('No')", "import sys\n\nN = int(input())\nW = list(input() for _ in range(N))\n\nif len(set(W)) == N:\n\tfor i in range(N-1):\n\t\ta = W[i]\n\t\tb = W[i+1] \n\t\tif a[-1] != b[0]:\n\t\t\tprint('No')\n\t\t\tsys.exit()\n\tprint('Yes')\nelse:\n\tprint('No')"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s621308109', 's704034344', 's780353702']
[9184.0, 9164.0, 9128.0]
[33.0, 29.0, 32.0]
[219, 239, 215]
p03261
u667084803
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 = []\nflag = 1\nfor i in range(N):\n st = input()\n if i > 0 :\n if final != st[0]:\n flag = 0\n elif st in word:\n flag = 0\n else:\n final = st[-1]\n word += [st]\nif flag:\n print("Yes")\nelse :\n print("No")', 'N = int(input())\nword = []\nflag = 1\nfor i in range(N):\n st = input()\n if i > 0 :\n if final != st[0]:\n flag = 0\n elif st in word:\n flag = 0\n else:\n final = st[-1]\n word += [st]\n else:\n final = st[-1]\n word += [st]\nif flag:\n print("Yes")\nelse :\n print("No")']
['Runtime Error', 'Accepted']
['s108917517', 's894699488']
[3060.0, 3064.0]
[17.0, 18.0]
[251, 295]
p03261
u668503853
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)]\na=0\nfor i in range(1,n):\n if w[i-1][-1] == w[i][0]:\n if w[i] not in w[:i]:\n a=a\n else:\n a+=1\nif a==0:print("Yes")\nelse:print("No")', 'n=int(input())\nw=[input() for i in range(n)]\na=0\nfor i in range(1,n): \n if w[i-1][-1] == w[i][0]:\n if w[i] not in w[:i]:\n a=a\n else:\n a+=1\n else:\n a+=1\nif a==0:print("Yes")\nelse:print("No")']
['Wrong Answer', 'Accepted']
['s417277576', 's366810861']
[3060.0, 3064.0]
[18.0, 18.0]
[188, 211]
p03261
u669770658
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 -*-\nimport collections\n\n\nN = int(input())\n\ni = 0\nW = []\nwhile i < N:\n W.append(str(input()))\n i += 1\n\nfor i in range(len(W)):\n if W[i][0] != W[i+1][-1]:\n print('No')\n break\n\nc = collections.Counter(W)\n\nif c.values() in range(2, N+1):\n print('No')\n\nelse:\n print('Yes')", "# -*- coding: utf-8 -*-\nimport collections\n\n\nN = int(input())\n\ni = 0\nW = []\nwhile i < N:\n W.append(str(input()))\n i += 1\n\nfor i in range(len(W)):\n if W[i][-1] != W[i+1][0]:\n print('No')\n break\n\nc = collections.Counter(W)\n\nif c.values() in range(2, N+1):\n print('No')\n\nelse:\n print('Yes')", 'def abc112_b():\n n, limit_time = map(int, input().split())\n ans = 1001\n\n for _ in range(n):\n cost, time = map(int, input().split())\n\n if time <= limit_time and ans > cost:\n ans = cost\n\n return ans if ans != 1001 else "TLE"\n\n\ndef abc109_b():\n length = int(input())\n word_list = []\n\n for _ in range(length):\n word_list.append(input())\n\n for i in range(len(word_list) - 1):\n\n if word_list.count(word_list[i]) >= 2 or word_list[i][-1] != word_list[i+1][0]:\n return "No"\n\n return "Yes"\n\n\nif __name__ == \'__main__\':\n print(abc109_b())']
['Runtime Error', 'Runtime Error', 'Accepted']
['s609223038', 's906338752', 's483635255']
[3316.0, 3316.0, 3064.0]
[21.0, 21.0, 19.0]
[316, 316, 608]
p03261
u674588203
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 n in range(N):\n W=input()\n Ws.append(W)\n\nfor w in range(len(Ws)):\n if Ws.count(w)>1:\n print(\'No\')\n exit()\n\nfor x in range (1,N):\n if Ws[x][0] != Ws[x-1][-1]:\n print("No")\n exit()\nprint("Yes")\n', 'N=int(input())\nWs=[]\nfor n in range(N):\n W=input()\n Ws.append(W)\n\nfor w in range(len(Ws)):\n if Ws.count(w)>=2:\n print(\'No\')\n exit()\n\nfor x in range (1,N+1):\n if Ws[x][0] != Ws[x-1][-1]:\n print("No")\n exit()\nprint("Yes")\n', 'N=int(input())\nWs=[]\nfor n in range(N):\n W=input()\n Ws.append(W)\n\nfor w in range(len(Ws)):\n if Ws.count(w)>=2:\n print(\'No\')\n exit()\n\nfor x in range (1,N):\n if Ws[x][0] != Ws[x-1][-1]:\n print("No")\n exit()\nprint("Yes")\n', 'N=int(input())\nWs=[]\nfor n in range(N):\n W=input()\n Ws.append(W)\n\nfor w in range(len(Ws)):\n if Ws.count(w)>=2:\n print(\'No\')\n exit()\n\nfor x in range (1,len(Ws)):\n if Ws[x][0] != Ws[x-1][-1]:\n print("No")\n exit()\nprint("Yes")', 'N=int(input())\nWs=[]\nfor n in range(N):\n W=input()\n Ws.append(W)\n\nfor w in range(len(Ws)):\n if Ws.count(Ws[w])>=2:\n print("No")\n exit()\n \nfor x in range (1,len(Ws)):\n if Ws[x][0] != Ws[x-1][-1]:\n print("No")\n exit()\n\nprint("Yes")']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s087570887', 's153755572', 's246475865', 's645764803', 's553994437']
[3060.0, 3060.0, 2940.0, 3060.0, 3064.0]
[17.0, 17.0, 17.0, 18.0, 17.0]
[257, 260, 258, 263, 276]
p03261
u677705680
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 n in range(N)]\n\nap = []\nflag = "No"\na = 0\nfor n in range(N - 1):\n \n if W[n + 1][0] == W[n][-1] and W[n] not in ap:\n a = 0\n else:\n flag = "Yes" \n ap.append(W[n])\n\nprint(flag)', 'N = int(input())\n\nW = [input() for n in range(N)]\n\nflag = "Yes"\n\nfor n in range(1, N):\n if W[n][0] != W[n - 1][-1] or (W[n] in W[:n]):\n flag = "No"\n\nprint(flag)']
['Wrong Answer', 'Accepted']
['s569953925', 's882123138']
[3064.0, 3060.0]
[17.0, 17.0]
[234, 170]
p03261
u680851063
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 _ in [0]*n]\nprint(l)\nif len(set(l)) != n:\n print('No')\nelse:\n for i in range(n-1):\n print(i)\n print(list(l[i])[-1])\n print(list(l[i+1])[0])\n if list(l[i])[-1] != list(l[i+1][0]):\n print('No')\n #else:\n #print('Noo')\n #break\n #else:\n print('Yes')\n", "n = int(input())\nl = [input() for _ in [0]*n]\nprint(l)\nif len(set(l)) != n:\n print('No')\nelse:\n for i in range(n-1):\n #print(i)\n #print(list(l[i])[-1])\n #print(list(l[i+1])[0])\n if list(l[i])[-1] != list(l[i+1][0]):\n print('No')\n #else:\n #print('Noo')\n #break\n #else:\n print('Yes')\n", "\n\nn = int(input())\nl = [input() for _ in [0]*n]\nif len(set(l)) != n:\n print('No')\nelse:\n for i in range(n-1):\n if l[i][-1] != l[i+1][0]: \n print('No')\n break\n else:\n continue\n else:\n print('Yes')\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s300721304', 's594535146', 's549026079']
[3064.0, 3060.0, 3060.0]
[18.0, 18.0, 17.0]
[359, 362, 397]
p03261
u681110193
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()\nlast=s[-1]\n\nfor i in range(n-1):\n s=input()\n if s[0]!=last:\n print(s[0])\n print(last)\n print('No')\n break\n last=s[-1]\n if i==n-2:\n print('Yes')", "n=int(input())\ns=input()\na=[]\nlast=s[-1]\na.append(s)\n\nfor i in range(n-1):\n s=input()\n a.append(s)\n if s[0]!=last:\n print('No')\n break\n last=s[-1]\n if i==n-2 and len(a)==len(set(a)):\n print('Yes')\n elif i==n-2:\n print('No')\n "]
['Wrong Answer', 'Accepted']
['s701937266', 's337561497']
[3060.0, 3060.0]
[18.0, 18.0]
[187, 246]
p03261
u692746605
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=set()\nwp=input()\ns.add(wp)\n\nf=True\nfor i in range(n-1):\n wn=input()\n if wp[-1]!=wn[0]:\n f=False\n elif s.issubset(set(wp))==True:\n f=False\n wp=wn\n s.add(wn)\n\nprint('Yes' if f==True else 'No')\n", "n=int(input())\ns=set()\nwp=input()\ns.add(wp)\n\nf=True\nfor i in range(n-1):\n wn=input()\n if wp[-1]!=wn[0]:\n f=False\n elif wn in s:\n f=False\n wp=wn\n s.add(wn)\n\nprint('Yes' if f==True else 'No')\n"]
['Wrong Answer', 'Accepted']
['s335616255', 's855839991']
[3060.0, 3060.0]
[17.0, 17.0]
[219, 201]
p03261
u695079172
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 = int(input())\n word_lst = [""] * n\n previous_word = input()\n ok = True\n for i in range(1,n):\n now_word = input()\n if not (now_word[0] == previous_word[-1]):\n ok = False\n break\n previous_word = now_word\n\n print("Yes" if ok else "No")\n\n\n\n\n\n\nif __name__ == \'__main__\':\n main()\n', 'def main():\n n = int(input())\n word_lst = []\n previous_word = input()\n word_lst.append(previous_word)\n ok = True\n for i in range(1,n):\n now_word = input()\n if not (now_word[0] == previous_word[-1]):\n ok = False\n break\n if now_word in word_lst:\n ok = False\n break\n word_lst.append(now_word)\n previous_word = now_word\n if len(word_lst) != len(set(word_lst)):\n ok = False\n\n print("Yes" if ok else "No")\n\n\n\n\n\n\nif __name__ == \'__main__\':\n main()\n']
['Wrong Answer', 'Accepted']
['s117799061', 's569552735']
[3060.0, 3064.0]
[17.0, 18.0]
[354, 554]
p03261
u695811449
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 i in range(N)]\n\ncheck=1\n\nfor i in range(2,N):\n if W[i-1][-1] != W[i][0]:\n check=0\n\n \n\n\n\n\nW.sort()\n\n\n\nfor i in range(2,N):\n if W[i]==W[i-1]:\n check=0\n print(i)\n\n\n\n\n\n\nif check==1:\n print("Yes")\n\nelse:\n print("No")\n', 'import sys\n\nN=int(input())\nW=[input() for i in range(N)]\n\nfrom collections import Counter\ncounter=Counter(W)\n\nif max(counter.values())>1:\n print("No")\n sys.exit()\n\nfor i in range(1,N):\n if W[i][0]!=W[i-1][-1]:\n print("No")\n sys.exit()\n\nprint("Yes")']
['Wrong Answer', 'Accepted']
['s176987426', 's456788038']
[3064.0, 3316.0]
[19.0, 21.0]
[279, 271]
p03261
u698479721
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())\nk = input()\na = []\nfor i in range(N-1):\n a.append(input())\nlis = []\nfor words in a:\n if words in lis:\n print('No')\n sys.exit()\n elif k[-1] != words[0]:\n print('No')\n sys.exit()\n else:\n lis.append(words)\n k = words\nprint('Yes')", "import sys\nN = int(input())\nk = input()\na = []\nfor i in range(N-1):\n a.append(input())\nlis = [k]\nfor words in a:\n if words in lis:\n print('No')\n sys.exit()\n elif k[-1] != words[0]:\n print('No')\n sys.exit()\n else:\n lis.append(words)\n k = words\nprint('Yes')"]
['Wrong Answer', 'Accepted']
['s046367734', 's411028571']
[3064.0, 3064.0]
[17.0, 17.0]
[278, 279]
p03261
u702208001
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())\nz = list(input() for _ in range(n))\nif len(set(z)) == len(z):\n if all([z[i][-1] == z[i+1][0] for i in range(len(z)-1)]):\n print('Yes')\n else:\n print('No')\n", 'n=int(input())\nw=[input() for i in range(n)]\nflag=False\nif n==len(set(w)):\n if all([w[i-1][-1]==w[i][0] for i in range(1,n)]):\n flag=True\nprint("Yes" if flag else "No")']
['Wrong Answer', 'Accepted']
['s403634481', 's291272533']
[3060.0, 3060.0]
[17.0, 17.0]
[180, 178]
p03261
u706695185
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\nlastch = ''\nanswer = 'Yes'\nwords = []\nfor i in range(n):\n word = list(input())\n words.append(word)\n if lastch != word[0] and i != 0:\n answer = 'No'\n lastch = word[-1]\n\nif len(set(words)) != len(words):\n answer = 'No'\n\nprint(answer)\n", "n = int(input())\n\nlastch = ''\nanswer = 'Yes'\nfor i in range(n):\n word = list(input())\n if lastch != word[0] and i != 0:\n answer = 'No'\n lastch = word[-1]\n\nprint(answer)\n", "n = int(input())\n\nlastch = ''\nanswer = 'No'\nwords = []\n\nfor i in range(n):\n word = raw_input()\n words.append(word)\n if lastch == word[0] and i != 0:\n answer = 'Yes'\n else:\n answer = 'No'\n lastch = word[-1]\n\nprint('Yes' if len(words) == len(set(words)) and answer == 'Yes' else 'No')\n", "n = int(input())\n\nlastch = ''\nanswer = 'Yes'\nwords = []\n\nfor i in range(n):\n word = input()\n words.append(word)\n if lastch != word[0] and i != 0:\n answer = 'No'\n lastch = word[-1]\n\nif len(words) != len(set(words)):\n answer = 'No'\n\nprint(answer)\n"]
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s390476171', 's727843178', 's939802274', 's801240080']
[3060.0, 2940.0, 3060.0, 3060.0]
[17.0, 18.0, 18.0, 17.0]
[272, 185, 312, 267]
p03261
u711295009
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())\nindex = 0\nlist1 = []\nlistForWord=[]\nlists = []\nflag =0\nwhile index <n:\n word = input()\n list1.append(list(word))\n if index!= 0:\n length = len(lists[index-1])\n if lists[index-1][length-1] == list1[index][0]:\n if word in listForWord == False:\n pass\n else:\n frag =1\n else:\n frag =1\n lists.append(list1[index])\n listForWord.append(word)\n index+=1\n if index==n and flag ==0:\n print("Yes")\n elif index ==n and flag ==1:\n print("No")\n', 'n = int(input())\nindex=0\nlists =[]\nlistForWords=[]\nflag =0\nwhile index<n:\n word = input()\n list1 = list(word)\n if index!=0:\n length = len(lists[index-1])\n if list1[0] == lists[index-1][length-1]:\n for li in listForWords:\n if word == li:\n flag =1\n else:\n flag =1\n lists.append(list1)\n listForWords.append(word)\n index+=1\n\nif flag==0:\n print("Yes")\nelse:\n print("No")\n']
['Wrong Answer', 'Accepted']
['s176242521', 's225202812']
[3064.0, 3064.0]
[18.0, 18.0]
[566, 467]
p03261
u711539583
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())\np = ''\nd = []\nfor _ in range(n):\n w = input()\n if p and p[-1] == w[0]\n print('No')\n exit()\n if w in d:\n print('No')\n exit()\n p = w[-1]\n d[w] = 1\nprint('Yes')\n ", "n = int(input())\np = ''\nd = {}\nfor _ in range(n):\n w = input()\n if p and p[-1] != w[0]:\n print('No')\n exit()\n if w in d:\n print('No')\n exit()\n p = w[-1]\n d[w] = 1\nprint('Yes')\n \n"]
['Runtime Error', 'Accepted']
['s649885136', 's623649317']
[2940.0, 2940.0]
[18.0, 17.0]
[194, 196]
p03261
u712975113
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 _ in range(N):\n W.append(input())\nc=1\nfor i in range(N-1):\n if W[i][-1]!=W[i+1][0]:\n c=0\n break\nif c:\n print('Yes')\nelse:\n print('No')", "N=int(input())\nW=[]\nfor _ in range(N):\n W.append(input())\nc=1\nfor i in W:\n d=W.count(i)\n if d>1:\n c=0\n break\nfor i in range(N-1):\n if W[i][-1]!=W[i+1][0]:\n c=0\n break\nif c:\n print('Yes')\nelse:\n print('No')"]
['Wrong Answer', 'Accepted']
['s223575076', 's532251765']
[3060.0, 3064.0]
[17.0, 17.0]
[193, 260]
p03261
u721316601
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())\nw = []\n\nfor i in range(n):\n s = input()\n if s in w:\n flag = 0\n break\n else:\n w.append(s)\n\nfor i in range(1, n-1):\n if w[i][-1] != w[i+1][0]:\n flag = 0\n break\n\nif flag == 0:\n print('No')\nelse:\n print('Yes')", "N = int(input())\nw = input()\nword = [w]\nbefore = w[-1]\nflag = True\n\nfor i in range(N-1):\n w = input()\n if w not in word and before == w[0]:\n word.append(w)\n before = w[-1]\n else:\n flag = False\n break\n\nif flag == True:\n print('Yes')\nelse:\n print('No')\n"]
['Runtime Error', 'Accepted']
['s560267120', 's759175978']
[3060.0, 3060.0]
[17.0, 18.0]
[276, 294]
p03261
u721776301
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.
['num_word = int(input())\nword_list=[]\nword_list = [str(input()) for i in range(num_word)]\n \nword_list_temp=[]\nfor j in range(len(word_list)):\n if j == len(word_list)-1:\n print ("Yes")\n break\n else:\n old_word=word_list[j]\n old_word_sep=list(old_word)\n word_list_temp.append(old_word)\n new_word=word_list[j+1]\n new_word_sep=list(word_list[j+1])', 'num_word = int(input())\nword_list=[]\nword_list = [[int(i) for i in input().split()] for i in range(n)] \n\nword_list_temp=[]\nfor j in range(len(word_list)):\n if j == len(word_list)-1:\n print ("Yes")\n break\n else:\n old_word=word_list[j]\n old_word_sep=list(old_word)\n word_list_temp.append(old_word)\n new_word=word_list[j+1]\n new_word_sep=list(word_list[j+1])\n if old_word_sep[len(old_word)-1]!=new_word_sep[0]:\n print ("No")\n break\n elif new_word in list(word_list_temp):\n print ("No")\n break\n else:\n continue', 'num_word = int(input())\nword_list=[]\nword_list = [str(input()) for i in range(num_word)] \n \nword_list_temp=[]\nfor j in range(len(word_list)):\n if j == len(word_list)-1:\n print ("Yes")\n break\n else:\n old_word=word_list[j]\n old_word_sep=list(old_word)\n word_list_temp.append(old_word)\n new_word=word_list[j+1]\n new_word_sep=list(word_list[j+1])\n if old_word_sep[len(old_word)-1]!=new_word_sep[0]:\n print ("No")\n break\n elif new_word in list(word_list_temp):\n print ("No")\n break\n else:\n continue']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s148937646', 's287616449', 's220962983']
[3064.0, 3064.0, 3064.0]
[18.0, 17.0, 18.0]
[364, 563, 550]
p03261
u727787724
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 fractions\nn,x=map(int,input().split())\na=list(map(int,input().split()))\nans=abs(x-a[0])\ncnt=abs(a[1]-a[0])\nfor j in range(n-1):\n cnt=min(abs(a[j+1]-a[j]),cnt)\nfor i in range(n):\n ans=min(abs(x-a[i]),ans)\nprint(min(ans,cnt))\n ', "n=int(input())\nw=[]\nans='Yes'\nfor i in range(n):\n w.append(list(input()))\n if i==0:\n continue\n if w[i][0]!=w[i-1][len(w[i-1])-1]:\n ans='No'\n break\n for j in range(i):\n if w[i]==w[j]:\n ans='No'\n break\nprint(ans)\n "]
['Runtime Error', 'Accepted']
['s755350576', 's953710777']
[5048.0, 3060.0]
[35.0, 18.0]
[241, 285]
p03261
u729119068
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=list(input()for i in range(N))\nif len(A)==len(set(A)):\n if all(A[i][-1]==A[i+1][0]) for i in range(N-1):\n print('Yes')\n else:print('No')\nelse:print('No')", "N=int(input())\nA=list(input()for i in range(N))\nif len(A)==len(set(A)):\n if all(A[i][-1]==A[i+1][0]) for i in range(N-2):\n print('Yes')\n else:print('No')\nelse:print('No')", "N=int(input())\nA=list(input()for i in range(N))\nif len(A)==len(set(A):\n if all(A[i][-1]==A[i+1][0]) for i in range(N-1):\n print('Yes')\n else:print('No')\nelse:print('No')", "N=int(input())\nA=list(input()for i in range(N))\nif len(A)==len(set(A)):\n if all(A[i][-1]==A[i+1][0] for i in range(N-1)):\n print('Yes')\n else:print('No')\nelse:print('No')"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s249853091', 's561325677', 's874641222', 's161321124']
[8864.0, 9008.0, 8900.0, 8868.0]
[25.0, 25.0, 23.0, 30.0]
[183, 183, 182, 183]
p03261
u736729525
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().strip() for _ in range(N)]\n\ndef solve(words):\n s = set(words[0])\n for p, w in zip(words, words[1:]):\n if p[-1] != w[0]:\n return "No"\n if w in s:\n return "No"\n s.add(w)\n return "Yes"\n\nprint(solve(words))', 'N = int(input()) \nfor i in range(N):\n W.append(input())\n\nprev = W[0]\n\nanswer = "Yes"\n\nfor w in W[1:]:\n if prev[-1] != w[0]:\n answer = "No"\n\nprint(answer) ', 'N = int(input())\nwords = [input().strip() for _ in range(N)]\n\ndef solve(words):\n s = {words[0]}\n for p, w in zip(words, words[1:]):\n if p[-1] != w[0]:\n return "No"\n if w in s:\n return "No"\n s.add(w)\n return "Yes"\n\nprint(solve(words))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s606733811', 's666948003', 's893517058']
[3060.0, 2940.0, 3060.0]
[17.0, 19.0, 17.0]
[258, 418, 255]
p03261
u747873993
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(i)\nW=[int(input()) for i in range(N)]\nfor i in range(N-1):\n if W[i:].find(W[i])==True:\n print("No")\n elif W[i][-1]!=W[i+1][0]:\n print("No")\nelse:\n print("Yes")', 'N=int(input())\nW=[input() for i in range(N)]\nfor i in range(N-1):\n if W[i] in W[i+1:]:\n print("No")\n break\n elif W[i][-1]!=W[i+1][0]:\n print("No")\n break\nelse:\n print("Yes")']
['Runtime Error', 'Accepted']
['s805637297', 's019809428']
[3060.0, 3064.0]
[17.0, 17.0]
[174, 210]
p03261
u748377775
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())\nanswer=[]\n\nfor i in range(N):\n answer.append(input())\n\nfor j in range(N-1):\n if(answer[j][-1]==answer[j+1][0]):\n if(j==N-2):\n print("Yes")\n else:\n continue\n else:\n print("No")\n break', 'N=int(input())\nanswer=[]\n\nfor i in range(N):\n answer.append(input())\n \nif(len(set(answer))!=len(answer)):\n print("No")\nelse:\n for j in range(N-1):\n if(answer[j][-1]==answer[j+1][0]):\n if(j==N-2):\n print("Yes")\n else:\n continue\n else:\n print("No")\n break']
['Wrong Answer', 'Accepted']
['s245374145', 's738333305']
[3060.0, 3060.0]
[20.0, 18.0]
[256, 353]
p03261
u759412327
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(input() for i in range(N))\nf = True\n\nfor i in range(N-1):\n if W[i][-1]!=W[i+1][0]:\n f = False\n \nif N!=len(set(W)) and f:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nW = [input() for n in range(N)]\na = "Yes"\n\nfor n in range(N-1):\n if W[n][-1]!=W[n+1][0] or W.count(W[n])!=1:\n a = "No"\n\nprint(a)']
['Wrong Answer', 'Accepted']
['s827152083', 's882710890']
[3060.0, 9172.0]
[18.0, 33.0]
[188, 149]
p03261
u760794812
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()) \nt = [input() for i in range(N)] \n\ndef is_unique(seq):\n return len(seq) == len(set(seq))\n\nif is_unique(t) == False:\n print('No')\n\ncount = 0 \n\nwhile count < N-1:\n if t[count][-1] != t[count+1][0]:\n print('No')\n break\n else:\n count += 1\nprint('Yes')\n", "N = int(input()) \nt = [input() for i in range(N)] \n\ndef is_unique(seq):\n return len(seq) == len(set(seq))\nflag = 'B'\nif is_unique(t) == False:\n flag = 'A'\n\ncount = 0 \nwhile count < N-1:\n if t[count][-1] != t[count+1][0]:\n flag = 'A'\n count += 1\n else:\n count += 1\n\nif flag =='A':\n print('No')\nelse:\n print('Yes')"]
['Wrong Answer', 'Accepted']
['s298778091', 's962713256']
[3060.0, 3064.0]
[17.0, 17.0]
[290, 339]
p03261
u763115743
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 solve(words):\n word = words[0]\n uniq_words = {word: True}\n print(words)\n\n ans = "Yes"\n for key in range(1, len(words)):\n next_word = words[key]\n if next_word in uniq_words:\n ans = "No"\n break\n uniq_words[next_word] = True\n if word[-1] != next_word[0]:\n ans = "No"\n break\n word = next_word\n\n return ans\n\ndef main():\n n = int(input())\n words = []\n for i in range(n):\n words.append(input())\n\n ans = solve(words)\n print(ans)\n\nmain()', '\n\ndef solve(words):\n word = words[0]\n uniq_words = {word: True}\n\n ans = "Yes"\n for key in range(1, len(words)):\n next_word = words[key]\n if next_word in uniq_words:\n ans = "No"\n break\n uniq_words[next_word] = True\n if word[-1] != next_word[0]:\n ans = "No"\n break\n word = next_word\n\n return ans\n\ndef main():\n n = int(input())\n words = []\n for i in range(n):\n words.append(input())\n\n ans = solve(words)\n print(ans)\n\nmain()\n']
['Wrong Answer', 'Accepted']
['s947236943', 's881027547']
[3064.0, 3064.0]
[17.0, 18.0]
[551, 587]
p03261
u764956288
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)]\n\nans = 'Yes'\nif len(words) != len(set(words)):\n ans = 'No1'\nelse:\n next_words = words[1:]+['']\n for s1,s2 in zip(words,next_words):\n if s2 and s1[-1] != s2[0]:\n ans = 'No2'\n break\n\nprint(ans)", "N = int(input())\nwords = [input() for _ in range(N)]\n\nans = 'Yes'\nif len(words) != len(set(words)):\n ans = 'No'\nelse:\n next_words = words[1:]+['']\n for s1,s2 in zip(words,next_words):\n if s2 and s1[-1] != s2[0]:\n ans = 'No'\n break\n\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s514691261', 's849633467']
[3060.0, 3064.0]
[17.0, 18.0]
[282, 280]
p03261
u770009793
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 = list()\nal = list()\nbl = list()\n\nfor n in N:\n a = input()\n\u3000 l.append(a)\n al.append(a[:1])\n bl.append(a[-1:])\n\nl_unq = list(set(l))\nif len(l) == len(l_unq):\n for i in N-1:\n if al[i+1] != bl[i]:\n print("No")\n break\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nl = list()\nal = list()\nbl = list()\n \nfor n in range(0,N):\n a = input()\n\u3000 l.append(a)\n al.append(a[:1])\n bl.append(a[-1:])\n \nl_unq = list(set(l))\nif len(l) == len(l_unq):\n for i in range(0,N-1):\n if al[i+1] != bl[i]:\n print("No")\n break\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nl = list()\nal = list()\nbl = list()\n \nfor n in range(0,N):\n a = input()\n\u3000 l.append(a)\n al.append(a[1])\n bl.append(a[-1])\n \nl_unq = list(set(l))\nif len(l) == len(l_unq):\n for i in range(0,N-1):\n if al[i+1] != bl[i]:\n print("No")\n break\n print("Yes")\nelse:\n print("No")\n', 'N = int(input())\nl = list()\n\nfor n in range(N):\n a = input()\n l.append(a)\n\nl_uniq = list(set(l))\n\nif len(l) == len(l_uniq):\n for i in range(0, N-1):\n if l[i+1][0] != l[i][-1]:\n print("No")\n break\n else:\n print("Yes")\nelse:\n print("No")\n \n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s138442759', 's718999842', 's833561629', 's940464730']
[2940.0, 3192.0, 2940.0, 3060.0]
[17.0, 18.0, 17.0, 17.0]
[311, 331, 330, 292]
p03261
u771167374
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())\nlist = [input() for _ in range(n)]\na = 'Yes'\nif len(set(list))!=n:\n ans = 'No'\nfor i in range(n-1):\n if list[i][-1]!=list[i+1][0]:\n a = 'No'\nprint(a)", "n = int(input())\nlist = [input() for _ in range(n)]\na = 'Yes'\nif len(set(list))!=n:\n a = 'No'\nfor i in range(n-1):\n if list[i][-1]!=list[i+1][0]:\n a = 'No'\nprint(a)"]
['Wrong Answer', 'Accepted']
['s780170200', 's888139041']
[3060.0, 3060.0]
[17.0, 17.0]
[179, 177]
p03261
u771532493
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=[]\na=True\nfor i in range(n):\n L.append(input())\nif len(L)!=len(set(L)):\n print('No')\nelse:\n for i in range(1,len(L)):\n if L[i][0]==L[i-1][-1]:\n continue\n else:\n a=False\n if a is True:\n print('Yes')\n else:\n print('No')\n\n", "n=int(input())\nL=[]\na=True\nfor i in range(n):\n L.append(input())\nif len(L)!=len(set(L)):\n print('No')\nelse:\n for i in range(1,len(L)):\n if L[i][0]==L[i-1][-1]:\n continue\n else:\n a=False\n if a is True:\n print('Yes')\n else:\n print('No')"]
['Runtime Error', 'Accepted']
['s192414253', 's444485239']
[3060.0, 3064.0]
[18.0, 19.0]
[263, 261]
p03261
u773686010
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.
['\nimport collections\nN = int(input())\nWord_List = []\nSP = ""\nfor i in range(N):\n CW = str(input())\n if i == 0:\n Word_List.append(CW)\n SP = CW[-1]\n elif SP != CW[0]:\n break\n else:\n Word_List.append(CW)\n SP = CW[-1]\nelse:\n Word_List = collections.Counter(Word_List))\n if len(Word_List) != N:\n print("No")\n else:\n print("Yes")', '\nimport collections\nN = int(input())\nWord_List = []\nSP = ""\nfor i in range(N):\n CW = str(input())\n if i == 0:\n Word_List.append(CW)\n SP = CW[-1]\n elif SP != CW[0]:\n print("No")\n break\n else:\n Word_List.append(CW)\n SP = CW[-1]\nelse:\n Word_List = collections.Counter(Word_List)\n if len(Word_List) != N:\n print("No")\n else:\n print("Yes")']
['Runtime Error', 'Accepted']
['s700017120', 's585040139']
[8988.0, 9388.0]
[24.0, 31.0]
[442, 461]
p03261
u774539708
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())\nnow=input()\nfor i in range(n-1):\n w=input()\n if now[-1]!=w[0]:\n print("No")\n sys.exit()\n now=w\nprint("Yes")', 'import sys\nn=int(input())\nnow=input()\nD=[now]\nfor i in range(n-1):\n w=input()\n if now[-1]!=w[0] or w in D:\n print("No")\n sys.exit()\n D.append(w) \n now=w\nprint("Yes")']
['Wrong Answer', 'Accepted']
['s801987170', 's443708523']
[3060.0, 3064.0]
[17.0, 19.0]
[156, 191]
p03261
u776190305
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 \n last = None\n seen = set()\n for _ in range(n):\n w = input()\n if w in seen or (last and last[-1] != w[0]):\n print("No")\n break\n seen.add(w)\n else:\n print("Yes")', 'n = int(input())\n\nlast = None\nseen = set()\nfor _ in range(n):\n w = input()\n if w in seen or (last and last[-1] != w[0]):\n print("No")\n break\n seen.add(w)\n last = w\nelse:\n print("Yes")\n']
['Runtime Error', 'Accepted']
['s771621244', 's335551081']
[2940.0, 3060.0]
[17.0, 19.0]
[232, 195]
p03261
u777028980
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())\nhoge=[]\nno=0\n\na=input()\nhoge.append(a)\nsaigo=a[-1]\n\nfor i in range(n-1):\n a=input()\n hoge.append(a)\n if(hoge.count(a)>1):\n no=1\n break\n if(saigo==a[-1]):\n no=1\n break\n saigo=a[-1]\n \nif(no==0):\n print("YES")\nelse:\n print("NO")', 'n=int(input())\nhoge=[]\nno=0\n\na=input()\nhoge.append(a)\nsaigo=a[-1]\n\nfor i in range(n-1):\n a=input()\n hoge.append(a)\n if(hoge.count(a)>1):\n no=1\n break\n if(saigo==a[0]):\n saigo=a[-1]\n else:\n no=1\n break\n \nif(no==0):\n print("YES")\nelse:\n print("NO")', 'n=int(input())\nhoge=[]\nno=0\n\na=input()\nhoge.append(a)\nsaigo=a[-1]\n\nfor i in range(n-1):\n a=input()\n hoge.append(a)\n if(hoge.count(a)>1):\n no=1\n break\n if(saigo==a[0]):\n saigo=a[-1]\n else:\n no=1\n break\n \nif(no==0):\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s318707511', 's562846917', 's155132390']
[3064.0, 3064.0, 3064.0]
[18.0, 17.0, 18.0]
[260, 269, 269]
p03261
u778814286
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 = []\n\nw.append(input())\n\nans = 'Yes'\nfor i in range(1,n,1):\n w.append(input())\n l = len(w[j])\n if w[i][0:1] != w[j][l-1:l]: ans = 'No'\n for j in range(i):\n if w[i] == w[j]: ans = 'No'\n\nprint(ans)", "n = int(input())\nw = []\n\nw.append(input())\n\nans = 'Yes'\nfor i in range(1,n,1):\n w.append(input())\n l = len(w[i-1])\n if w[i][0:1] != w[i-1][l-1:l]:\n ans = 'No'\n break\n for j in range(i):\n if w[i] == w[j]:\n ans = 'No'\n break\n\nprint(ans)\n"]
['Runtime Error', 'Accepted']
['s561580954', 's955803320']
[3064.0, 3060.0]
[18.0, 18.0]
[222, 259]
p03261
u782685137
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=input()\nd={b}\nf=1\nfor _ in [0]*~-N:s=input();f=b[-1]==s[0]and s not in d;b=s;d|={s}\nprint('Yes'if f else'No', d)", "N=int(input())\nb=input()\nd={b}\nf=1\nfor _ in [0]*~-N:s=input();f=b[-1]==s[0]and s not in d;b=s;d|={s}\nprint('Yes'if f else'No')", "N=int(input())\nb=input()\nd={b}\nf=1\nfor _ in [0]*~-N:\n s=input()\n if b[-1]!=s[0]or s in d:f=0;break\n b=s;d|={s}\nprint('Yes'if f else'No')"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s199140955', 's571700245', 's119152049']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[129, 126, 139]