F. Print Mix Strings

Codeforces
IDCF10088F
Time2000ms
Memory64MB
Difficulty
English · Original
Formal · Original
While I was working in the company, the internet broke. I didn't have anything to do without internet, so I decided to write this ACM problem. We need to mix between two strings and also we should keep the same order for both strings. Example: if we have s1 = "ab" and s2 = "cd", we can generate six strings: abcd acbd acdb cdab cadb cabd thank you for your help in ”Count Mix Strings” problem. now I can calculate the complexity and make input and output files. You will be given the two strings and you should print all the distinct strings that could be generated in the alphabetical order. Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 100). Followed by the test cases, each test case is on one line. it contains two strings s1 and s2, both strings consist of at least 1 and at most 8 lower case English letters (from ‘a’ to ‘z’). For each test case, print all the distinct strings that could be generated in the alphabetical order. print a blank line after each test case. ## Input Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 100). Followed by the test cases, each test case is on one line. it contains two strings s1 and s2, both strings consist of at least 1 and at most 8 lower case English letters (from ‘a’ to ‘z’). ## Output For each test case, print all the distinct strings that could be generated in the alphabetical order. print a blank line after each test case. [samples]
**Definitions** Let $ R_1 = [x_1, x_1 + w_1] \times [y_1, y_1 + h_1] $ be the initial rectangle. Let $ R_2 = [x_2, x_2 + w_2] \times [y_2, y_2 + h_2] $ be the fixed target rectangle. Let $ K \in \mathbb{Z}_{\geq 0} $ be the maximum number of moves. A move reflects $ R_1 $ about one of its four edges (left, right, top, bottom), preserving its width and height. **Constraints** 1. $ 1 \leq T \leq 10^5 $ 2. $ 1 \leq w_1, h_1, w_2, h_2 \leq 10^9 $ 3. $ |x_1|, |y_1|, |x_2|, |y_2| \leq 10^9 $ 4. $ 0 \leq K \leq 10^9 $ **Objective** Compute the maximum possible area of intersection $ A = \text{Area}(R_1' \cap R_2) $, where $ R_1' $ is the rectangle obtained after applying at most $ K $ reflections about its own edges.
API Response (JSON)
{
  "problem": {
    "name": "F. Print Mix Strings",
    "description": {
      "content": "While I was working in the company, the internet broke. I didn't have anything to do without internet, so I decided to write this ACM problem.  We need to mix between two strings and also we should k",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 65536
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10088F"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "While I was working in the company, the internet broke. I didn't have anything to do without internet, so I decided to write this ACM problem. \n\nWe need to mix between two strings and also we should k...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ R_1 = [x_1, x_1 + w_1] \\times [y_1, y_1 + h_1] $ be the initial rectangle.  \nLet $ R_2 = [x_2, x_2 + w_2] \\times [y_2, y_2 + h_2] $ be the fixed target rectangle.  \nLet $ K \\in...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments