[语言月赛202305] 制糊串

Luogu
IDLGB3769
Time1000ms
Memory512MB
DifficultyP1
2023O2优化字符串(入门)语言月赛
给出两个字符串 $s$ 和 $t$,有 $q$ 次询问。 每次给出 $l_1, r_1$ 和 $l_2, r_2$,请判断 $s[l_1, r_1]$ 和 $t[l_2, r_2]$ 谁的字典序更小。 ## Input 第一行是一个字符串 $s$。 第二行是一个字符串 $t$。 第三行是一个整数,表示询问次数 $q$。 接下来 $q$ 行,每行四个整数 $l_1, r_1, l_2, r_2$,表示一次询问。 ## Output 对每次询问,输出一行一个字符串: - 如果 $s[l_1, r_1]$ 的字典序更小,请输出 $\texttt{yifusuyi}$。 - 如果 $t[l_2, r_2]$ 的字典序更小,请输出 $\texttt{erfusuer}$。 - 如果两者的字典序一样大,请输出 $\texttt{ovo}$。 [samples] ## Background 在这个问题中,我们用 $s[x,y]$ 表示从字符串 $s$ 的第 $x$ 个字符到第 $y$ 个字符连起来构成的字符串。例如,若 $s = \texttt{abcdef}$,则 $s[2,4] = \texttt{bcd}$。 ## Note ### 数据规模与约定 以下用 $|s|$ 表示 $s$ 的长度,$|t|$ 表示 $t$ 的长度。 - 对 $30\%$ 的数据,$|s| = |t| = 1$。 - 对 $60\%$ 的数据,$q = 1$。 - 对 $100\%$ 的数据,$1 \leq |s|, |t|, q \leq 10^3$,$1 \leq l_1 \leq r_1 \leq |s|$,$1 \leq l_2 \leq r_2 \leq |t|$。输入字符串仅含大小写英文字母。
Samples
Input #1
Yifusuyi
yifusuYi
3
1 2 7 8
1 2 1 2
7 8 7 8
Output #1
ovo
yifusuyi
erfusuer
API Response (JSON)
{
  "problem": {
    "name": "[语言月赛202305] 制糊串",
    "description": {
      "content": "给出两个字符串 $s$ 和 $t$,有 $q$ 次询问。 每次给出 $l_1, r_1$ 和 $l_2, r_2$,请判断 $s[l_1, r_1]$ 和 $t[l_2, r_2]$ 谁的字典序更小。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB3769"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给出两个字符串 $s$ 和 $t$,有 $q$ 次询问。\n\n每次给出 $l_1, r_1$ 和 $l_2, r_2$,请判断 $s[l_1, r_1]$ 和 $t[l_2, r_2]$ 谁的字典序更小。\n\n## Input\n\n第一行是一个字符串 $s$。  \n第二行是一个字符串 $t$。  \n第三行是一个整数,表示询问次数 $q$。  \n接下来 $q$ 行,每行四个整数 $l_1, r_1, l_...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments