report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Prefix - MarisaOJ: Marisa Online Judge

Prefix

Time limit: 1000 ms
Memory limit: 256 MB
Given $n$ string $S_1, S_2,...,S_n$. Determine if there exists 2 distinct indices $i, j$ that $S_i$ is a prefix of $S_j$. ### Input - The first line contains an integer $n$. - The next $n$ lines, each line contains a string. ### Output - Print the `YES` if there exists satisfied indices, `NO` otherwise. ### Constraints - $1 \le n \le 10^5$. - $1 \le |S_i| \le 20$. - $S_i$ contain only lowercase letters. ### Example Input: ``` 3 reimu marisa mari ``` Output: ``` YES ```
Introduction to Trie
Prefix
Compare string
Maximum score
Report
Maximum XOR subarray
Query on string
Language
Poem
Palindrome pairs
Mass XOR queries
XOR-path on tree
The ancient book
Topic
Data structure
String
Rating 1200
Solution (0) Solution