mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2025-01-26 01:40:08 +00:00
SP4033 PHONELST - Phone List
R58061037
This commit is contained in:
parent
18c4e40ebf
commit
5e8c50f621
27
Luogu/problem/SP4033/SP4033.cpp
Normal file
27
Luogu/problem/SP4033/SP4033.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include <bits/stdc++.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int t, n;
|
||||||
|
bool flag;
|
||||||
|
string s[10005];
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
cin >> t;
|
||||||
|
while (t--) {
|
||||||
|
flag = false;
|
||||||
|
cin >> n;
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
cin >> s[i];
|
||||||
|
}
|
||||||
|
sort(s, s + n);
|
||||||
|
for (int i = 0; i < n - 1; i++) {
|
||||||
|
if (s[i + 1].substr(0, s[i].size()) == s[i]) {
|
||||||
|
flag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cout << (flag ? "NO" : "YES") << endl;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user