L. Cheating detection.

Codeforces
IDCF10241L
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
In SPC cheating is allowed, but any way Kilani likes to check if the participants are cheating or not, (especially Omar and Wesam :P) In SPC you can only submit codes in one programming languages which is Abu elayayeeeb programming language,a language developed by Ayoub Ayoub didn't finish developing it yet but he created 4 commands _define_ $x$ $a = b + c$ _read_ $x$ _print_ $x$ Every command should be on one line. Kilani thinks that two students cheated if and only if you can rename the variables so that the first code becomes exactly the same as the second code. You are given two codes, did they cheat? The first line contains one integer $n$ $(1 <= n <= 1000)$, which is the number of lines of the first code. The next $n$ lines will contain one of four commands. _define_ $x$ $a$ = $b$ + $c$ _read_ $x$ _print_ $x$ Where $x$, $a$, $b$ and $c$ are a names of variables. The first line contains one integer $m$ $(1 <= m <= 1000)$, which is the number of lines of the second code. The next $m$ lines will contain one of four commands. _define_ $x$ $a$ = $b$ + $c$ _read_ $x$ _print_ $x$ where $x$, $a$, $b$ and $c$ are a names of variables. It's guaranteed that before using any variable it will be defined, and the name of every variable will contain lowercase English letters of length at most 10, and no variable is defined twice. The variables can't be one of the reserved word(define, print, read). if they cheated print _YES_ otherwise print _NO_. ## Input The first line contains one integer $n$ $(1 <= n <= 1000)$, which is the number of lines of the first code.The next $n$ lines will contain one of four commands._define_ $x$$a$ = $b$ + $c$_read_ $x$_print_ $x$Where $x$, $a$, $b$ and $c$ are a names of variables.The first line contains one integer $m$ $(1 <= m <= 1000)$, which is the number of lines of the second code.The next $m$ lines will contain one of four commands._define_ $x$$a$ = $b$ + $c$_read_ $x$_print_ $x$where $x$, $a$, $b$ and $c$ are a names of variables.It's guaranteed that before using any variable it will be defined, and the name of every variable will contain lowercase English letters of length at most 10, and no variable is defined twice.The variables can't be one of the reserved word(define, print, read). ## Output if they cheated print _YES_ otherwise print _NO_. [samples]
**Definitions** Let $ C_1 = (c_{1,1}, \dots, c_{1,n}) $ and $ C_2 = (c_{2,1}, \dots, c_{2,m}) $ be two sequences of commands, where each command is one of: - $ \texttt{define } x $ - $ a = b + c $ - $ \texttt{read } x $ - $ \texttt{print } x $ with $ x, a, b, c $ being variable names (strings over lowercase English letters, length ≤ 10), and no variable is redefined. **Constraints** 1. $ 1 \le n, m \le 1000 $ 2. All variable names are distinct within each code. 3. Every variable used is defined before use. 4. Reserved words $ \texttt{define}, \texttt{read}, \texttt{print} $ do not appear as variable names. **Objective** Determine whether there exists a bijection $ f $ from the set of variable names in $ C_1 $ to the set of variable names in $ C_2 $ such that applying $ f $ to all variable names in $ C_1 $ results in a sequence identical to $ C_2 $. If such $ f $ exists, output **YES**; otherwise, output **NO**.
API Response (JSON)
{
  "problem": {
    "name": "L. Cheating detection.",
    "description": {
      "content": "In SPC cheating is allowed, but any way Kilani likes to check if the participants are cheating or not, (especially Omar and Wesam :P) In SPC you can only submit codes in one programming languages whi",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10241L"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "In SPC cheating is allowed, but any way Kilani likes to check if the participants are cheating or not, (especially Omar and Wesam :P)\n\nIn SPC you can only submit codes in one programming languages whi...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ C_1 = (c_{1,1}, \\dots, c_{1,n}) $ and $ C_2 = (c_{2,1}, \\dots, c_{2,m}) $ be two sequences of commands, where each command is one of:  \n- $ \\texttt{define } x $  \n- $ a = b + c...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments