「MYOI-R3」字符串

Luogu
IDLGP10442
Time1000ms
Memory512MB
DifficultyP1
模拟字符串洛谷原创O2优化洛谷月赛
给定字符串 $s,t$。 现在你要在 $s,t$ 中删除一些字符并将它们重新排列使 $s=t$。 问操作后的 $|s|$(即字符串 $s$ 的长度)最大是多少? ## Input 第一行一个字符串 $s$。 第二行一个字符串 $t$。 ## Output 一行一个整数,表示操作后的 $|s|$ 的最大值。 [samples] ## Note 在第一个样例中,将 `a` 删除,留下 `bc`。 此时 $|s|=2$,可以证明这是最优解。 在第二个样例中,将 `aaaaa` 删除,留下空串。 将 `bbbbb` 删除,留下空串。 此时 $|s|=0$,可以证明这是最优解。 **本题采用捆绑测试**。 记 $n=\max(|s|,|t|)$。 | $\text{Subtask}$ | $n\le $| 特殊性质 |总分值 | | :--------------: | :-----: |:-----:|:--------: | | $1$ | $10$ | 无 | $25$ | $2$ | $10^5$ | $\text{A}$| $25$ | | $3$ | $10^5$ | $\text{B}$ | $25$ | | $4$ | $10^5$ | 无 | $25$ | 对于 $100\%$ 的数据,$1 \le |s|,|t| \le 10^5$,字符串均由小写字母组成。 特殊性质 $\text{A}$:$s$ 是一个 $\text{a}\sim\text{z}$ 的排列。 特殊性质 $\text{B}$:保证 $s_i,t_i\in\{\text{a},\text{b} \}$。
Samples
Input #1
abc
bc
Output #1
2
Input #2
aaaaa
bbbbb
Output #2
0
API Response (JSON)
{
  "problem": {
    "name": "「MYOI-R3」字符串",
    "description": {
      "content": "给定字符串 $s,t$。 现在你要在 $s,t$ 中删除一些字符并将它们重新排列使 $s=t$。 问操作后的 $|s|$(即字符串 $s$ 的长度)最大是多少?",
      "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": "LGP10442"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给定字符串 $s,t$。\n\n现在你要在 $s,t$ 中删除一些字符并将它们重新排列使 $s=t$。\n\n问操作后的 $|s|$(即字符串 $s$ 的长度)最大是多少?\n\n## Input\n\n第一行一个字符串 $s$。\n\n第二行一个字符串 $t$。\n\n## Output\n\n一行一个整数,表示操作后的 $|s|$ 的最大值。\n\n[samples]\n\n## Note\n\n在第一个样例中,将 `a` 删除,留...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments