B. Russo's Russian

Codeforces
IDCF10229B
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
It is well known that Russian is one of the hardest languages in the world. It is one of the only languages in which declension applies to nouns, adjectives, pronouns and numerals. If you know something about German and have heard of its three complicated declensions, know that there are seven in Russian. Anyway, if you are up to a challenge, try to learn Russian. What is less known is that there is a Russian variant commonly spoken in Brazil. A Russian family immigrated into Italy in the XVII century. Later, in the wake of the XX century, they came to Brazil, where they live to this day, still preserving their culture and customs. This is the 'Russo' family. Of course, that is not their original surname, but they chose it when mister 'Pshenychnykh', after arriving at Calabria, gave up on trying to teach the Italians how to pronounce 'Pshenychnykh'. Only later he found out that 'Rosso' means red in Italian, but that just made him like the name even more. Russo's Russian dialect is a mix between Italian, Portuguese, Russian and Calabrian. Its grammar has one of the most complex phrases known to mankind. That became a problem when the descendants of mister Pshenychnykh had to study his finances. Fortunately, the family prospered in Brazil and got really rich. Unfortunately, that created a dispute among the descendants for the wealth and possessions linked to the family's name. Trying to settle things, they went after mister Pshenychnykh's financial notebooks. Of course, his notes are in the peculiar dialect spoken by the family. Moreover, it is known that mister Pshenychnykh always wrote things respecting the grammar of his dialect — he was really proud of his roots. A note is valid if it a possible expansion of _M_ in the following grammar: Print "YES" if the line supplied is valid, and "NO" otherwise. ## Output Print "YES" if the line supplied is valid, and "NO" otherwise. [samples]
**Definitions** Let $ M $ be a formal grammar rule (unspecified). A string $ s $ is valid if $ s \in L(M) $, where $ L(M) $ is the language generated by grammar $ M $. **Given** A string $ s $ is provided as input. **Objective** Output "YES" if $ s \in L(M) $; otherwise, output "NO".
API Response (JSON)
{
  "problem": {
    "name": "B. Russo's Russian",
    "description": {
      "content": "It is well known that Russian is one of the hardest languages in the world. It is one of the only languages in which declension applies to nouns, adjectives, pronouns and numerals. If you know somethi",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10229B"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "It is well known that Russian is one of the hardest languages in the world. It is one of the only languages in which declension applies to nouns, adjectives, pronouns and numerals. If you know somethi...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ M $ be a formal grammar rule (unspecified). A string $ s $ is valid if $ s \\in L(M) $, where $ L(M) $ is the language generated by grammar $ M $.\n\n**Given**  \nA string $ s $ is...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments