Submission #3579373
Source Code Expand
#include<bits/stdc++.h> using namespace std ; const int maxn = 100 + 10; set < string > st ; string s[maxn] ; int main() { int n ; cin >> n ; cin >> s[0] ; st.insert ( s[0] ) ; char c = s[0][s[0].size()-1] ; bool b , p = false ; for ( int i =1; i< n ; i++) { //cout << " I " << i << " c " << c << endl; cin >> s[i] ; b = st.insert ( s[i] ).second ; //cout << " b " << b << endl; if ( s[i][0] !=c || b == false) { p = true ; } c= s[i][s[i].size()-1] ; } if ( !p ) cout << "Yes" << endl; else cout << "No" << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Shiritori |
User | vjudge4 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 553 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Judge Result
Set Name | All | Sample | ||||
---|---|---|---|---|---|---|
Score / Max Score | 200 / 200 | 0 / 0 | ||||
Status |
|
|
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 | 2 ms | 256 KB |
max_2 | AC | 1 ms | 256 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 |