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

String queries

Time limit: 1000 ms
Memory limit: 256 MB
Given $n$ strings consisting only of lowercase letters, each string having a length of at most $5$. You are given $q$ queries, where each query is a string. Determine whether each query string exists among the initial $n$ strings. ### Input - The first line contains the integer $n$. - The next $n$ lines each contain a string. - The following line contains the integer $q$. - The next $q$ lines each contain a string, representing a query. ### Output - For each query, if the string exists among the initial $n$ strings, print `YES`; otherwise, print `NO`. ### Constraints - $1 \le n,q \le 10^6$. - Each string consists only of lowercase letters. ### Example Input: ``` 2 maris reimu 4 maris rei reimu mio ``` Output: ``` YES NO YES NO ```
Other problems (Level 0)
Sum of divisors
Equal pairs
GCD and LCM
3
String queries
Consecutive
Prison
Topic
String
Rating 800
Solution (1) Solution