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 | u097708290 | 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. | ['loop=int(input())\nword=input()\nword_list=list()\nword_list.append(word)\n\nfor i in range(loop-1):\n word=input()\n for j in range(len(word_list)):\n print(word_list[j],word)\n if word_list[j]==word:\n print("No")\n break\n if word_list[i][-1]!=word[0]:\n print("No")\n break\n if j!=len(word_list)-1:\n break\n word_list.append(word)\n if i==loop-2:\n print("Yes")\n', 'loop=int(input())\nword=input()\nword_list=list()\nword_list.append(word)\n \nfor i in range(loop-1):\n word=input()\n for j in range(len(word_list)):\n if word_list[j]==word:\n print("No")\n break\n if word_list[i][-1]!=word[0]:\n print("No")\n break\n if j!=len(word_list)-1:\n break\n word_list.append(word)\n if i==loop-2:\n print("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s555251401', 's515678539'] | [3188.0, 3064.0] | [22.0, 18.0] | [383, 354] |
p03261 | u102242691 | 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 = []\na = []\nstatus = True\n\nfor _ in range(n):\n w.append(input())\n\na.append(w[0])\n\nfor i in range(1,n):\n a.append(w[i])\n if a.count(w[i]) == 1 and (a[i-1])[-1] == (a[i])[0]:\n pass\n else:\n status == False\n print(status)\n break\n\nif status:\n print("Yes")\nelse:\n print("No")\n', '\nn = int(input())\nw = [input() for _ in range(n)]\nt = []\n\nw_s = w.copy()\nw_s = set(w_s)\nw_s = list(w_s)\n\nif len(w) != len(w_s):\n print("No")\n exit()\n\nfor i in range(n-1):\n a = w[i]\n b = w[i+1]\n if a[-1] != b[0]:\n print("No")\n exit()\nprint("Yes")\n'] | ['Wrong Answer', 'Accepted'] | ['s102607361', 's351425655'] | [3064.0, 3064.0] | [17.0, 17.0] | [336, 275] |
p03261 | u113255362 | 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. | ['Row = int(input())\nflag = True\nList = []\nfor i in range (Row):\n List.append(int(input()))\ns_l = set(List)\nif len(List) != len(s_l):\n print("No")\nfor i in range(Row-1):\n n = len(List[i])-1\n if List[i][n] != List[i+1][0]:\n flag = False\nif flag:\n print("Yes")\nelse:\n print("No")', 'Row = int(input())\nflag = True\nList = []\nfor i in range (Row):\n List.append(input())\ns_l = set(List)\nif len(List) != len(s_l):\n print("No")\nelse:\n for i in range(Row-1):\n n = len(List[i])-1\n if List[i][n] != List[i+1][0]:\n flag = False\n if flag:\n print("Yes")\n else:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s680981759', 's362093478'] | [9136.0, 9152.0] | [21.0, 25.0] | [284, 301] |
p03261 | u114920558 | 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()\ncnt = 0\nA.append(input())\nfor i in range(N-1):\n x = input()\n if x in A:\n cnt = 1\n elif A[i][-1:] != x[0]:\n cnt = 1\n else:\n A.append(x)\nprint('Yes' if cnt == 0 else 'No')", "N = int(input())\nA = list()\ncnt = 0\nA.append(input())\nfor i in range(N-1):\n x = input()\n if x in A:\n cnt = 1\n elif A[i][-1:] != x[0]:\n cnt = 1\n A.append(x)\nprint('Yes' if cnt == 0 else 'No')"] | ['Runtime Error', 'Accepted'] | ['s014341647', 's135685596'] | [3060.0, 3060.0] | [19.0, 17.0] | [210, 200] |
p03261 | u116328320 | 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. | ["input_lines = int(input())\nlastchar = ''\nfor i in range(input_lines):\n s = input().rstrip()\n if len(lastchar) > 0 and not s[0] in lastchar:\n print('No')\n break\n lastchar = s[-1]\nelse:\n print('Yes')\n ", "input_lines = int(input())\ntango=[]\nlastchar = ''\nfor i in range(input_lines):\n s = input().rstrip()\n if len(lastchar) > 0 and not s[0] in lastchar or s in tango:\n print('No')\n break\n tango.append(s)\n lastchar = s[-1]\nelse:\n print('Yes')\n"] | ['Wrong Answer', 'Accepted'] | ['s899674058', 's102134889'] | [2940.0, 3060.0] | [18.0, 20.0] | [228, 267] |
p03261 | u117545210 | 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\nlist=[]\nfor i in range(n):\n list.append(input())\n \nimport collections\nc=collections.Counter(list)\nt=0\nfor i in range(n-1):\n\n if list[i][len(list[i])-1]==list[i+1][0]:\n \n t += 1\n else:\n pass\n\nprint(t)\n\nif t == n-1 and len(c) == n:\n print("Yes")\nelse:\n print("No")', 'n= int(input())\n\nlist=[]\nfor i in range(n):\n list.append(input())\n \nimport collections\nc=collections.Counter(list)\nt=0\nfor i in range(n-1):\n\n if list[i][len(list[i])-1]==list[i+1][0]:\n \n t += 1\n else:\n pass\n\nif t == n-1 and len(c) == n:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s021613743', 's653926066'] | [3316.0, 3436.0] | [20.0, 26.0] | [294, 284] |
p03261 | u118211443 | 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())\nvo=[]\nflag=1\nfor i in range(N):\n vo.append(input())\n \nif len(vo) != len(set(vo)):\n flag=0\n \nfor i in range(N-1):\n a=vo[i]\n b=vo[i+1]\n #print(a[len(a)-1],b[0]) \n if a[len(a)-1] != b[0]:\n flag=0 \nif flag == 0:\n print("NO")\nelse:\n print("YES")', 'N=int(input())\nvo=[]\nflag=1\nfor i in range(N):\n vo.append(input())\n \nif len(vo) != len(set(vo)):\n flag=0\n \nfor i in range(N-1):\n a=vo[i]\n b=vo[i+1]\n if a[len(a)-1] != b[0]:\n flag=0\n \nif flag == 0:\n print("NO")\nelse:\n print("YES")', 'N=int(input())\nvo=[]\nflag=True\nfor i in range(N):\n vo.append(input())\n \nif len(vo) != len(set(vo)):\n flag=False\n \nfor i in range(N-1):\n a=vo[i]\n b=vo[i+1] \n if a[len(a)-1] != b[0]:\n flag=False\n \nif not flag:\n print("No")\nelse:\n print("Yes")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s028710131', 's932305777', 's692467272'] | [3064.0, 3064.0, 3064.0] | [18.0, 19.0, 18.0] | [297, 270, 282] |
p03261 | u118642796 | 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 = []\nW.append(input())\nfor _ in range(N-1):\n W.append(input())\n if W[-1] in W[:-2]\n print("No")\n break\n if W[-1][0] != W[-2][-1]:\n print("No")\n break\nelse:\n print("Yes")', 'N = int(input())\nW = []\nW.append(input())\nfor _ in range(N-1):\n W.append(input())\n if (W[-1] in W[:-2]) or (W[-1][0] != W[-2][-1]):\n print("No")\n break\nelse:\n print("Yes")'] | ['Runtime Error', 'Accepted'] | ['s004589464', 's699161035'] | [2940.0, 3060.0] | [17.0, 17.0] | [228, 194] |
p03261 | u123872895 | 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 = []\nfor i in range(n):\n words.append(input())\n\nans = "Yes"\n \n\nif len(words) != len(set(words)):\n ans = "No"\nelse:\n for i in range(n-1):\n if words[i][-1] != words[i+1][0]:\n ans = "No"\n break\n print(ans)', 'n = int(input())\nl = [input()]\n\nflag = True\n\nfor i in range(n-1):\n s = input()\n if s not in l and s[0] == l[-1][-1]:\n l.append(s)\n else:\n flag = False\n break\n\nif flag:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s642027661', 's250068595'] | [3060.0, 9040.0] | [17.0, 25.0] | [243, 236] |
p03261 | u124592621 | 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\ncorrect = True\nend = w[0][-1]\nfor i in range(1, len(w)):\n word = w[i]\n if word in w[i + 1:]:\n correct = False\n break\n start = word[0]\n if start != end:\n correct = False\n break\n end = word[-1]\n\nif correct:\n print("Yes")\nelse:\n print("No")\n', 'n = int(input())\nw = [input() for _ in range(n)]\n\ncorrect = True\nfor i in range(1, len(w)):\n if w[i] in w[i + 1:]:\n correct = False\n break\n if i > 0 and w[i][0] != w[i - 1][-1]:\n correct = False\n break\n\nif correct:\n print("Yes")\nelse:\n print("No")\n', 'n = int(input())\nw = [input() for _ in range(n)]\n\ncorrect = True\nfor i in range(len(w)):\n if w[i] in w[i + 1:]:\n correct = False\n break\n if i > 0 and w[i][0] != w[i - 1][-1]:\n correct = False\n break\n\nif correct:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s019582208', 's481251868', 's825302109'] | [3060.0, 3060.0, 3064.0] | [17.0, 18.0, 17.0] | [337, 288, 285] |
p03261 | u130900604 | 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)];print(s)\nif (len(s) == len(set(s))) == 0:\n print("No")\n exit()\nfor c,d in zip(s[1:],s[0:]):\n if c[-1] == d[0]:\n pass\n else:\n print("No")\n exit()\nprint("Yes")', 'n=int(input())\ns=[input() for i in range(n)]\nif len(s) != len(set(s)):\n print("No");exit()\nfor c,d in zip(s[0:],s[1:]):\n if c[-1] != d[0]:\n print("No");exit()\nprint("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s937554705', 's775028816'] | [3064.0, 3060.0] | [17.0, 17.0] | [215, 176] |
p03261 | u131406572 | 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() for i in range(n)]\ns=0\nfor i in raneg(n-1):\n if a[i][-1]!=a[i+1][0]:\n s+=1\na.sort()\nfor i in raneg(n-1):\n if a[i]==a[i+1]:\n s+=1\nif s==0:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\na=[input() for i in range(n)]\ns=0\nfor i in range(n-1):\n if a[i][-1]!=a[i+1][0]:\n s+=1\na.sort()\nfor i in range(n-1):\n if a[i]==a[i+1]:\n s+=1\nif s==0:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s066190601', 's519924366'] | [3064.0, 3064.0] | [18.0, 18.0] | [222, 222] |
p03261 | u131464432 | 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()\nW_list = [w]\nfor i in range(N-1):\n W = input()\n if w[-1] == W[0] and W not in W.list:\n W_list.append(w)\n w = W\n else:\n print("No")\n exit()\nprint("Yes")', 'N = int(input())\nw = input()\nW_list = [w]\nfor i in range(N-1):\n W = input()\n if w[-1] == W[0] and W not in W_list:\n W_list.append(w)\n w = W\n else:\n print("No")\n exit()\nprint("Yes")'] | ['Runtime Error', 'Accepted'] | ['s878673786', 's423387034'] | [9120.0, 9108.0] | [27.0, 26.0] | [195, 195] |
p03261 | u132583371 | 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 = []\nfor i in range(n):\n w = input()\n l.append(w)\nfor k in range(n):\n if l[k-1][-1] == l[k][0]:\n for j in range(i):\n if l[k] == l[j]:\n flag = 0\n break\n else:\n flag = 1\n else:\n flag = 0\nif(flag == 1):\n print('Yes')\nelse:\n print('No')", "n = int(input())\nfor i in range(n):\n w = input()\n if i > 0:\n if w[i-1][-1] == w[i][0]:\n for j in range(i):\n if w[i] == w[j]:\n print('No')\n else:\n print('Yes')\n else:\n print('No')", "n = int(input())\nl = []\nflag = 0\nfor i in range(n):\n w = input()\n l.append(w)\nfor k in range(1,n):\n if l[k-1][-1] != l[k][0]:\n flag =1\n break\n\n for j in range(k):\n if l[k] == l[j]:\n flag = 1\n break\n \nif(flag == 1):\n print('No')\nelse:\n print('Yes')"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s084582263', 's570156371', 's933376475'] | [9196.0, 9124.0, 8976.0] | [31.0, 31.0, 25.0] | [351, 289, 316] |
p03261 | u138486156 | 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() for i in range(n)]\nfor i in range(n-1):\n if a[i][-1] == a[i+1][0]:\n continue\n else:\n print('No')\n exit()\nprint('Yes')\n ", "n = int(input())\na = [input() for i in range(n)]\nfor i in range(n):\n num = a.count(a[i])\n if num > 1:\n print('No')\n exit()\nfor i in range(n-1):\n if a[i][-1] == a[i+1][0]:\n continue\n else:\n print('No')\n exit()\nprint('Yes')\n"] | ['Wrong Answer', 'Accepted'] | ['s007204825', 's013131080'] | [2940.0, 3060.0] | [17.0, 18.0] | [163, 270] |
p03261 | u141642872 | 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)]\nL = []\nans = "Yes"\nfor i in range(1,N):\n if W[i] in L:\n ans = "No"\n if W[i][0] != W[i-1][-1]:\n ans = "No"\n L.append(W[i])\nprint(ans)\n', 'N = int(input())\nW = [input() for i in range(N)]\nS = set([W[0]])\nans = "Yes"\nfor i in range(1,N):\n if W[i] in S:\n ans = "No"\n if W[i][0] != W[i-1][-1]:\n ans = "No"\n S.add(W[i])\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s649349476', 's525696038'] | [3064.0, 3060.0] | [17.0, 17.0] | [191, 197] |
p03261 | u159335277 | 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\nwords = {}\nw = ''\nok = True\nfor i in range(n):\n nw = input()\n if nw in words:\n ok = False\n break\n words.add(w)\n if w && w[-1] != nw[0]:\n ok = False\n w = nw\n\nif ok:\n print('Yes')\nelse:\n print('No')\n", "n = int(input())\n\nwords = {}\nw = ''\nok = True\nfor i in range(n):\n nw = input()\n if nw in words:\n ok = False\n break\n words.add(w)\n if w && w[-1] != nw[0]:\n ok = False\n w = nw\n\nif ok:\n print('Yes')\nelse:\n print('No')", "n = int(input())\n\nwords = {}\nw = ''\nok = True\nfor i in range(n):\n nw = input()\n if nw in words:\n ok = False\n break\n words.add(w)\n if w and w[-1] != nw[0]:\n ok = False\n w = nw\n\nif ok:\n print('Yes')\nelse:\n print('No')\n", "n = int(input())\n\nwords = set()\nw = ''\nok = True\nfor i in range(n):\n nw = input()\n if nw in words:\n ok = False\n break\n words.add(w)\n if w and w[-1] != nw[0]:\n ok = False\n w = nw\n\nif ok:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s016666975', 's328070908', 's533612412', 's940164237'] | [2940.0, 2940.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0, 17.0] | [231, 230, 232, 234] |
p03261 | u166696759 | 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() for i in range(n)]\nb = []\nb.append(a[0])\nres = True\nfor i in range(1,n):\n if a[i-1][-1] != a[i][0]:\n res = False\n break\n if a[i] in b:\n res = False\n break\n b.append(a[i])\n\nif res:\n print('Yes')\nelse:\n print('NO')", "n = int(input())\na = [input() for i in range(n)]\nb = []\nb.append(a[0])\nres = True\nfor i in range(1,n):\n if a[i-1][-1] != a[i][0]:\n res = False\n break\n if a[i] in b:\n res = False\n break\n b.append(a[i])\n\nif res:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s384178820', 's275737192'] | [3064.0, 3064.0] | [22.0, 17.0] | [285, 285] |
p03261 | u167523937 | 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)]\nrule = 'No'\nfor x in range(1, N):\n if w[x-1][len(w[x-1])-1] == w[x][0]:\n rule = 'Yes'\n for y in range(x):\n if w[y]==w[x]:\n rule='No'\n break\nprint(rule)", "N=int(input())\nw=[input() for i in range(N)]\nrule = 'Yes'\nsame = False\nfor x in range(1, N):\n rule='Yes'\n same = False\n if w[x-1][len(w[x-1])-1] != w[x][0]:\n rule = 'No'\n break\n for y in range(x):\n if w[y]==w[x]:\n rule='No'\n same = True\n break\n if same:\n break\nprint(rule)"] | ['Wrong Answer', 'Accepted'] | ['s773833795', 's362727812'] | [3064.0, 3064.0] | [19.0, 19.0] | [238, 346] |
p03261 | u169138653 | 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 range(n)]\nd={}\nfor i in range(n):\n if w[i] not in d:\n d[w[i]]=1\n else:\n print('No')\n exit()\nfor i in range(n-1):\n if w[i][len(w[i])-1]!=w[i+1][0]:\n print('No')\n exit()\nprint('Yes')", "n=int(input())\nw=[input() for i in range(n)]\nd={}\nfor i in range(n):\n if w[i] not in d:\n d[w[i]]=1\n else:\n print('No')\n exit()\nfor i in range(n-1):\n if w[i][len(w[i])-1]!=w[i+1][0]:\n print('No')\n exit()\nprint('Yes')\n"] | ['Runtime Error', 'Accepted'] | ['s524841869', 's641488494'] | [2940.0, 3060.0] | [17.0, 17.0] | [230, 234] |
p03261 | u175034939 | 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())\naa = []\nfor i in range(n):\n a = input()\n aa.append(a)\nprint(aa)\n\nbb = []\nif len(set(aa)) != len(aa):\n print('No')\nelse:\n for i in range(n-1):\n if aa[i][-1] == aa[i+1][0]:\n bb.append(True)\n else:\n bb.append(False)\n if all(bb):\n print('Yes')\n else:\n print('No')", "n = int(input())\naa = []\nfor i in range(n):\n a = input()\n aa.append(a)\n\nbb = []\nif len(set(aa)) != len(aa):\n print('No')\nelse:\n for i in range(n-1):\n if aa[i][-1] == aa[i+1][0]:\n bb.append(True)\n else:\n bb.append(False)\n if all(bb):\n print('Yes')\n else:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s322498341', 's576129409'] | [3064.0, 3064.0] | [18.0, 17.0] | [344, 334] |
p03261 | u180656055 | 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())\nli=[]\nfor i in range(0,n):\n n=input()\n li.append(n)\nflag=0\nchck=1\ntemp=li[0]\nfor j in li:\n t=li.count(j)\n if(t>1):\n flag=1\n break\n if(chck!=1):\n p=len(temp)\n ch=temp[p-1]\n \n ch1=j[0]\n if(ch==ch1):\n flag=0\n temp=j\n else:\n flag=1\n break\n chck=chck+1\nif(flag==1):\n print('NO')\nelse:\n print('YES')", "n=int(input())\nli=[]\nfor i in range(0,n):\n n=input()\n li.append(n)\nflag=0\nchck=1\ntemp=li[0]\nfor j in li:\n t=li.count(j)\n if(t>1):\n flag=1\n break\n if(chck!=1):\n p=len(temp)\n ch=temp[p-1]\n \n ch1=j[0]\n if(ch==ch1):\n flag=0\n temp=j\n else:\n flag=1\n break\n chck=chck+1\nif(flag==1):\n print('No')\nelse:\n print('Yes')"] | ['Wrong Answer', 'Accepted'] | ['s920205285', 's545678748'] | [3064.0, 3064.0] | [18.0, 17.0] | [432, 432] |
p03261 | u183840468 | 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 range(n)]\n\nif len(l) != len(set(l)):\n print('No')\n\nflg = True\nfor i in range(len(l)-1):\n if l[i][-1] != l[i+1][0]:\n print('No')\n flg = False\n break\n\nif flg:\n print('Yes')\n", "n = int(input())\nl = [input() for _ in range(n)]\n\nflg = True\nif len(l) != len(set(l)):\n flg = False\n\n\nfor i in range(len(l)-1):\n if l[i][-1] != l[i+1][0]:\n flg = False\n break\n\nprint('Yes' if flg else 'No')\n"] | ['Wrong Answer', 'Accepted'] | ['s850391203', 's144427654'] | [3060.0, 2940.0] | [19.0, 17.0] | [240, 226] |
p03261 | u185037583 | 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=[int(x) for x in input().split()]\nans='Yes'\nfor i in range(1,n):\n if w[i-1][-1]!=w[i][0]:\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", "n=int(input())\nw=[input() for _ in range(n)]\nans='Yes'\nfor i in range(1,n):\n if w[i-1][-1]!=w[i][0]:\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'] | ['s585118387', 's739808619'] | [3060.0, 3060.0] | [18.0, 18.0] | [209, 203] |
p03261 | u186838327 | 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 = [str(input())]\nfor i in range(1, N):\n x = str(input())\n if x[0] != s[i-1][-1]:\n print('No')\n break\n s.append(x)\nif len(set(s)) == len(s):\n print('Yes')\nelse:\n print('No')", "n = int(input())\ns = set()\nfor i in range(n):\n w = str(input())\n if i == 0:\n p = w\n s.add(w)\n else:\n if w[0] != p[-1] or w in s:\n print('No')\n exit()\n else:\n p = w\n s.add(w)\nelse:\n print('Yes')"] | ['Wrong Answer', 'Accepted'] | ['s010112768', 's288887802'] | [3060.0, 3064.0] | [18.0, 18.0] | [216, 277] |
p03261 | u188244611 | 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. | ["# ABC 109, B - shiritori\n\nn = int(input())\nw = []\nfor i in range(n):\n w.append(input())\nprint(w)\n\n\nused = []\n\nfor i in range(n):\n print(i)\n if i == 0:\n used.append(w[i])\n tail = w[i][-1]\n else:\n # no if the same word is used\n if w[i] in used:\n print('No')\n break\n # no if the hean and tail is not equal\n elif w[i][0] != tail:\n print('No')\n break\n else:\n used.append(w[i])\n tail = w[i][-1]\nelse:\n print('Yes')\n", "# ABC 109, B - shiritori\n\nn = int(input())\nw = []\nfor i in range(n):\n w.append(input())\n\n\nused = []\n\nfor i in range(n):\n if i == 0:\n used.append(w[i])\n tail = w[i][-1]\n else:\n # no if the same word is used\n if w[i] in used:\n print('No')\n break\n # no if the hean and tail is not equal\n elif w[i][0] != tail:\n print('No')\n break\n else:\n used.append(w[i])\n tail = w[i][-1]\nelse:\n print('Yes')\n"] | ['Wrong Answer', 'Accepted'] | ['s898483638', 's824897443'] | [3064.0, 3064.0] | [17.0, 17.0] | [547, 525] |
p03261 | u189575640 | 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# N,M = [int(n) for n in input().split()]\n# S = str(input())\n# T = str(input())\n\nN = int(input())\nSS = [0]*N\ns = set()\nSS[0] = str(input())\nfor i in range(1,N):\n SS[i] = str(input())\n if(SS[i] in s):\n print('No')\n sys.exit()\n s.add(SS[i])\nfor i in range(1,N):\n if(SS[i-1][-1] != SS[i][0]):\n print('No')\n sys.exit()\nprint('Yes')\n", "import sys\n# N,M = [int(n) for n in input().split()]\n# S = str(input())\n# T = str(input())\n\nN = int(input())\nSS = [0]*N\ns = set()\nSS[0] = str(input())\ns.add(SS[0])\nfor i in range(1,N):\n SS[i] = str(input())\n if(SS[i] in s):\n print('No')\n sys.exit()\n s.add(SS[i])\nfor i in range(1,N):\n if(SS[i-1][-1] != SS[i][0]):\n print('No')\n sys.exit()\nprint('Yes')\n"] | ['Wrong Answer', 'Accepted'] | ['s806412476', 's455795068'] | [3064.0, 3064.0] | [18.0, 18.0] | [379, 392] |
p03261 | u190907730 | 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\ndef is_unique(seq):\n return len(seq) == len(set(seq))\n\nN = int(input())\nW = []\nfor i in range(N):\n w.append((input()))\nif is_unique(W):\n for i in range(N-1):\n if W[i][-1] != W[i+1][0]:\n print("No")\n sys.exit()\n print("Yes")\n\nelse:\n print("No")\n', 'import sys\ndef is_unique(seq):\n return len(seq) == len(set(seq))\n\nN = int(input())\nW = []\nfor i in range(N):\n W.append((input()))\nif is_unique(W):\n for i in range(N-1):\n if W[i][-1] != W[i+1][0]:\n print("No")\n sys.exit()\n print("Yes")\n\nelse:\n print("No")\n\n'] | ['Runtime Error', 'Accepted'] | ['s519958957', 's100123994'] | [3060.0, 3060.0] | [17.0, 17.0] | [299, 300] |
p03261 | u192541825 | 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()\nflag=True\nfor i in range(n):\n buf=""\n str=input()\n if buf!="" and str[0]!=buf[-1:]:\n flag=False\n if str in s:\n flag=False\n s.add(str)\n buf=str\n print(buf[-1:])\n\nif flag:\n print("Yes")\nelse:\n print("No")\n', 'n=int(input())\ns=set()\nflag=True\nbuf=""\nfor i in range(n):\n str=input()\n if buf!="" and str[0]!=buf[-1:]:\n flag=False\n if str in s:\n flag=False\n s.add(str)\n buf=str\n print(buf[-1:])\n\nif flag:\n print("Yes")\nelse:\n print("No")\n', 'n=int(input())\ns=set()\nflag=True\nbuf=""\nfor i in range(n):\n str=input()\n if buf!="" and str[0]!=buf[-1:]:\n flag=False\n if str in s:\n flag=False\n s.add(str)\n buf=str\n\nif flag:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s467461673', 's843993203', 's616405221'] | [3060.0, 3060.0, 3060.0] | [19.0, 19.0, 17.0] | [267, 263, 243] |
p03261 | u201234972 | 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. | ['4\nhoge\nenglish\nhoge\nenigma\n', "N = int(input())\nW = input()\nL = []\nL.append(W)\nlast = W[-1]\nans = 'Yes'\nfor _ in range(N-1):\n w = input()\n if w in L:\n ans = 'No'\n if last == w[0]:\n last = w[-1]\n L.append(w)\n else:\n ans = 'No'\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s703720120', 's272963690'] | [2940.0, 3064.0] | [17.0, 18.0] | [27, 245] |
p03261 | u203383537 | 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\na=[input() for i in range(n)]\n\nans=True\nif all(a.count(w) == 1 for w in a):\n for i in range(n-1):\n if a[i][-1]!=a[i+1][0]:\n ans=False\n \nif ans: \n print('Yes')\nelse:\n print('No')", "n=int(input())\n\na=[input() for i in range(n)]\n\nans=True\nif all(a.count(w) <2 for w in a):\n for i in range(n-1):\n if a[i][-1]!=a[i+1][0]:\n ans=False\nelse:\n ans=False\n \nif ans: \n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s273012369', 's206137009'] | [3060.0, 3064.0] | [18.0, 18.0] | [226, 245] |
p03261 | u212228253 | 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. | ["a = input()\n\ndef main():\n ed = []\n for i in range(int(a)-1):\n neww = input()\n print(i)\n if i != 0:\n if ed[i-1][-1] != neww[0] or neww in ed:\n return 'No'\n ed.append(neww)\n print(ed)\n\n return 'Yes'\n \n\nif __name__ == '__main__':\n print(main())\n\n", "a = input()\nb = input()\n\nwords = b.split()\n\nfor i in range(len(words)-1):\n w1 = words[i]\n w2 = words[i+1]\n\n if w1[-1] != w2[0]:\n return 'No'\n\nreturn 'Yes'\n\n", "a = input()\nb = input()\n\nwords = b.split('\\n')\nprint(words)\ndef main():\n ed = []\n for i in range(int(a)-2):\n w1 = words[i]\n ed.append(w1)\n w2 = words[i+1]\n print(ed)\n if w1[-1] != w2[0] or w1 in ed:\n return 'No'\n return 'Yes'\n\nif __name__ == '__main__':\n main()\n\n", "a = input()\n\ndef main():\n ed = []\n for i in range(int(a)):\n neww = input()\n if i != 0:\n if ed[i-1][-1] != neww[0] or neww in ed:\n return 'No'\n ed.append(neww)\n\n return 'Yes'\n \n\nif __name__ == '__main__':\n print(main())\n\n"] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s033467466', 's734816395', 's931007142', 's621856386'] | [3064.0, 2940.0, 3060.0, 2940.0] | [19.0, 17.0, 17.0, 18.0] | [331, 172, 321, 294] |
p03261 | u214547877 | 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())\ndic = dict()\nfor i in range(N):\n S = input()\n if S in dic:\n dic[S] += 1\n else:\n dic[S] = 1\n Start = S[0]\n if i != 0:\n if Start != End or dic[S] > 1:\n print("No")\n exit\n End = S[len(S)-1]\nprint("Yes")', 'N = int(input())\ndic = dict()\nfor i in range(N):\n S = input()\n if S in dic:\n dic[S] += 1\n else:\n dic[S] = 1\n Start = S[0]\n if i != 0:\n if Start != End or dic[S] > 1:\n print("No")\n exit()\n End = S[len(S)-1]\nprint("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s098646558', 's420727080'] | [9056.0, 9176.0] | [29.0, 26.0] | [278, 280] |
p03261 | u214617707 | 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())\nrec = []\nflag = True\nt = input()\npre = t[-1]\nfor i in range(1, n):\n s = input()\n if s in rec:\n flag = False\n elif s[0] != pre:\n flag = False\n else:\n rec.append(s)\n pre = s[-1]\n\nif flag:\n print("Yes")\nelse:\n print("No")\n', 'N = int(input())\ns = set()\npre = ""\nflag = True\nfor i in range(N):\n w = input()\n if len(s) == 0:\n pre = w[-1]\n s.add(w)\n continue\n else:\n if w[0] != pre:\n flag = False\n elif w in s:\n flag = False\n else:\n pre = w[-1]\n s.add(w)\n\nif flag:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s937107562', 's041621810'] | [3060.0, 3064.0] | [17.0, 17.0] | [282, 369] |
p03261 | u217627525 | 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. | ['3\nabc\narc\nagc', 'n=int(input())\nw_before=input()\nword=[w_before]\nans="Yes"\nfor i in range(1,n):\n w=input()\n if w[0]!=w_before[-1] or w in word:\n ans="No"\n break\n else:\n w_before=w\n word.append(w)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s578677970', 's944703548'] | [2940.0, 3060.0] | [17.0, 17.0] | [13, 227] |
p03261 | u227082700 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ['n,w=int(input()),[input()for i in range(n)]\ndef sortex(X):\n b=sorted(X)\n b.append("null")\n a=[]\n for i in range(len(X)):\n if b[i]!=b[i+1]:a.append(b[i])\n return a\nif len(w)!=len(sortex(w)):\n print("No")\n exit()\nfor i in range(len(w)-1):\n if w[i][-1]!=w[i+1][0]:\n print("No")\n exit()\nprint("Yes")', 'n=int(input())\nw=input()\ns={w}\nfor i in range(n-1):\n ww=input()\n if w[-1]!=ww[0] or ww in s:print("No");exit()\n w=ww\n s.add(w)\nprint("Yes")'] | ['Runtime Error', 'Accepted'] | ['s112650807', 's192982681'] | [3064.0, 3060.0] | [17.0, 17.0] | [312, 143] |
p03261 | u228294553 | 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())\nused=[]\nused.append(input())\nchain=used[0][-1]\nres="Yes"\nfor i in range(n-1):\n s=input()\n c=s[0]\n if s in used or chain!=c:\n res="No"\n break\n used.append(s)\n chain=s[-1]\n \n', 'n=int(input())\nused=[]\nused.append(input())\nchain=used[0][-1]\nres="Yes"\nfor i in range(n-1):\n print(used)\n s=input()\n c=s[0]\n print(chain)\n if s in used or chain!=c:\n res="No"\n break\n used.append(s)\n chain=s[-1]\n \n', 'n=int(input())\nused=[]\nused.append(input())\nchain=used[0][-1]\nres="Yes"\nfor i in range(n-1):\n s=input()\n c=s[0]\n if s in used or chain!=c:\n res="No"\n break\n used.append(s)\n chain=s[-1]\n \n\nprint(res)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s240904524', 's864522718', 's944447537'] | [2940.0, 3060.0, 3060.0] | [17.0, 18.0, 17.0] | [219, 252, 231] |
p03261 | u230531330 | 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())\nx=[]\nlast_char=''\nfirst_char=''\nx.append(input())\nlast_char=x[0][-1]\nprint(last_char)\nf_l_checker=True\n\nfor i in range(1,n):\n x.append(input())\n if f_l_checker==True:\n first_char=x[i][0]\n if first_char!=last_char:\n f_l_checker=False\n else:\n f_l_checker=True\n last_char=x[i][-1]\n \nset_x=set(x)\nif len(set_x)==n and f_l_checker==True:\n print('YES')\nelse:\n print('NO')", "n=int(input())\nx=[]\nf_l_checker=True\n\nfor i in range(n):\n x.append(input())\n if i==0:\n last_char=x[i][-1]\n elif i>0 and f_l_checker==True:\n first_char=x[i][0]\n if first_char==last_char:\n f_l_checker=True\n last_char=x[i][-1]\n else:\n f_l_checker=False\n \nset_x=set(x)\nif len(set_x)==len(x) and f_l_checker==True:\n print('YES')\nelse:\n print('NO')", "n=int(input())\nx=[]\nf_l_checker=True\n\nfor i in range(n):\n x.append(input())\n if i==0:\n for j in x:\n last_char=j[-1]\n break\n elif i>0 and f_l_checker==True:\n for j in range(len(x[i])-1):\n first_char=x[i][0]\n if first_char==last_char:\n last_char=x[i][len(x[i])-1]\n f_l_checker=True\n break\n else:\n f_l_checker=False\n break\n else:\n break\n \nset_x=set(x)\nif len(set_x)==len(x) and f_l_checker==True:\n print('YES')\nelse:\n print('NO')", "n=int(input())\nx=[]\nx.append(input())\nf_l_checker=True\n\nfor i in range(1,n):\n x.append(input())\n if f_l_checker:\n if x[i][0]==x[i-1][-1]:\n for j in range(i):\n if x[i]==x[j]:\n f_l_checker=False\n else:\n f_l_checker=False\nif f_l_checker:\n print('YES')\nelse:\n print('NO')", "n=int(input())\nx=[]\nx.append(input())\nf_l_checker=True\n\nfor i in range(1,n):\n x.append(input())\n if f_l_checker:\n if x[i][0]==x[i-1][-1]:\n for j in range(i):\n if x[i]==x[j]:\n f_l_checker=False\n else:\n f_l_checker=False\nif f_l_checker==True:\n print('YES')\nelse:\n print('NO')", "n=int(input())\nx=[]\nx.append(input())\nlast_char=x[0][-1]\nf_l_checker=True\n\nfor i in range(1,n):\n x.append(input())\n if f_l_checker:\n first_char=x[i][0]\n if first_char==last_char:\n f_l_checker=True\n last_char=x[i][-1]\n else:\n f_l_checker=False\n \nset_x=set(x)\nif len(set_x)==n and f_l_checker==True:\n print('YES')\nelse:\n print('NO')", "n=int(input())\nx=[]\nx.append(input())\nf_l_checker=True\n\nfor i in range(1,n):\n x.append(input())\n if f_l_checker:\n if x[i][0]==x[i-1][-1]:\n f_l_checker=True\n else:\n f_l_checker=False\n \nset_x=set(x)\nif len(set_x)==n and f_l_checker==True:\n print('YES')\nelse:\n print('NO')", "n=int(input())\nx=[]\nlast_char=''\nfirst_char=''\nf_l_checker=True\n\nfor i in range(n):\n x.append(input())\n if i==0:\n last_char=x[i][-1]\n elif i>0 and f_l_checker==True:\n first_char=x[i][0]\n if first_char==last_char:\n f_l_checker=True\n last_char=x[i][-1]\n else:\n f_l_checker=False\n \nset_x=set(x)\nif len(set_x)==len(x) and f_l_checker==True:\n print('YES')\nelse:\n print('NO')", "n=int(input())\nx=[]\nf_l_checker=True\n\nfor i in range(n):\n x.append(input())\n \n if i==0:\n for j in x:\n last_char=j[-1]\n break\n elif f_l_checker==True:\n for j in range(len(x[i])-1):\n first_char=x[i][0]\n if first_char==last_char:\n last_char=x[i][len(x[i])-1]\n f_l_checker=True\n break\n else:\n f_l_checker=False\n break\n else:\n break\n \nset_x=set(x)\nif len(set_x)==len(x) and f_l_checker==True:\n print('YES')\nelse:\n print('NO')", "n=int(input())\nx=[]\nx.append(input())\nlast_char=x[0][-1]\nf_l_checker=True\nfor i in range(1,n):\n x.append(input())\n if f_l_checker:\n first_char=x[i][0]\n if first_char==last_char:\n f_l_checker=True\n last_char=x[i][-1]\n else:\n f_l_checker=False\n \nset_x=set(x)\nif len(set_x)==n and f_l_checker==True:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s014352436', 's125790400', 's335981518', 's407634512', 's429339014', 's586144221', 's601484021', 's602572119', 's979246107', 's258643730'] | [3064.0, 3064.0, 3064.0, 3060.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [17.0, 18.0, 17.0, 18.0, 18.0, 17.0, 17.0, 17.0, 17.0, 17.0] | [457, 421, 598, 349, 355, 407, 328, 448, 595, 406] |
p03261 | u234189749 | 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())\na = 'Yes'\n\ns = W[0]\n\nfor i in range(N-1):\n k = input()\n if s[-1]==k[0] and k not in W:\n W.append(k)\n s = W[-1]\n else:\n a = 'No'\n for j in range(N-i):\n k = input()\n break\n\n\nprint(a)", "N = int(input())\nW =[ input()]\na = 'Yes'\n\nfor i in range(1,N):\n k = input()\n W.append(k)\n if W[-2][-1]!=k[0] or len(set(W))!=(i+1):\n a = 'No'\n break\n\nprint(a)"] | ['Runtime Error', 'Accepted'] | ['s255033679', 's576581288'] | [3060.0, 3060.0] | [17.0, 18.0] | [270, 181] |
p03261 | u236042710 | 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 elt in range(n)]\nx =0\nfor elt in range(len(l)):\n if l.count(l[elt]) > 1 :\n\n x=1\n break\nfor elt in range (len(l )-1):\n if l[elt][-1] != l[elt+1][0]:\n\n x = 1\n break\nif x == 0:\n print("YES")\nelse:\n print("NO")\n\n', 'n = int(input())\nl= [input() for elt in range(n)]\nx =0\nfor elt in range(len(l)):\n if l.count(l[elt]) != 1 :\n\n x=1\n break\nfor elt in range (len(l )-1):\n if l[elt][-1] != l[elt+1][0]:\n\n x = 1\n break\nif x == 0:\n print("YES")\nelse:\n print("NO")\n', 'n = int(input())\nl= []\nx = 0\nfor elt in range(n):\n inp = input()\n l.append(inp)\nfor elt in range(len(l)):\n if l.count(l[elt]) > 1 :\n print("NO")\n x+=1\n break\n\n else:\n if elt < len(l)-1:\n if l[elt][-1] != l[elt+1][0]:\n print("NO")\n x += 1\n break\nif x == 0:\n print("YES")\n\n\n\n', 'n = int(input())\nl= []\nx = 0\nfor elt in range(n):\n inp = input()\n l.append(inp)\nfor elt in range(len(l)):\n if l.count(l[elt]) > 1 :\n print("No")\n x+=1\n break\n\n else:\n if elt < len(l)-1:\n if l[elt][-1] != l[elt+1][0]:\n print("No")\n x += 1\n break\nif x == 0:\n print("Yes")\n\n\n\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s096408206', 's295586363', 's940910922', 's650690868'] | [3060.0, 3060.0, 3060.0, 3060.0] | [17.0, 18.0, 17.0, 18.0] | [281, 281, 372, 372] |
p03261 | u239316561 | 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 = []\ncount = 0\n\nfor i in range(n):\n w.append(input())\n\nfor i in range(n):\n if len(w) >= 2:\n print(w[count-1][-1] , w[count][0])\n if w[count-1][-1] != w[count][0]:\n print('No')\n exit()\n\n for j in range(count-1):\n if w[count] == w[j]:\n print('No')\n exit()\n count += 1\n\nprint('Yes')", "n = int(input())\nw = []\ncount = 0\n\nfor i in range(n):\n w.append(input())\n\nfor i in range(n):\n if i >= 2:\n if w[i-1][-1] != w[i][0]:\n print(w[i-1][-1] , w[i][0])\n print('No')\n exit()\n\n for j in range(i-1):\n if w[i] == w[j]:\n print('hre')\n print('No')\n exit()\n\nprint('Yes')", "n = int(input())\nw = []\ncount = 0\n\nfor i in range(n):\n w.append(input())\n\nfor i in range(n):\n if i >= 1:\n if w[i-1][-1] != w[i][0]:\n print('No')\n exit()\n\n for j in range(i-1):\n if w[i] == w[j]:\n print('No')\n exit()\n\nprint('Yes')"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s327459273', 's750098893', 's664214062'] | [3064.0, 3064.0, 3060.0] | [18.0, 18.0, 18.0] | [391, 380, 311] |
p03261 | u240630407 | 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())\nary = []\ns = 'Yes'\nfor i in range(N):\n w = input()\n if w in ary:\n s = 'No'\n break\n if len(ary) > 0 and w[0] != ary[-1][-1]:\n s = 'No'\n break\n \nprint(s)", "N = int(input())\nary = []\ns = 'Yes'\nfor i in range(N):\n w = input()\n if w in ary:\n s = 'No'\n break\n if len(ary) > 0 and w[0] != ary[-1][-1]:\n s = 'No'\n break\n ary.append(w)\n \nprint(s)"] | ['Wrong Answer', 'Accepted'] | ['s590219054', 's760070326'] | [2940.0, 3064.0] | [17.0, 18.0] | [186, 202] |
p03261 | u246392883 | 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 -*-\n\nn = input()\nn = int(n)\n\nw = []\nfor i in range(n):\n _w = input()\n w.append(_w)\nans = "YES"\nfor i in range(0,len(w)-1):\n for j in range(i+1,len(w)):\n if w[i] == w[j]:\n ans = "NO"\nfor i in range(0,len(w)-1):\n if w[i][-1] != w[i+1][0] :\n ans ="NO"\n\nprint(ans)', '9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly', '# -*- coding:utf-8 -*-\n\nn = input()\nn = int(n)\n\nw = []\nfor i in range(n):\n _w = input()\n w.append(_w)\nans = "YES"\nfor i in range(0,len(w)-1):\n for j in range(i+1,len(w)):\n if w[i] == w[j]:\n ans = "NO"\nfor i in range(0,len(w)-1):\n if w[i][-1] != w[i+1][0] :\n ans ="NO"\n\nprint(ans)', '# -*- coding:utf-8 -*-\n\nn = input()\nn = int(n)\n\nw = []\nfor i in range(n):\n _w = input()\n w.append(_w)\nans = "Yes"\nfor i in range(0,len(w)-1):\n for j in range(i+1,len(w)):\n if w[i] == w[j]:\n ans = "No"\nfor i in range(0,len(w)-1):\n if w[i][-1] != w[i+1][0] :\n ans ="No"\n\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s117258851', 's134624893', 's949927188', 's668756043'] | [3064.0, 2940.0, 3064.0, 3064.0] | [18.0, 17.0, 18.0, 18.0] | [316, 52, 316, 316] |
p03261 | u254871849 | 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# created: 2019-11-10 12:28:14(JST)\nimport sys\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n# import itertools\n# from functools import reduce\n# import operator as op\n# from scipy.misc import comb # float\n# import numpy as np \n\ndef main():\n n, *w = sys.stdin.read().split()\n n = int(n)\n for i in range(1, n):\n if w[i][0] == w[i-1][-1] and not w[i] in w[:i]:\n continue\n else:\n sys.exit(\'No\')\n \n print(\'Yes\')\n\n\nif __name__ == "__main__":\n # execute only if run as a script\n main()\n', "import sys\n\nn, *words = sys.stdin.read().split()\nn = int(n)\n\ndef main():\n announced = set()\n last = words[0][0]\n for w in words:\n if w in announced:\n return 'No'\n elif w[0] != last:\n return 'No'\n announced.add(w)\n last = w[-1]\n return 'Yes'\n\nif __name__ == '__main__':\n ans = main()\n print(ans)"] | ['Runtime Error', 'Accepted'] | ['s000817454', 's255333946'] | [2940.0, 3060.0] | [17.0, 17.0] | [719, 362] |
p03261 | u270681687 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ['n = int(input())\nw = [input() for i in range(n)]\n\ns = set(w[0])\nword = w[0][-1]\n\nfor i in range(1, n):\n if w[i] in s:\n print("No")\n exit()\n if w[i][0] != word:\n print("No")\n exit()\n s.add(w[i])\n word = w[i][-1]\n\nprint("Yes")', 'n = int(input())\nw = [input() for i in range(n)]\n\ns = set([])\ns.add(w[0])\nword = w[0][-1]\n\nfor i in range(1, n):\n if w[i] in s:\n print("No")\n exit()\n if w[i][0] != word:\n print("No")\n exit()\n s.add(w[i])\n word = w[i][-1]\n\nprint("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s741840284', 's841290642'] | [3064.0, 3064.0] | [17.0, 17.0] | [264, 274] |
p03261 | u272557899 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ['N = input()\nw = []\nfor i in range(N):\n w.append(input())\n# [a1, a2, a3, ..., aN]\np = 0\nfor i in range(N):\n for j in range(i+1,N):\n if w[i] == w[j]:\n p = 1\n break\n \nv = []\nfor j in range(N):\n v[j] = list(w[j])\n\nfor k in range(N):\n if k != 0:\n if v[k - 1][len(v[k - 1]) - 1] != v[k][0]:\n p = 1\n break\n\nif p == 0:\n print("Yes")\nelse:\n print("No")\n', 'N = input()\nw = []\nfor i in range(N):\n w.append(input())\n# [a1, a2, a3, ..., aN]\np = 0\nfor i in range(N):\n for j in range(i+1,N):\n if w[i] == w[j]:\n p = 1\n break\n \nv = []\nfor j in range(N):\n v[j] = list(w[j])\n\nfor k in range(N):\n if k != 0:\n if v[k - 1][len(v[k - 1]) - 1] != v[k][0]:\n p = 1\n break\n\nif p = 0:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nw = []\nfor i in range(N):\n w.append(input())\n# [a1, a2, a3, ..., aN]\np = 0\nfor i in range(N):\n for j in range(i+1,N):\n if w[i] == w[j]:\n p = 1\n break\nv = []\n \nfor i in range(N):\n v.append([])\n\nfor j in range(N):\n for s in list(w[j]):\n v[j].append(s)\n\nfor k in range(N):\n if k != 0:\n if v[k - 1][len(v[k - 1]) - 1] != v[k][0]:\n p = 1\n break\n\nif p == 0:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s282098944', 's749352318', 's630308917'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 19.0] | [381, 379, 442] |
p03261 | u276204978 | 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\na = []\npre = W[0]\nflag = False\nfor wi in W[1:]:\n if wi in a or pre[-1] != wi[0]:\n flag = True\n break\n pre = wi\n a.append(wi)\n \nif flag:\n print('No')\nelse:\n print('Yes')", "N = int(input())\nW = [input() for _ in range(N)]\n\na = []\npre = W[0]\na.append(pre)\nflag = False\nfor wi in W[1:]:\n if wi in a or pre[-1] != wi[0]:\n flag = True\n break\n pre = wi\n a.append(wi)\n \nif flag:\n print('No')\nelse:\n print('Yes')"] | ['Wrong Answer', 'Accepted'] | ['s481354605', 's795870947'] | [3064.0, 3064.0] | [17.0, 17.0] | [254, 268] |
p03261 | u278622837 | 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 = []\ne = ["_"]\nans = "Yes"\nfor i in range(n):\n w = input()\n if w[-1] in e or w in l : ans = "No" \n l.append(i)\n e[0] = w[-1]\nprint(ans)', 'n = int(input())\nl = []\ne = "abcdefghijklmnopqrstuvwxyz"\nans = "Yes"\nfor i in range(n):\n w = input()\n if w[0] not in e or w in l : ans = "No" \n l.append(w)\n e = w[-1]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s431333767', 's710660641'] | [3060.0, 2940.0] | [18.0, 18.0] | [158, 181] |
p03261 | u279493135 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ['from colecctions import defaultdict\n\nN = int(input())\nW = [input().strip() for _ in range(N)]\n\ndic = defaultdict(int)\n\nfor i in range(N):\n if i == 0:\n tmp = W[i][-1]\n dic[W[i]] = 1\n else:\n if tmp != W[i][0] or dic[W[i]]:\n print("No")\n break\n else:\n tmp = W[i][-1]\nelse:\n print("Yes")\n ', 'from collections import defaultdict\n \nN = int(input())\nW = [input().strip() for _ in range(N)]\n \ndic = defaultdict(int)\n \nfor i in range(N):\n if i == 0:\n tmp = W[i][-1]\n dic[W[i]] += 1\n else:\n if tmp != W[i][0] or dic[W[i]]:\n print("No")\n break\n else:\n dic[W[i]] += 1\n tmp = W[i][-1]\nelse:\n print("Yes")'] | ['Runtime Error', 'Accepted'] | ['s608757486', 's557303707'] | [3060.0, 3316.0] | [17.0, 21.0] | [318, 338] |
p03261 | u280016524 | 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())\ncount = 0\nlistA=[]\nwhile (count <= N-1):\n try:\n listA.append(str(input()))\n count+=1\n except:\n break;\nprint(set(listA))\nprint(listA)\nif(len(listA) != len(set(listA))):\n print("No")\nelse:\n for i in range(N-1):\n if(listA[i][-1]!=listA[i+1][0]):\n print("No")\n break\n if(i==N-2):\n print("Yes")', 'N=int(input())\ncount = 0\nlistA=[]\nwhile (count <= N-1):\n try:\n listA.append(str(input()))\n count+=1\n except:\n break;\nprint(set(listA))\nprint(listA)\nif(listA != set(listA)):\n print("No")\nelse:\n for i in range(N-1):\n if(listA[i][-1]!=listA[i+1][0]):\n print("No")\n break\n if(i==N-2):\n print("Yes")', 'N=int(input())\ncount = 0\nlistA=[]\nwhile (count <= N-1):\n try:\n listA.append(str(input()))\n count+=1\n except:\n break;\nif(len(listA) != len(set(listA))):\n print("No")\nelse:\n for i in range(N-1):\n if(listA[i][-1]!=listA[i+1][0]):\n print("No")\n break\n if(i==N-2):\n print("Yes")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s180623627', 's436810391', 's791591605'] | [3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0] | [384, 374, 353] |
p03261 | u292814514 | 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=[]\nword=input()\nlist.append(word)\nkey=word[-1]\nflag=True\nfor i in range(1,n):\n word=input()\n if key==word[0] and (word not in list):\n list.append(word)\n key=word[-1]\n else:\n print("No")\n flag=False\nif flag:\n print("Yes")', '\nn=int(input())\nlist=[]\nword=input()\nlist+=word\nkey=word[-1]\nfor i in range(1,n):\n word=input()\n if key==word[0] and (word not in list):\n list+=word\n key=word[-1]\n else:\n print("No")\nprint("Yes")\n', '\nn=int(input())\nlist=[]\nword=input()\nlist+=word\nkey=word[-1]\nfor i in range(1,n):\n word=input()\n if key==word[0] and word in list:\n list+=word\n key=word[-1]\n else:\n print("No")\nprint("Yes")\n', '\nn=input()\nword=input()\nkey=word[-1]\nfor i in range(1,n):\n word=input()\n if key==word[0]:\n key=word[-1]\n else:\n print("No")\nprint("Yes")\n', '\nn=int(input())\nlist=[]\nword=input()\nlist.append(list,word)\nkey=word[-1]\nfor i in range(1,n):\n word=input()\n if key==word[0] and (word not in list):\n list.append(list,word)\n key=word[-1]\n else:\n print("No")\nprint("Yes")\n\n', 'n=int(input())\nword=input()\nkey=word[-1]\nfor i in range(1,n):\n word=input()\n if key==word[0]:\n key=word[-1]\n else:\n print("No")\nprint("Yes")', '\nn=int(input())\nlist=[]\nword=input()\nlist.append(word)\nkey=word[-1]\nfor i in range(1,n):\n word=input()\n if key==word[0] and (word not in list):\n list.append(word)\n key=word[-1]\n else:\n print("No")\nprint("Yes")', '\nn=int(input())\nlist=[]\nword=input()\nlist+=word\nkey=word[-1]\nfor i in range(1,n):\n word=input()\n if key==word[0] and word not in list:\n list+=word\n key=word[-1]\n else:\n print("No")\nprint("Yes")\n', 'n=int(input())\nlist=[]\nword=input()\nlist.append(word)\nkey=word[-1]\nflag=True\nfor i in range(1,n):\n word=input()\n if key==word[0] and (word not in list):\n list.append(word)\n key=word[-1]\n else:\n print("No")\n flag=False\n break\nif flag:\n print("Yes")'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s104206031', 's234932059', 's494092552', 's569909080', 's583064683', 's665459964', 's847672553', 's892454729', 's745471086'] | [3064.0, 3060.0, 3060.0, 2940.0, 3060.0, 2940.0, 3060.0, 3060.0, 3064.0] | [18.0, 17.0, 18.0, 17.0, 17.0, 18.0, 18.0, 17.0, 17.0] | [280, 226, 220, 160, 251, 163, 239, 224, 294] |
p03261 | u295811595 | 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=input()\n W.append(w)\n last=W[0][-1]\n S=set()\n S.add(w[0])\nfor i in range(1,N):\n if W[i][0]==last and not W[i] in S:\n pass\n else:\n print("No")\n exit()\n S.add(W[i])\n last=W[i][-1] \nprint("Yes")', 'N=int(input())\nW=[]\nfor i in range(N):\n w=input()\n W.append(w)\n last=W[0][-1]\nS=set()\nS.add(w[0])\nfor i in range(1,N):\n if W[i][0]==last and not W[i] in S:\n pass\n else:\n print("No")\n exit()\n S.add(W[i])\n last=W[i][-1] \nprint("Yes")', 'N=int(input())\nW=[]\nS=set()\nfor i in range(N):\n w=input()\n W.append(w)\nlast=W[0][-1]\nS.add(w[0])\nfor i in range(1,N):\n if W[i][0]==last and not W[i] in S:\n pass\n else:\n print("No")\n exit()\n S.add(W[i])\n last=W[i][-1] \nprint("Yes")', 'N=int(input())\nW=[]\nfor i in range(N):\n w=input()\n W.append(w)\nlast=W[0][-1]\nS=set()\nS.add(w[0])\nfor i in range(1,N):\n if W[i][0]==last and not W[i] in S:\n pass\n else:\n print("No")\n exit()\n S.add(W[i])\n last=W[i][-1] \nprint("Yes")', 'N=int(input())\nW=[]\nfor i in range(N):\n w=input()\n W.append(w)\nlast=W[0][-1]\nS=set()\nS.add(w[0])\nfor i in range(1,N):\n if W[i][0]==last and not W[i] in S:\n pass\n else:\n print("No")\n exit()\n S.add(W[i])\n last=W[i][-1]\nprint("Yes")', 'N=int(input())\nW=[]\nfor i in range(N):\n w=input()\n W.append(w)\nlast=W[0][-1]\nS=set()\nS.add(W[0])\nfor i in range(1,N):\n if W[i][0]==last and not W[i] in S:\n pass\n else:\n print("No")\n exit()\n S.add(W[i])\n last=W[i][-1]\nprint("Yes")'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s062296997', 's381448732', 's541630817', 's791590462', 's862687213', 's204902060'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 17.0, 19.0, 18.0, 18.0, 17.0] | [300, 292, 288, 288, 268, 268] |
p03261 | u299730702 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ["N = int(input())\nW = [input() for i in range(N)]\n\nf = True\nfor i in range(len(W)-1):\n if W[i][-1] != W[i+1][0]:\n f = False\n break\n\nprint(f)\n\nif f and N==len(set(W)):\n print('Yes')\nelse:\n print('No')\n", "N = int(input())\nW = [input() for i in range(N)]\n\nf = True\nfor i in range(len(W)-1):\n if W[i][-1] != W[i+1][0]:\n f = False\n break\n\nif f and N==len(set(W)):\n print('Yes')\nelse:\n print('No')\n"] | ['Wrong Answer', 'Accepted'] | ['s189840141', 's949744142'] | [3060.0, 2940.0] | [17.0, 17.0] | [222, 212] |
p03261 | u305965165 | 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 = [int(input()) for i in range(n)] \n\nused = [a[0]]\npre = a[0]\nfor i in a[1:]:\n if i not in used and pre[-1] == i[0]:\n used.append(i)\n pre = i\n else:\n print("No")\n exit()\n\nprint("Yes")', 'n = int(input()) \na = [input() for i in range(n)] \n\nused = [a[0]]\npre = a[0]\nfor i in a[1:]:\n if i not in used and pre[-1] == i[0]:\n used.append(i)\n pre = i\n else:\n print("No")\n exit()\n\nprint("Yes")'] | ['Runtime Error', 'Accepted'] | ['s906327016', 's429255634'] | [3064.0, 3060.0] | [18.0, 18.0] | [237, 232] |
p03261 | u318427318 | 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\ninput=sys.stdin.readline\n\ndef main():\n words=[]\n n = int(input())\n words=[input().rstrip() for _ in range(n)]\n print(words)\n\n if len(set(words))!=n:\n print("No")\n exit()\n\n endstring=""\n for word in words:\n if len(endstring)==0:\n endstring=word[-1]\n else:\n if endstring==word[0]:\n endstring=word[-1]\n else:\n print("No")\n exit()\n print("Yes")\n\n\nif __name__=="__main__":\n main()', '#-*-coding:utf-8-*-\nimport sys\ninput=sys.stdin.readline\n\ndef main():\n words=[]\n n = int(input())\n words=[input().rstrip() for _ in range(n)]\n\n if len(set(words))!=n:\n print("No")\n exit()\n\n endstring=""\n for word in words:\n if len(endstring)==0:\n endstring=word[-1]\n else:\n if endstring==word[0]:\n endstring=word[-1]\n else:\n print("No")\n exit()\n print("Yes")\n\n\nif __name__=="__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s374671119', 's047993144'] | [9100.0, 9188.0] | [27.0, 30.0] | [539, 522] |
p03261 | u327466606 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ["from itertools import tee\nN = int(input())\nw0, w1 = tee((int(input()) for _ in range(N)), 2)\nnext(w1)\nfor a,b in zip(w0,w1):\n if a[-1] != b[0]:\n print('No')\n break\nelse:\n print('Yes')", "from itertools import tee\nN = int(input())\nw0, w1 = tee((input() for _ in range(N)), 2)\n\nwords = {next(w1)}\nflag = 'Yes'\nfor a,b in zip(w0,w1):\n if a[-1] != b[0] or b in words:\n flag = 'No'\n words.add(b)\n\nprint(flag)"] | ['Runtime Error', 'Accepted'] | ['s267889656', 's587882727'] | [3060.0, 3060.0] | [19.0, 17.0] | [191, 221] |
p03261 | u328510800 | 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())\nm = dict()\n\nprev = input()\nm[prev] = True\nflg = True\n\nfor _ in range(N - 1):\n s = input()\n flg = all(flg, s not in m, prev[len(prev) - 1] == s[0])\n m[s] = True\n prev = s\n\nprint("Yes" if flg else "No")', 'N = int(input())\nm = dict()\n\nprev = input()\nm[prev] = True\nflg = True\n\nfor _ in range(N - 1):\n s = input()\n flg = all([flg, s not in m, prev[len(prev) - 1] == s[0]])\n m[s] = True\n prev = s\n\nprint("Yes" if flg else "No")'] | ['Runtime Error', 'Accepted'] | ['s570421369', 's336313238'] | [9124.0, 9120.0] | [29.0, 29.0] | [221, 223] |
p03261 | u329058683 | 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. | ['L=[]\nfor i in range(N):\n L.append(input())\nif not len(L)==len(set(L)):\n print("NO")\nn=0\nwhile n<=N:\n if n==N-1:\n print("Yes")\n break\n elif L[n][-1]==L[n+1][0]:\n n=n+1\n else:\n print("NO")\n break', 'N=int(input())\nL=[]\nfor i in range(N):\n L.append(input())\nif not len(L)==len(set(L)):\n print("NO")\nn=0\nwhile n<=N:\n if n==N-1:\n print("Yes")\n break\n elif L[n][-1]==L[n+1][0]:\n n=n+1\n else:\n print("NO")\n break', 'N=int(input())\nL=[]\nfor i in range(N):\n L.append(input())\nif not len(L)==len(set(L)):\n print("NO")\nn=0\nwhile n<=N:\n if n==N-1:\n print("Yes")\n break\n elif L[n][-1]==L[n+1][0]:\n n=n+1\n else:\n print("NO")\n break', 'N=int(input())\nL=[]\nfor i in range(N):\n L.append(input())\nif not len(set(L))==len(L):\n print("No")\nelse:\n for n in range(N):\n if n==(N-1):\n print("Yes")\n elif L[n][-1] == L[n+1][0]:\n continue\n else:\n print("No")\n break'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s104762659', 's172576385', 's381239098', 's181689592'] | [3060.0, 3064.0, 3064.0, 3060.0] | [17.0, 17.0, 17.0, 17.0] | [213, 228, 228, 250] |
p03261 | u332906195 | 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\nWs = set([W[0]])\nfor i in range(1, N):\n if not W[i - 1][-1] == W[i][0] or W[i] in Ws:\n print("No", W[i])\n exit()\n else:\n Ws.add(W[i])\n\nprint("Yes")\n', 'N = int(input())\n\nW, OK = ["-"], True\nfor i in range(N):\n W.append(input())\n if W[-1] in W[:-1] or (W[-2][-1] != W[-1][0] and W[-2] != "-"):\n OK = False\n\nprint("Yes" if OK else "No")\n'] | ['Wrong Answer', 'Accepted'] | ['s395252397', 's337310699'] | [3060.0, 2940.0] | [19.0, 18.0] | [225, 196] |
p03261 | u333629593 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ['n=int(input())\ns=[]\nfla=True\ns.append(input())\nfor i in range(1,n):\n s.append(input())\n if fla :\n if s[i][0]==s[i-1][len(s[i-1])-1]:\n for j in range(i):\n if s[j]==s[i]:\n fla=False\n else:\n fla=False\nif fla:\n print("YES")\nelse :\n print("NO")', 'n=int(input())\ns=[]\nfla=True\ns.append(input())\nfor i in range(1,n):\n s.append(input())\n if fla :\n if s[i][0]==s[i-1][len(s[i-1])-1]:\n for j in range(i):\n if s[j]==s[i]:\n fla=False\n else:\n fla=False\nif fla:\n print("Yes")\nelse :\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s995240152', 's162111330'] | [3064.0, 3064.0] | [18.0, 18.0] | [321, 321] |
p03261 | u339523379 | 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\nwords=[input() for _ in range(N)]\n\ntmp=set(words)\nprint(tmp)\nc=1\nif len(words)!=len(tmp):\n c=0\nelse:\n for i in range(N):\n print(words)\n if i==0:\n continue\n elif words[i][0]!=words[i-1][-1]:\n c=0\n break\n\n\nprint(c)\nif c:\n print("Yes")\nelse:\n print("No")', 'N=int(input())\n\nwords=[input() for _ in range(N)]\n\ntmp=set(words)\n#print(tmp)\nc=1\nif len(words)!=len(tmp):\n c=0\nelse:\n for i in range(N):\n# print(words)\n if i==0:\n continue\n elif words[i][0]!=words[i-1][-1]:\n c=0\n break\n\n\n#print(c)\nif c:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s237318386', 's566124357'] | [3188.0, 3060.0] | [19.0, 17.0] | [333, 336] |
p03261 | u339550873 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ["#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN = int(input())\nwls =[]\nfor i in range(N):\n wls.append(input())\ncount =0\nif len(wls) != len(set(wls)):\n print('No')\nelse:\n for i in range(N):\n if i == 0:\n continue\n else:\n if wls[i][0] != wls[i-1][-1]:\n count += 1\n \nif count == 0:\n print('Yes')\nelse:\n print('No')\n \n\n\n\n", "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN = int(input())\nwls =[]\nfor i in range(N):\n wls.append(input())\ncount =0\nif count(wls) != count(set(wls):\n print('No')\nelse:\n for i in range(N):\n if i == 0:\n continue\n else:\n if wls[i][0] != wls[i-1][-1]:\n count += 1\n \nif count == 0:\n print('Yes')\nelse:\n print('No')\n \n\n\n\n", "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\nN = int(input())\nwls =[]\nfor i in range(N):\n wls.append(input())\ncount =0\nif len(wls) != len(set(wls)):\n print('No')\nelse:\n for i in range(N):\n if i == 0:\n continue\n else:\n if wls[i][0] != wls[i-1][-1]:\n count += 1\n \n if count == 0:\n print('Yes')\n else:\n print('No')\n \n\n\n\n"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s333181289', 's559534250', 's132764713'] | [3064.0, 2940.0, 3060.0] | [19.0, 17.0, 18.0] | [402, 405, 418] |
p03261 | u343671593 | 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. | ['words = []\nfor inp in range(N):\n\twords.append(input())\n\nfrst = words[0]\nfor i in range(1,len(words)):\n\tif words[i-1][-1] != words[i][0]:\n\t\tprint("No")\n\t\tbreak\n\telse:\n\t\tflag = 0\n\t\tif words[i] in words[:i-1]:\n\t\t\tprint("No")\n\t\t\tbreak\n\t\telse:\n\t\t\tflag = 1\nif flag == 1:\n\tprint("Yes") ', 'N = int(input())\nwords = []\nfor inp in range(N):\n\twords.append(input())\n\nfrst = words[0]\nwrds = set(words)\nif len(wrds) != len(words):\n\tprint("No")\nelse:\t\n\tfor i in range(1,len(words)):\n\t\tflag = 1\n\t\tif words[i-1][-1] != words[i][0]:\n\t\t\tprint("No")\n\t\t\tflag = 0\n\t\t\tbreak\n\tif flag == 1:\n\t\tprint("Yes") \n'] | ['Runtime Error', 'Accepted'] | ['s797395351', 's997091556'] | [3060.0, 3060.0] | [17.0, 17.0] | [280, 301] |
p03261 | u344462910 | 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\nstring_list=[input() for i in range(N)]\ni = 0\nstring_list2 = list(set(string_list))\nif(len(string_list2)==N):\n check = 1\nelse:\n check = 0\n\nwhile(i < N-1):\n string1 = string_list[i]\n string2 = string_list[i+1]\n print(string1)\n print(string2)\n str1 = string1[-1]\n str2 = string2[0]\n if(str1 != str2):\n check = 0\n i +=1\n\nif(check ==1):\n print("Yes")\nelse:\n print("No")', 'N = int(input())\n\nstring_list=[input() for i in range(N)]\ni = 0\nstring_list2 = list(set(string_list))\nif(len(string_list2)==N):\n check = 1\nelse:\n check = 0\n\nwhile(i < N-1):\n string1 = string_list[i]\n string2 = string_list[i+1]\n str1 = string1[-1]\n str2 = string2[0]\n if(str1 != str2):\n check = 0\n i +=1\n\nif(check ==1):\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s753529129', 's904367307'] | [3064.0, 3064.0] | [17.0, 17.0] | [427, 389] |
p03261 | u345778634 | 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 A = [input()]\n for i in range(1, N):\n W = input()\n if A[-1][-1] == W[0]:\n for j in range(i-1):\n if A[j] == W:\n print("No:重複")\n return\n A.append(W)\n else:\n print(A, "No:違う")\n return\n print("Yes")\n\nmain()', 'def main():\n N = int(input())\n A = [input()]\n for i in range(1, N):\n W = input()\n if A[-1][-1] == W[0]:\n for j in range(i):\n if A[j] == W:\n print("No")\n return\n A.append(W)\n else:\n print("No")\n return\n print("Yes")\n\nmain()'] | ['Wrong Answer', 'Accepted'] | ['s689899715', 's796283162'] | [3060.0, 2940.0] | [18.0, 18.0] | [371, 352] |
p03261 | u346028292 | 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)]\n\natama=[]\noshiri=[]\n\nfor i in s:\n atama.append(i[0])\n oshiri.append(i[-1])\n\n\n\noshiri=oshiri[-1:]+oshiri[:-1]\n\natama.pop(0)\noshiri.pop(0)\n\nif oshiri==atama:\n print("Yes")\nelse:\n print("No")', 'N=int(input())\ns = [input() for i in range(N)]\n\natama=[]\noshiri=[]\n\ndef is_unique(seq):\n return len(seq) == len(set(seq))\n\n\n\nfor i in s:\n atama.append(i[0])\n oshiri.append(i[-1])\n\n\n\noshiri=oshiri[-1:]+oshiri[:-1]\n\natama.pop(0)\noshiri.pop(0)\n\nif oshiri==atama and is_unique(s)==True:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s968354850', 's149264571'] | [3064.0, 3064.0] | [17.0, 17.0] | [247, 331] |
p03261 | u346194435 | 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\ncache = []\nabc = ''\nngflag = False\nfor i in range(N):\n word = input()\n if abc != '':\n if word[0] != abc:\n print(word)\n ngflag = True\n if word in cache:\n print(word)\n ngflag = True\n abc = word[-1]\n cache.append(word)\n\nif ngflag:\n print('No')\nelse:\n print('Yes')", "N = int(input())\n\ncache = []\nabc = ''\nngflag = False\nfor i in range(N):\n word = input()\n if abc != '':\n if word[0] != abc:\n print(word)\n ngflag = True\n if word in cache:\n print(word)\n ngflag = True\n abc = word[-1]\n cache.append(word)\n\nif ngflag:\n print('No')\nelse:\n print('Yes')", "N = int(input())\n\ncache = []\nabc = ''\nngflag = False\nfor i in range(N):\n word = input()\n if abc == '':\n pass\n elif word[0] != abc:\n ngflag = True\n\n if word in cache:\n ngflag = True\n abc = word[-1]\n cache.append(word)\n\nif ngflag:\n print('No')\nelse:\n print('Yes')"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s490678688', 's972794282', 's532101926'] | [3064.0, 3060.0, 3060.0] | [26.0, 18.0, 18.0] | [342, 342, 306] |
p03261 | u353919145 | 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=[]\na.append(input())\nl=1\nfor i in range(n-1):\n s=input()\n if s not in a and a[i][-1]==s[0]:\n a.append(s)\n else:\n l=0\n break\nif l==1:\n print("YES")\nelse:\n print(\'NO\')', 'n = int(input())\nlist_words = []\nfor q in range(n):\n list_words.append(input())\n\n\ndef check(l):\n for i in range(len(l)-1):\n if l[i][-1] != l[i+1][0]:\n return "NO"\n for o in range(len(l)):\n if l[o] in l[:o] or o in l[o+1:]:\n return "NO"\n return "YES"\n\n\nprint(check(list_words))\n', "import sys\nn=int(input())\nw=[]\ncheck=False\nfor i in range (n):\n w.append(input())\nfor i in range (1,n-1,1):\n for j in range (0,i):\n if w[i]!=w[j]:\n if w[i][0]==w[i-1][len(w[i-1])-1]:\n check=True\n else:\n check=False\n break\nif check:\n print('YES')\nelse:\n print('NO')\n", "n=int(input())\nwords=[]\ngm='NO'\nrep='YES'\nfor i in range(n):\n c=input()\n for j in range(i):\n if c==words[j]:\n rep='NO'\n break\n words.append(c)\n\nfor i in range(n-1):\n a=words[i]\n b=words[i+1]\n if b[0]==a[len(a)-1]:\n gm='YES'\n continue\n else:\n break\nif rep=='NO':\n print(rep)\nelse:\n print(gm)", "n=int(input())\nw=[]\ncheck=False\nfor i in range (n):\n w.append(input())\nfor i in range (1,n-1,1):\n for j in range (0,i):\n if w[i]!=w[j]:\n if w[i][0]==w[i-1][len(w[i-1])-1]:\n check=True\n else:\n check=False\n break\nif check:\n print('YES')\nelse:\n print('NO')\n", 'import sys\nn = int (input())\nwords = []\nNo=" "\nfor i in range (n) :\n words.append(input())\nfor x in range(len(words)-1):\n if words.count(words[x]) > 1 or words[x+1][0] != words[x][-1]:\n No="No"\n print (No)\n sys.exit() \nIf No != "No":\n print ("Yes")', 'def taka():\n n = int(input())\n listofwords =[]\n for i in range(n):\n strTEMP = input()\n\n if i == 0:\n listofwords.append(strTEMP)\n continue\n else:\n if strTEMP in listofwords:\n return "No"\n else:\n cmp = listofwords[-1]\n if strTEMP[0] != cmp[-1]:\n return "No"\n else:\n listofwords.append(strTEMP)\n return "Yes"\n\nprint(taka())\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s086332011', 's188911199', 's395809739', 's441286338', 's610787527', 's616047164', 's404373332'] | [3060.0, 3060.0, 3060.0, 3316.0, 3060.0, 2940.0, 2940.0] | [17.0, 17.0, 19.0, 22.0, 20.0, 17.0, 17.0] | [219, 325, 319, 367, 308, 279, 496] |
p03261 | u363118893 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ['N = int(input())\nans = "Yes"\narr = []\nfor i in range(N)\n arr.append(input())\n if not i == 1:\n if arr[i] in arr and arr[i-1][-1] == arr[i][0]\n pass\n else:\n ans = "No"\n break\n\nprint(ans)\n', 'N = int(input())\nans = "Yes"\narr = []\nfor i in range(N):\n arr.append(input())\n if not i == 0:\n if arr[i-1][-1] == arr[i][0] and not arr[i] in arr[:-2]:\n pass\n else:\n ans = "No"\n break\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s744349652', 's721918044'] | [2940.0, 2940.0] | [18.0, 17.0] | [238, 249] |
p03261 | u366939485 | 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_w = [input() for s in range(0, n)]\nfor i in range(0, n):\n if i == 0 or (list_w[i - 1][-1] == list_w[i][0]) and list_w[i] not in list_w[:i]:\n print(list_w[i])\n continue\n else:\n print("No")\n exit()\nprint("Yes")', 'n = int(input())\nlist_w = [input() for s in range(0, n)]\nfor i in range(0, n):\n if i == 0 or (list_w[i - 1][-1] == list_w[i][0]) and list_w[i] not in list_w[:i]:\n continue\n else:\n print("No")\n exit()\nprint("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s403675233', 's017103307'] | [9000.0, 9072.0] | [29.0, 28.0] | [264, 239] |
p03261 | u367130284 | 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. | ['_,a=open(0).readlines()\nif len(set(a))<len(a):\n print("No")\n exit()\nb=[(i[0],i[-2]) for i in a]\nfor k in range(len(b)-1):\n if b[k][1]!=b[k+1][0]:\n print("No")\n exit()\nprint("Yes")', 'n,*a=open(0).read().split()\nif len(a)>len(set(a)):\n print("No")\n exit()\nelse:\n s=a[0][-1]\n for i in range(1,int(n)):\n if s==a[i][0]:\n s=a[i][-1]\n else:\n print("No")\n exit()\n #print(a[i][0])\nprint("Yes")'] | ['Runtime Error', 'Accepted'] | ['s376735162', 's390513651'] | [3060.0, 3060.0] | [17.0, 18.0] | [188, 268] |
p03261 | u371467115 | 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(w)]\nans="Yes"\nfor j in range(1,len(w)):\n if w[j-1][len(w[j-1])-1]!=w[j][0]:\n ans="No"\nprint(ans)', 'n=int(input())\nw=[input() for i in range(n)]\nans="Yes"\nfor j in range(1,len(w)):\n if w[j-1][len(w[j-1])-1]!=w[j][0]:\n ans="No"\nprint(ans)', 'n=int(input())\nw=[input() for i in range(n)]\nans="Yes"\nif len(set(w))!=n:\n ans="No"\nfor j in range(1,len(w)):\n if w[j-1][-1]!=w[j][0]:\n ans="No"\nprint(ans)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s001996236', 's867712025', 's018192085'] | [2940.0, 3060.0, 3060.0] | [18.0, 19.0, 18.0] | [141, 141, 161] |
p03261 | u374802266 | 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())\nfor i in range(n):\n a.append(input())\nif len(a)!=len(set(a)):\n print('No')\n exit()\nfor i in range(n-1):\n if a[i][-1]!=a[i+1][0]:\n print('No')\n exit()\nprint('Yes')", "n=int(input())\na=[]\nfor i in range(n):\n a.append(input())\nif len(a)!=len(set(a)):\n print('No')\n exit()\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'] | ['s935166194', 's166422358'] | [3060.0, 3060.0] | [17.0, 17.0] | [203, 208] |
p03261 | u384679440 | 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)]\nans = 'Yes'\nW_set = set(W)\nif len(W) == len(W_set):\n for i in range(1, N - 1):\n if W[i][0] != W[i-1][-1]:\n ans = 'No'\n break\nelse:\n ans = 'No'\nprint(ans)", "N = int(input())\nW = [input() for _ in range(N)]\nans = 'Yes'\nW_set = set(W)\nif len(W) == len(W_set):\n for i in range(1, N):\n if W[i][0] != W[i-1][-1]:\n ans = 'No'\n break\nelse:\n ans = 'No'\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s996806206', 's739181633'] | [3060.0, 3060.0] | [17.0, 17.0] | [223, 213] |
p03261 | u385244248 | 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,*W = map(str,open(0).read().split())\nN = int(N)\nfor i in range(N-1):\n if list(W[i])[-1] != list(W[i+1])[0]:\n print("No")\n sys.exit()\nprint("Yes")', 'import sys\nN,*W = map(str,open().read().split())\nN = int(N)\nfor i in range(N-1):\n if list(N[i])[-1] != list(N[i+1])[0]:\n print("No")\n sys.exit()\nprint("Yes")', 'import sys\nN,*W = map(str,open().read().split())\nN = int(N)\nfor i in range(N-1):\n if list(W[i])[-1] != list(W[i+1])[0]:\n print("No")\n sys.exit()\nprint("Yes")', 'import sys\nN,*W = map(str,open(0).read().split())\nN = int(N)\nfor i in range(N-1):\n if list(W[i])[-1] != list(W[i+1])[0]:\n print("No")\n sys.exit()\nif len(W) != len(set(W)):\n print("No")\n sys.exit()\nprint("Yes")'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s335569538', 's596740309', 's858360240', 's552943044'] | [2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 17.0, 18.0, 17.0] | [175, 174, 174, 232] |
p03261 | u393512980 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ['from collections import defaultdict\ndic = defaultdict(str)\nn = int(input())\nlst = [input() for _ in range(n)]\nlast = lst[0]\nflag = True\nfor i in range(1, n):\n if lst[i][0] != last[-1]:\n \tflag = False\n break\n dic[lst[i]] += 1\n if dic[lst[i]] > 1\n \tflag = False\n break\nif flag:\n print("Yes")\nelse:\n print("No")\n ', 'from collections import defaultdict\ndic = defaultdict(int)\nn = int(input())\nlst = [input() for _ in range(n)]\nlast = lst[0]\nflag = True\nfor i in range(1, n):\n if lst[i][0] != last[-1]:\n flag = False\n break\n dic[lst[i]] += 1\n if dic[lst[i]] > 1:\n flag = False\n break\n last = lst[i]\nif flag:\n print("Yes")\nelse:\n print("No")', 'from collections import defaultdict\ndic = defaultdict(int)\nn = int(input())\nlst = [input() for _ in range(n)]\nlast = lst[0]\ndic[last] = 1\nflag = True\nfor i in range(1, n):\n if lst[i][0] != last[-1]:\n flag = False\n break\n dic[lst[i]] += 1\n if dic[lst[i]] > 1:\n flag = False\n break\n last = lst[i]\nif flag:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s339957371', 's567620802', 's389406122'] | [2940.0, 3316.0, 3316.0] | [18.0, 23.0, 23.0] | [324, 340, 354] |
p03261 | u395620499 | 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()\n\nok = True\nt = input()\np = t[-1]\nfor i in range(n-1):\n t = input()\n if t in s:\n ok = False\n s.add(t)\n if t[0] != p:\n ok = False\n p = t[-1]\n \nprint('Yes' if ok else 'No')", "n = int(input())\ns = set()\n\nok = True\nt = input()\np = t[-1]\ns.add(t)\nfor i in range(n-1):\n t = input()\n if t in s:\n ok = False\n s.add(t)\n if t[0] != p:\n ok = False\n p = t[-1]\n\nprint('Yes' if ok else 'No')\n"] | ['Wrong Answer', 'Accepted'] | ['s126362235', 's043139251'] | [9032.0, 9128.0] | [30.0, 30.0] | [208, 234] |
p03261 | u396495667 | 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(x) for x in range(n)]\ns = set(w)\nans ='Yes'\nif len(s) !=n:\n ans ='No'\nelse:\n for i in range(n):\n if w[i][0] != w[i-1][-1]:\n ans ='No'\n else:\n ans ='Yes'\nprint(ans)\n", "n = int(input())\ns =[input() for _ in range(n)]\nans =0\nif len(s) != len(set(s)):\n ans = 1\nfor i in range(1,n):\n if s[i-1][-1] != s[i][0]:\n ans =1\nprint('No' if ans ==1 else 'Yes')"] | ['Wrong Answer', 'Accepted'] | ['s497856363', 's934944950'] | [3064.0, 3064.0] | [18.0, 18.0] | [210, 184] |
p03261 | u400221789 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ["from sys import exit\nn=int(input())\ns=input()\nw=[]\nw.append(s)\nfor i in range(n-1):\n s=input()\n if w[i][-1]!=a[0] or s in w:\n print('No')\n exit()\n else:\n w.append(s)\nprint('Yes')\n ", "from sys import exit\nn=int(input())\ns=input()\nw=[]\nw.append(s)\nfor i in range(n-1):\n s=input()\n if w[i][-1]!=s[0] or s in w:\n print('No')\n exit()\n else:\n w.append(s)\nprint('Yes')"] | ['Runtime Error', 'Accepted'] | ['s971477050', 's996979861'] | [3060.0, 3060.0] | [17.0, 17.0] | [193, 190] |
p03261 | u406109688 | 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. | ['c = int(input())\nw = []\nfor i in range(c):\n w.append(input())\nif len(set(w)) != len(w):\n print("No")\n return\nfor i in range(len(w) - 1):\n if w[i][-1] != w[i+1][0]:\n print("No")\n return\nprint("Yes")', 'falsify = "Yes"\nc = int(input())\nw = []\nfor i in range(c):\n w.append(input())\nif len(set(w)) != len(w):\n falsify = "No"\nfor i in range(len(w) - 1):\n if w[i][-1] != w[i+1][0]:\n falsify = "No"\nprint(falsify)'] | ['Runtime Error', 'Accepted'] | ['s186606876', 's654229689'] | [3060.0, 3060.0] | [17.0, 18.0] | [207, 211] |
p03261 | u410118019 | 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 aa=input()\n if aa in a or aa[0] != a[-1][0]:\n print("No")\n break\n if i == n-1:\n print("Yes")\n a.append(aa)', 'n=int(input())\na=[input()]\nfor i in range(n-1):\n aa=input()\n if aa in a or aa[0] != a[-1][-1]:\n print("No")\n break\n if i == n-2:\n print("Yes")\n a.append(aa)\n'] | ['Runtime Error', 'Accepted'] | ['s240330676', 's119622525'] | [2940.0, 2940.0] | [17.0, 18.0] | [159, 170] |
p03261 | u417794477 | 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 = []\nans = "Yes"\npreword = input()\n\nfor i in range(n-1):\n w = input()\n if w in word_list:\n ans = "No"\n if preword[-1] != w[0]:\n ans = "No"\n word_list.append(w)\n preword = w\nprint(ans)', 'n = int(input())\nword_list = []\nans = "Yes"\npreword = input()\nword_list.append(preword)\nfor i in range(n-1):\n w = input()\n if w in word_list:\n ans = "No"\n if preword[-1] != w[0]:\n ans = "No"\n word_list.append(w)\n preword = w\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s270818781', 's905706749'] | [3060.0, 3060.0] | [17.0, 18.0] | [239, 264] |
p03261 | u419963262 | 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()\nans=0\nfor i in range(n):\n keep=s[-1]\n s=input()\n if keep != s[0]:\n ans=1\n else:\n continue\nprint(["Yes","No"][ans])\n \n ', 'n=int(input())\ns=input()\nans=0\nfor i in range(n-1):\n keep=s[-1]\n s=input()\n if keep != s[0]:\n ans=1\n else:\n continue\nprint(["Yes","No"][ans])\n \n \n', 'n=int(input())\ncheck=[]\ns=input()\ncheck.append(s)\nans=0\nfor i in range(n-1):\n keep=s[-1]\n s=input()\n if keep != s[0]:\n ans=1\n if str(s) in check:\n ans = 1\n else:\n check.append(s)\nprint(["Yes","No"][ans])'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s253923041', 's772474907', 's056157869'] | [9112.0, 9152.0, 9124.0] | [22.0, 28.0, 27.0] | [157, 160, 217] |
p03261 | u426108351 | 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())\nused = [input()]\nflag = 1\nfor i in range(N-1):\n now = input()\n if now not in used and used[-1][-1] == now[0]:\n used.append(now)\n else:\n flag = 0\n \tbreak\nif flag == 1:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nused = [input()]\nflag = 1\nfor i in range(N-1):\n now = input()\n if now not in used and used[-1][-1] == now[0]:\n used.append(now)\n else:\n flag = 0\n\nif flag == 1:\n print("Yes")\nelse:\n print("No")\n'] | ['Runtime Error', 'Accepted'] | ['s213215064', 's853112226'] | [2940.0, 2940.0] | [18.0, 17.0] | [229, 223] |
p03261 | u432453907 | 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=[str(input())]\nans="Yes"\nfor i in range(n-1):\n x=str(input())\n w.append(x)\n y=w[i]\n if x[0]!=y[-1]:\n ans="No"\n break\nprint(ans)', 'n=int(input())\nw=[str(input())]\nans="Yes"\nfor i in range(n-1):\n x=str(input())\n if x in w:\n ans="No"\n break\n w.append(x)\n y=w[i]\n if x[0]!=y[-1]:\n ans="No"\n break\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s272824830', 's796119119'] | [9188.0, 9164.0] | [31.0, 28.0] | [170, 216] |
p03261 | u432805419 | 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 = 1\n\n\n\nfor i in range(n):\n for j in range(i+1,n-i+1):\n if w[i] == w[j]:\n flag = flag *0\n break\n \nfor i in range(n):\n if i == 0:\n continue\n if w[i-1][-1] == w[i][0]:\n flag = flag * 1\n else:\n flag = flag * 0\n \nif flag == 1:\n print("Yes")\nelse:\n print("No")', 'n = int(input())\nw = [input() for i in range(n)]\nflag = 1\n\n\n\nfor i in range(n):\n for j in range(n):\n if i == j:\n continue\n if w[i] == w[j]:\n flag = flag *0\n break\n \nfor i in range(n):\n if i == 0:\n continue\n if w[i-1][-1] == w[i][0]:\n flag = flag * 1\n else:\n flag = flag * 0\n \nif flag == 1:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s303360469', 's211183955'] | [3064.0, 3060.0] | [17.0, 19.0] | [347, 372] |
p03261 | u433380437 | 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=[]\nw=''\nfor i in range(n):\n if i !=0 and w[-1] !=str(input())[0]:\n print('No')\n exit()\n else:\n w=str(input())\n W.append(w)\nif len(W) != len(list(set(W))):\n print('No')\n exit()\nprint('Yes')", "n =int(input())\nW=[]\nw=''\nfor i in range(n):\n s=str(input())\n if i !=0 and w[-1] != s[0]:\n print('No')\n exit()\n else:\n w=s\n W.append(w)\nif len(W) != len(list(set(W))):\n print('No')\n exit()\nprint('Yes')"] | ['Runtime Error', 'Accepted'] | ['s862309142', 's919459976'] | [9184.0, 9184.0] | [27.0, 29.0] | [246, 244] |
p03261 | u434872492 | 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 = []\nw_dic = dict()\nfor i in range(N):\n W.append(input())\n\ncheck = True\nfor i in range(N-1):\n if W[i][-1] == W[i+1][0]:\n continue\n else:\n check = False\n break\nfor i in range(N):\n if W[i] in w_dic:\n check = False\n else:\n w_dict[W[i]] = 1\nif check:\n print('Yes')\nelse:\n print('No')", "N = int(input())\nW = []\nw_dic = dict()\nfor i in range(N):\n a = input()\n W.append(a)\n\ncheck = True\nfor i in range(N-1):\n s = W[i]\n s_1 = W[i+1]\n if s[-1] == s_1[0]:\n continue\n else:\n check = False\n break\nfor i in range(N):\n if W[i] in w_dic:\n check = False\n break\n else:\n w_dic[W[i]] = 1\nif check:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s127972336', 's265773851'] | [3064.0, 3064.0] | [18.0, 17.0] | [354, 401] |
p03261 | u441320782 | 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_1 = 1\nflag_2 = None\ninf = [input() for i in range(N)]\nprint(inf)\nfor j in range(N):\n for k in range(N):\n if inf[j]==inf[k]:\n flag_1 = 0\n break\n\nfor p in range(N-1):\n sear_1 = [q for q in inf[p]]\n sear_2 = [o for o in inf[p+1]]\n if sear_1[-1]==sear_2[0]:\n flag_2 = 1\n else:\n flag_2 = 0\nif flag_1 == 1 and flag_2 == 1:\n print("Yes")\nelif flag_2 == 0 and flag_2 == 0:\n print("No")\n ', 'N=int(input())\nx=[input() for _ in range(N)]\nflag=0\n\nif len(x)!=len(list(set(x))):\n flag=1\n\nfor i in range(N-1):\n if x[i][-1]!=x[i+1][0]:\n flag=1\nif flag==0:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s605021517', 's218619389'] | [3064.0, 3060.0] | [18.0, 18.0] | [430, 197] |
p03261 | u448655578 | 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 = []\nfor i in range(N):\n word = list(input())\n if i == 0:\n words.append(word[len(word)])\n elif i == N-1:\n words.append(word[0])\n else:\n words.append(word[0])\n words.append(word[len(word)])\n \nif len(set(words))*2 - len(words) == 0:\n print("Yes")\nelse:\n print("No")\n \n ', 'N = int(input())\nwords = []\nl = []\nfor i in range(N):\n a = input()\n if i == 0:\n l.append(a)\n b = list(a)\n words.append(b[len(b)-1])\n elif a not in l and i > 0:\n b = list(a)\n print(b)\n if i == N-1:\n words.append(b[0])\n else:\n words.append(b[0])\n words.append(b[len(b)-1])\n l.append(a)\n elif a in l and i > 0:\n print("No")\n exit(1)\n\nfor h in range(0,len(l)-2,2):\n if l[h] == l[h+1]:\n flag = True\nif all(l):\n#if len(set(words))*2 - len(words) == 0:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nwords = []\nl = []\nfor i in range(N):\n a = input()\n if i == 0:\n l.append(a)\n b = list(a)\n words.append(b[len(b)-1])\n elif i > 0:\n b = list(a)\n if i == N-1:\n words.append(b[0])\n else:\n words.append(b[0])\n words.append(b[len(b)-1])\n l.append(a)\n\nif len(set(l)) != len(l):\n print("No")\n exit()\n\nfor h in range(0,len(words),2):\n if words[h] != words[h+1]:\n print("No")\n exit()\nprint("Yes")\n\n \n\n \n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s379447572', 's999636416', 's285587520'] | [3060.0, 3064.0, 3064.0] | [17.0, 18.0, 17.0] | [311, 609, 528] |
p03261 | u453526259 | 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\nused = []\nans = "Yes"\n\nfor i in range(n):\n if i == 0:\n t = str(input())\n else:\n t = str(input())\n print(t + "!")\n for j in used:\n if t == j:\n ans = "No"\n\n if len(t) == 1:\n if past[]\n \n else:\n if past[-1] != t[0]:\n ans == "No"\n used.append(t)\n past = t\n\nprint(ans)', '\ns = int(input())\nlast = str(input())\nwordlist = [last]\nans = "Yes"\n\nfor i in range(s-1):\n word = str(input())\n\n if last[-1] != word[0]:\n ans = "No"\n break\n \n elif word in wordlist:\n ans = "No"\n break\n\n last = word\n wordlist.append(word)\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s476819593', 's555339528'] | [2940.0, 2940.0] | [17.0, 18.0] | [408, 296] |
p03261 | u454714837 | 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 = []\n\nAns = True\n\nfor i in range(N):\n a =input()\n L.append(a)\n\nfor j in range(N-1):\n if list(L[j])[-1] != list(L[j+1])[0]:\n Ans = False\n\nfor k in range(N):\n if L[i] in L[:i]:\n Ans = False\n \nif Ans == True:\n print('Yes')\nelse:\n print('No')", "N = int(input())\nL = []\n\nAns = True\n\nfor i in range(N):\n a =input()\n L.append(a)\n\nfor j in range(N-1):\n if list(L[j])[-1] != list(L[j+1])[0]:\n Ans = False\n\nfor k in range(N):\n if L[k] in L[:k]:\n Ans = False\n \nif Ans == True:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s044809345', 's343019816'] | [3064.0, 3064.0] | [17.0, 18.0] | [296, 296] |
p03261 | u455317716 | 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())\nsiritori_list = list()\nfor i in range(n):\n siritori_list.append(input())\nfor ii in range(n):\n word = siritori_list.pop(0)\n print(word,siritori_list)\n if siritori_list:\n if not(word[-1] == siritori_list[0][0]) or word in siritori_list:\n print("No")\n break\nelse:\n print("Yes")', 'n = int(input())\nsiritori_list = list()\nfor i in range(n):\n siritori_list.append(input())\nfor ii in range(n):\n word = siritori_list.pop(0)\n if siritori_list:\n if not(word[-1] == siritori_list[0][0]) or word in siritori_list:\n print("No")\n break\nelse:\n print("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s225550314', 's962887742'] | [3064.0, 3060.0] | [22.0, 17.0] | [335, 305] |
p03261 | u457601965 | 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 numpy as np\nimport collections as cl\nimport itertools as it\n# import more_itertools as mit\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(100000)\n\nn = int(readline())\nw = list(readlines().split())\ndic = set()\n\nfor i in w:\n if i == 0:\n dic.append(i)\n continue\n if i in dic or dic[i-1][-1] != dic[i][0]:\n print('No')\n sys.exit()\n dic.append(i)\nprint('Yes')", "import sys\nimport numpy as np\nimport collections as cl\nimport itertools as it\n# import more_itertools as mit\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(100000)\n\nn = int(readline())\nw = [input().strip() for _ in range(n)]\ndic = set()\n\nfor num, i in enumerate(w):\n if num == 0:\n dic.add(i)\n continue\n if i in dic or w[num-1][-1] != i[0]:\n print('No')\n sys.exit()\n dic.add(i)\nprint('Yes')"] | ['Runtime Error', 'Accepted'] | ['s437636991', 's887386286'] | [27084.0, 27076.0] | [117.0, 121.0] | [489, 506] |
p03261 | u464912173 | 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() for i in range(n)] \n\nfor i in range(1, n):\n if a[i-1][-1]!=a[i][0] or a[i]==a[:i-1]:\n print('No')\n break\n else:\n print('Yes')", "n = int(input())\na = [input() for i in range(n)] \n\nfor i in range(1, n):\n if a[i-1][-1]!=a[i][0] or a[i] in a[:i-1]:\n print('No')\n break\nelse:\n print('Yes')"] | ['Wrong Answer', 'Accepted'] | ['s146220435', 's542017666'] | [3060.0, 3060.0] | [17.0, 17.0] | [166, 164] |
p03261 | u468953424 | 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())\nc=0\nm=[]\ns=input()\nm.append(s)\nfor i in range(N-1):\n l=input()\n if l not in m and m[i][-1]==l[0]:\n c+=1\n m.append(l)\nif c==N-1:\n print("YES")\nelse:\n print("NO")', 'N=int(input())\nc=0\nm=[]\ns=input()\nm.append(s)\nfor i in range(N-1):\n l=input()\n if l not in m and m[i][-1]==l[0]:\n c+=1\n m.append(l)\nif c==N-1:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s608909910', 's775193299'] | [3060.0, 3060.0] | [17.0, 17.0] | [183, 183] |
p03261 | u469953228 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ['n=input()\nx=[]\nfor i in range(n):\n w = input()\n if i !=0 and (w in x or x[i-1][-1] != w[0]):\n print ("No")\n exit()\n x.append(w)\nprint("Yes")\n ', 'n = int(input())\ns = input()\nL = [s]\nfor i in range(n-1):\n t = input()\n if t[0] != s[len(s)-1] or t in L:\n print("No")\n exit()\n L.append(t)\n s = t\nprint("Yes")'] | ['Runtime Error', 'Accepted'] | ['s725898436', 's779069043'] | [2940.0, 3060.0] | [17.0, 17.0] | [154, 170] |
p03261 | u475402977 | 2,000 | 1,048,576 | Takahashi is practicing _shiritori_ alone again today. Shiritori is a game as follows: * In the first turn, a player announces any one word. * In the subsequent turns, a player announces a word that satisfies the following conditions: * That word is not announced before. * The first character of that word is the same as the last character of the last word announced. In this game, he is practicing to announce as many words as possible in ten seconds. You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions. | ["N=input()\nN=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][len(S[i])-1]!=S[i+1][0]:\n ans='No'\nprint(ans)\n", "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][len(S[i])-1]!=S[i+1][0]:\n ans='No'\nprint(ans)\n"] | ['Runtime Error', 'Accepted'] | ['s406851782', 's820726435'] | [3060.0, 3060.0] | [17.0, 17.0] | [183, 173] |
p03261 | u475808877 | 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()]\ncount=1\nfor i in range(n-1):\n w=input()\n s.append(w)\n if s[i][-1]==s[i+1][0]:\n count=count+1\nif count==n and len(s)==len(set(s)):\n print("Yes")\nelse:\n print("no")', 'n=int(input())\ns=[input()]\ncount=1\nfor i in range(n-1):\n w=input()\n s.append(w)\n if s[i][-1]==s[i+1][0]:\n count=count+1\nif count==n and len(s)==len(set(s)):\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s206496549', 's687347083'] | [3064.0, 3060.0] | [17.0, 18.0] | [211, 211] |
p03261 | u477650749 | 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. | ['x1, y1, x2, y2 = map(int, input().split())\nprint(x2+(y1-y2),y2+(x2-x1),x1+(y1-y2),y1+(x2-x1))', 'n = int(input())\nlist_w = [input() for i in range(n)]\nlist_ok = [list_w[0]]\n\nif len(list_w) != len(set(list_w)):\n print("No")\n\nelse:\n for i in range(1, n):\n if list_w[i - 1][-1] == list_w[i][0]:\n list_ok.append(list_w[i])\n i += 1\n if len(list_ok) == len(list_w):\n print("Yes")\n else:\n print("No")\n'] | ['Runtime Error', 'Accepted'] | ['s059690442', 's346346166'] | [2940.0, 3060.0] | [18.0, 17.0] | [93, 352] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.