Submission #3185528


Source Code Expand

Copy
import sys
N = int(input())
s = []
for i in range(N):
    s.append(input())
for i, s0 in enumerate(s):
    for j, s1 in enumerate(s):
        if i != j and s0 == s1:
            print('No')
            sys.exit()
s0 = s[0]
for i in range(1, len(s)):
    s1 = s[i]
    if s0[-1] != s1[0]:
        print('No')
        sys.exit()
    s0 = s1
print('Yes')

Submission Info

Submission Time
Task B - Shiritori
User taku0728
Language Python3 (3.4.3)
Score 200
Code Size 370 Byte
Status
Exec Time 19 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 18 ms 3060 KB
max_2 18 ms 3060 KB
max_3 19 ms 3060 KB
max_4 17 ms 3064 KB
min_1 17 ms 3060 KB
no1_1 18 ms 3064 KB
no1_2 18 ms 3060 KB
no2_1 17 ms 3060 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 3060 KB
yes_1 18 ms 3060 KB
yes_2 17 ms 3060 KB