Submission #3769103
Source Code Expand
#include<stdio.h> #include<iostream> #include<iomanip> #include<string> #include<vector> #include<queue> #include<stack> #include<map> #include<set> #include<algorithm> #include<string> #include<math.h> #include <numeric> using namespace std; typedef long long ll; #define REP(i,n) for(int i=0;i<n;++i) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define ALL(v) (v).begin(), (v).end() #define p(s) cout<<(s)<<endl #define p2(s, t) cout << (s) << " " << (t) << endl #define pn(s) cout << (#s) << " " << (s) << endl const ll mod = 1e9 + 7; const ll inf = 1e18; void printVector(vector<ll> A){ cout << "[vector]" << endl; for(int i=0; i<A.size(); i++){ cout << A[i] << " "; } cout << endl; } char getLastWord(string s){ return s[s.length() - 1]; } int main(){ cin.tie(0); ios::sync_with_stdio(false); // input int N; cin >> N; vector<string> W; FOR(i, 0, N){ string s; cin >> s; W.push_back(s); } set<string> S; for(auto w : W){ S.insert(w); } bool ret = true; if(W.size() != S.size()){ ret = false; } else{ char lastWord = getLastWord(W[0]); FOR(i, 1, N){ if(W[i][0] != lastWord){ ret = false; } lastWord = getLastWord(W[i]); } } if(ret){ p("Yes"); }else{ p("No"); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Shiritori |
User | peroon |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1436 Byte |
Status | AC |
Exec Time | 1 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 | 1 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 |