Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
34395 | swzzzz | 【S】T1 | C++ | 运行出错 | 0 | 0 MS | 256 KB | 687 | 2024-11-07 18:35:44 |
#include<bits/stdc++.h> using namespace std; #define N 1000006 int n; bool s[N]; int r[N],t[N]; bool d[N]; char ch; long long ans; bool now; int main(){ freopen("poker.in","r",stdin); freopen("poker.out","w",stdout); cin>>n; cin>>ch; s[1]=(ch=='1'); for(int i=2;i<=n;i++){ ch=getchar(); s[i]=(ch=='1'); } for(int i=1;i<=n;i++){ scanf("%d",&r[i]); } for(int i=1;i<=n;i++){ scanf("%d",&t[i]); } for(int i=1;i<=n;i++){ if(now!=s[i]){ ans+=t[i]; now^=1; d[r[i]]^=1; } now^=d[i]; } cout<<ans; return 0; }