Skip to content

Instantly share code, notes, and snippets.

@joonas-yoon
Last active February 23, 2020 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joonas-yoon/cbff39becc33b01bb8033f79ed53977f to your computer and use it in GitHub Desktop.
Save joonas-yoon/cbff39becc33b01bb8033f79ed53977f to your computer and use it in GitHub Desktop.
BOJ 5052 - 전화번호 목록 (정렬)
#include <bits/stdc++.h>
using namespace std;
int main(){
int T, n, i;
cin >> T;
while(T--){
cin >> n;
string s;
vector<string> v(n);
for(i=0; i < n; ++i) cin >> v[i];
sort(v.begin(), v.end());
bool answer = true;
for(i=0; i < n - 1; ++i){
if(v[i] == v[i + 1].substr(0, v[i].length())){
answer = false;
break;
}
}
cout << (consist ? "YES":"NO") <<endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment