用 std::string 拼接的时候, txt=txt+p 会引起重复拷贝 txt ,是 O(∣S∣2)\mathcal O(|S|^2)O(∣S∣2) 的,改成 txt+=p 就可以过了
std::string
txt=txt+p
txt
txt+=p