Submission #3165977


Source Code Expand

Copy
void main() {
	auto N = readln.chomp.to!int;
	dchar last;
	string[] m;
	foreach(i; 0..N) {
		auto S = readln.chomp;
		if(i==0) {
			m ~= S;
			last = S.back;
			continue;
		}
		if(last == S[0]) {
			last = S.back;
		} else {
			writeln("No");
			return;
		}
		foreach(j; m) {
			if(S == j) {
				writeln("No");
				return;
			}
		}
		m ~= S;
	}
	writeln("Yes");
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Submission Info

Submission Time
Task B - Shiritori
User private_yusuke
Language D (DMD64 v2.070.1)
Score 200
Code Size 1431 Byte
Status AC
Exec Time 2 ms
Memory 380 KB

Judge Result

Set Name All Sample
Score / Max Score 200 / 200 0 / 0
Status
AC × 17
AC × 4
Set Name Test Cases
All 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 sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
max_1 AC 1 ms 256 KB
max_2 AC 2 ms 380 KB
max_3 AC 1 ms 256 KB
max_4 AC 1 ms 256 KB
min_1 AC 1 ms 256 KB
no1_1 AC 1 ms 256 KB
no1_2 AC 1 ms 256 KB
no2_1 AC 1 ms 256 KB
no2_2 AC 1 ms 256 KB
random_1 AC 1 ms 256 KB
random_2 AC 1 ms 256 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sample_03 AC 1 ms 256 KB
sample_04 AC 1 ms 256 KB
yes_1 AC 1 ms 256 KB
yes_2 AC 1 ms 256 KB