Submission #19557704


Source Code Expand

Copy
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <cmath>
#include <iomanip>

using namespace std;

void b_shiritori2(void) {
	int n;
	cin >> n;
	vector<string>w(n);
	for (int i = 0; i < n; i++)cin >> w[i];

	for (int i = 1; i < n; i++) {
		bool is_ok = true;
		if (w[i][0] != w[i - 1][w[i - 1].size() - 1])is_ok = false;

		for (int j = 0; j < i; j++) {
			if (w[i] == w[j])is_ok = false;
		}

		if (!is_ok) {
			cout << "No" << endl;
			return;
		}
	}

	cout << "Yes" << endl;
}

int main()
{
    b_shiritori2();
    return 0;
}

Submission Info

Submission Time
Task B - Shiritori
User yukileo
Language C++ (GCC 9.2.1)
Score 200
Code Size 637 Byte
Status AC
Exec Time 9 ms
Memory 3636 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 9 ms 3428 KB
max_2 AC 2 ms 3504 KB
max_3 AC 2 ms 3548 KB
max_4 AC 2 ms 3560 KB
min_1 AC 3 ms 3552 KB
no1_1 AC 2 ms 3600 KB
no1_2 AC 2 ms 3548 KB
no2_1 AC 3 ms 3636 KB
no2_2 AC 2 ms 3604 KB
random_1 AC 4 ms 3468 KB
random_2 AC 2 ms 3500 KB
sample_01 AC 3 ms 3440 KB
sample_02 AC 2 ms 3568 KB
sample_03 AC 2 ms 3632 KB
sample_04 AC 2 ms 3496 KB
yes_1 AC 2 ms 3424 KB
yes_2 AC 2 ms 3496 KB