-
Notifications
You must be signed in to change notification settings - Fork 4
/
BCTELEPH.cpp
78 lines (71 loc) · 1.12 KB
/
BCTELEPH.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define alphaa "abcdefghijklmnopqrstuvwxyz"
#define ALPHAA "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define faster() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> II;
const ld pi=2*acos(0);
const ll inf = LLONG_MAX;
const ll ninf = LLONG_MIN;
const int oo = INT_MAX;
const int noo = INT_MIN;
string ds[10004];
int n;
void init(){
cin >> n;
for(int i=0;i<n;i++){
cin >> ds[i];
}
}
void process(){
bool FLAG = true;
sort(ds,ds+n);
for(int i=0;i<n-1;i++){
bool flag = false;
for(int j=0;j<ds[i].length();j++){
if (ds[i][j] != ds[i+1][j]){
flag = true; // nhat quan
break;
}
}
if (flag == false){
FLAG = false;
break;
}
}
if (FLAG == false){
cout << "NO" << endl;
}else cout << "YES" << endl;
}
int main(){
faster();
int T;
cin >> T;
while(T--){
init();
process();
}
return 0;
}