| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 34395 | swzzzz | 【S】T1 | C++ | Runtime Error | 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; }