标签:using end rop 思路 push ref click nbsp title
题目链接:http://codeforces.com/contest/1230/problem/D
1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int N=1e5; 5 ll arr1[N]; 6 ll arr2[N]; 7 ll vis[N]; 8 map<ll,ll>cnt; 9 vector<ll >arr; 10 int main(){ 11 ll n,l; 12 ll ans=0; 13 cin>>n; 14 for(int i=0;i<n;i++){ 15 scanf("%lld",arr1+i); 16 cnt[arr1[i]]++; 17 } 18 for(int i=0;i<n;i++){ 19 scanf("%lld",arr2+i); 20 if(cnt[arr1[i]]>=2){ 21 vis[i]=1; 22 arr.push_back(arr1[i]); 23 ans=ans+arr2[i]; 24 } 25 } 26 for(int i=0;i<n;i++){ 27 if(vis[i]==0){ 28 l=arr.size(); 29 for(int j=0;j<l;j++){ 30 if(arr1[i]<arr[j]&&((arr1[i]&arr[j])==arr1[i])){ 31 arr.push_back(arr1[i]); 32 ans=ans+arr2[i]; 33 break; 34 } 35 } 36 } 37 } 38 cout<<ans<<endl; 39 40 41 return 0; 42 }
标签:using end rop 思路 push ref click nbsp title
原文地址:https://www.cnblogs.com/meanttobe/p/11581764.html