比赛 EYOI与SBOI开学欢乐赛10th 评测结果 WWAWWAWWWW
题目名称 01串 最终得分 20
用户昵称 该账号已注销 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2022-10-10 20:27:34
显示代码纯文本
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. long long n,x,y,a[5010],b[5010],ct1=0,ct2=0;
  4. long long ans=0;
  5. string s;
  6. int main(){
  7. freopen("zerone.in","r",stdin);
  8. freopen("zerone.out","w",stdout);
  9. cin>>n>>x>>y;
  10. cin>>s;
  11. for(int i=0;i<s.length();i++){
  12. if(s[i]=='0')a[i+1]=0;
  13. else a[i+1]=1,ct1++;
  14. }
  15. cin>>s;
  16. for(int i=0;i<s.length();i++){
  17. if(s[i]=='0')b[i+1]=0;
  18. else b[i+1]=1,ct2++;
  19. }
  20. if(ct1!=ct2){
  21. cout<<-1<<endl;
  22. return 0;
  23. }
  24. for(int i=1;i<=n;i++){
  25. if(a[i]!=b[i])ans+=y;
  26. }
  27. cout<<ans/2<<endl;
  28. return 0;
  29. }