其他分享
首页 > 其他分享> > 3082-二叉树确定

3082-二叉树确定

作者:互联网

 

 

#include <bits/stdc++.h>

std::string a, b;
std::map<char, int>mp;

void solve(int pl, int pr, int il) {
    if (pl > pr) return;
    int ipos = mp[a[pl]];
    int len = ipos - il;
    solve(pl + 1, pl + len, il);
    solve(pl + len + 1, pr, ipos + 1);
    std::cout << a[pl];
}

signed main() {
    std::cin >> a >> b;
    for (int i = 0; i < a.size(); ++i) mp[b[i]] = i;
    solve(0, a.size() - 1, 0);
    putchar('\n');
    return 0;
}

 

标签:std,pr,int,len,确定,solve,二叉树,pl,3082
来源: https://www.cnblogs.com/dolphinchan/p/16369397.html