This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* There are NN strings. Each string's length is no more than 2020 characters. There are also QQ queries. For each query, you are given a string, and you need to find out how many times this string occurred previously. | |
| Input Format | |
| The first line contains NN, the number of strings. | |
| The next NN lines each contain a string. | |
| The N+2N+2nd line contains QQ, the number of queries. | |
| The following QQ lines each contain a query string. | |
| Constraints | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* | |
| There are NN sequences. All of them are initially empty, and you are given a variable lastans=0lastans=0. You are given QQ queries of two different types: | |
| "11 xx yy" - Insert yy at the end of the ((x⊕lastansx⊕lastans) mod NN)th sequence. | |
| "22 xx yy" - Print the value of the (yy mod sizesize)th element of the ((x⊕lastansx⊕lastans) mod NN)th sequence. Here, sizesize denotes the size of the related sequence. Then, assign this integer to lastanslastans. | |
| Note: You may assume that, for the second type of query, the related sequence will not be an empty sequence. Sequences and the elements of each sequence are indexed by zero-based numbering. | |
| The ⊕⊕ symbol denotes the xor operation. You can get more information about it from Wikipedia. It is defined as ^^ in most of the modern programming languages. | |
| Input Format | 
NewerOlder