Submission #3154570

Source Code Expand

Copy
import sys
N = int(input())
W = [input() for _ in range(N)]
d = set()
last = ""
for i in range(N):
    if W[i] in d:
        print("No")
        sys.exit()
    if last != "" and last != W[i][0]:
        print("No")
        sys.exit()
    last = W[i][-1]
    d.add(W[i])

print("Yes")

Submission Info

Submission Time
Task B - Shiritori
User showyou41
Language Python3 (3.4.3)
Score 200
Code Size 298 Byte
Status
Exec Time 17 ms
Memory 3064 KB

Test Cases

Set Name Score / Max Score Test Cases
All 200 / 200 max_1, max_2, max_3, max_4, min_1, no1_1, no1_2, no2_1, no2_2, random_1, random_2, sample_01, sample_02, sample_03, sample_04, yes_1, yes_2
Sample 0 / 0 sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
max_1 17 ms 3060 KB
max_2 17 ms 2940 KB
max_3 17 ms 3060 KB
max_4 17 ms 3060 KB
min_1 16 ms 3064 KB
no1_1 17 ms 3060 KB
no1_2 17 ms 3060 KB
no2_1 17 ms 2940 KB
no2_2 17 ms 3060 KB
random_1 17 ms 3060 KB
random_2 17 ms 3060 KB
sample_01 17 ms 3060 KB
sample_02 17 ms 3060 KB
sample_03 17 ms 3060 KB
sample_04 17 ms 2940 KB
yes_1 17 ms 3060 KB
yes_2 17 ms 3060 KB