登录—专业IT笔试面试备考平台_牛客网
牛客练习赛100题解_ACM竞赛_ACM/CSP/ICPC/CCPC/比赛经验/题解/资讯_牛客竞赛OJ_牛客网
#includeusing namespace std; using ll=long long; const int N=2e5+10; ll n,a[N],col[N]; ll dp[2][2]; int main() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); cin>>n; for (int i=1; i<=n; ++i) cin>>a[i]; for (int i=1; i<=n; ++i) { char x; cin>>x; col[i]=(x=='R'?1:0); } for (int i=1; i<=n; ++i){ int x=a[i]&1;//奇偶性 int y=col[i];//颜色性 dp[x][y]=max(dp[x][y],dp[!x][!y]+a[i]); } cout<



