A. MaratonIME helps Pablito

Codeforces
IDCF10098A
Time6000ms
Memory64MB
Difficulty
English · Original
Formal · Original
As is well known by any cultured person, rats are the smartest beings on earth. Followed directly by dolphins. MaratonIME knows about the species hierarchy and uses this knowledge in it's regard. Usually, when they need some resource, they know it's always useful to have a smart rat available. Unfortunately, rats are not very fond of us, primates, and will only help us if they owe us some favour. With that in mind, MaratonIME decided to help a little rat called Pablito. Pablito is studying rat's genealogy, to help with cloning and genetic mapping. luckily, the way rats identify themselves make the job much easier. The rat society is, historically, matriarchal. At first, there were little families, each of which had it's own leading matriarch. At that time, it was decided that rats would organize themselves according to the following rules: For instance, the offspring of a rat with id 6 and another with id 7 is 42. Pablito needs to know if two given rats have a common ancestor, but his only tool is the id number of each of the two rats, which is always a positive integer greater than 1 with no more than 16 digits. Can you help him? Create a program that decides if a pair of rats have some common ancestor. The input begins with a positive integer t ≤ 105, the number of test cases. After that, follows t lines, each with two integers ai e bi identifying two rats. Every rat's id is a positive integer greater than 1 and with no more than 16 digits. For each test case, print "Sim" if the rats ai and bi share a common ancestor and "Nao" otherwise. ## Input The input begins with a positive integer t ≤ 105, the number of test cases.After that, follows t lines, each with two integers ai e bi identifying two rats.Every rat's id is a positive integer greater than 1 and with no more than 16 digits. ## Output For each test case, print "Sim" if the rats ai and bi share a common ancestor and "Nao" otherwise. [samples]
Let $ N \in \mathbb{Z} $ be the length of the string. The minimum array size required to store the string is $ N + 1 $, accounting for the null terminator. **Objective** Compute $ N + 1 $.
API Response (JSON)
{
  "problem": {
    "name": "A. MaratonIME helps Pablito",
    "description": {
      "content": "As is well known by any cultured person, rats are the smartest beings on earth. Followed directly by dolphins. MaratonIME knows about the species hierarchy and uses this knowledge in it's regard. Usu",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 6000,
      "memory_limit": 65536
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10098A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "As is well known by any cultured person, rats are the smartest beings on earth. Followed directly by dolphins.\n\nMaratonIME knows about the species hierarchy and uses this knowledge in it's regard. Usu...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "Let $ N \\in \\mathbb{Z} $ be the length of the string.  \nThe minimum array size required to store the string is $ N + 1 $, accounting for the null terminator.  \n\n**Objective**  \nCompute $ N + 1 $....",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments