正文
增加 2 行删除 2 行
29 行未改动30313233343536373816 行未改动55565758596061626317 行未改动29 行未改动f[u][0] = f[u][1] = f[u][2] = -inf;if(!u) return ;int lc = ls[u], rc = rs[u];dfs(lc), dfs(rc);MAX(f[u][0], f[lc][0]), MAX(f[u][1], f[rc][1]);if(c[u] != 'R') MAX(f[u][0], max(max(f[rc][0], f[lc][1]), 0) + 1);if(c[u] != 'L') MAX(f[u][1], max(max(f[lc][1], f[rc][0]), 0) + 1);16 行未改动while(st && p[stk[st]] < p[i]) --st;if(st) rs[stk[st]] = i;ls[i] = stk[st + 1];stk[++st] = i, stk[st + 1] = 0;}rot = stk[1];for(int i = ls[rot]; i; i = ls[i]){if(c[i] == 'L') {puts("-1"); return ;}if(c[i] == '?') c[i] = 'R';17 行未改动29 行未改动30313233343536373816 行未改动55565758596061626317 行未改动29 行未改动f[u][0] = f[u][1] = f[u][2] = -inf;if(!u) return ;int lc = ls[u], rc = rs[u];dfs(lc), dfs(rc);MAX(f[u][0], f[lc][0]), MAX(f[u][1], f[rc][1]);if(c[u] != 'R') MAX(f[u][0], max(max(f[rc][0], f[lc][1]), 0) + 1);if(c[u] != 'L') MAX(f[u][1], max(max(f[lc][1], f[rc][0]), 0) + 1);16 行未改动while(st && p[stk[st]] < p[i]) --st;if(st) rs[stk[st]] = i;ls[i] = stk[st + 1];stk[++st] = i, stk[st + 1] = 0;}rot = stk[1];for(int i = ls[rot]; i; i = ls[i]){if(c[i] == 'L') {puts("-1"); return ;}if(c[i] == '?') c[i] = 'R';17 行未改动