#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxn = 3e5+5;
const ll mod = 1e9+7; ll n;
ll a[maxn], b[maxn];
void fwt(ll *a)
{
for(ll d=1;d<n;d<<=1)
for(ll m=d<<1,i=0;i<n;i+=m)
for(ll j=0;j<d;j++)
{
ll x=a[i+j],y=a[i+j+d];
a[i+j]=(x+y)%mod,a[i+j+d]=(x-y+mod)%mod;
//xor:a[i+j]=x+y,a[i+j+d]=x-y;
//and:a[i+j]=x+y;
//or:a[i+j+d]=x+y;
}
} ll qw(ll a, ll b){
ll res = 1;
while(b){
if (b&1) res = res*a%mod;
a = a*a%mod;
b >>= 1;
}
return res;
} int main () {
cin >> n; for(ll i = 0; i < n; i++){
scanf("%lld", &a[i]);
}
for(ll i = 0; i < n; i++){
scanf("%lld", &b[i]);
}
fwt(a); fwt(b);
for(ll i = 0; i < n; i++){
if (a[i] != 0){
b[i] = b[i]*qw(a[i], mod-2)%mod;
}
}
fwt(b);
for(ll i = 0; i < n; i++){
b[i] = b[i]*qw(n, mod-2)%mod;
printf("%lld\n", b[i]);
} return 0;
}

最新文章

  1. 我为NET狂群福利:逆天常用的一些谷歌浏览器插件
  2. 39个让你受益的HTML5教程
  3. 如何使用Log4net创建日志及简单扩展
  4. 每天一个linux命令(37):date命令
  5. csuoj 1503: 点到圆弧的距离
  6. Codeforces 451E Devu and Flowers(组合计数)
  7. redis的info
  8. test generation和MBIST
  9. HDU 4648 Magic Pen 6 思路
  10. 如何在Xilinx ISE中使用TCL提高工作效率
  11. VS2010项目转化为VS2008项目
  12. 颜色矩阵 滤镜 ColorMatrix
  13. Ansible hostvars
  14. golang从简单的即时聊天来看架构演变
  15. 关于spring boot中 EmbeddedServletContainerCustomizer
  16. net core体系-API-1Ocelot-(2)继续深入
  17. 再谈一次关于Java中的 AIO(异步IO) 与 NIO(非阻塞IO)
  18. .NetCore Session.Redis (转载)
  19. 软工第三次作业 -- 结对之AutoCS1.0
  20. eclipse设置字体、字符编码、快捷键

热门文章

  1. HDU 2871&quot;Memory Control&quot;(线段树区间和并+set.lower_bound)
  2. H3C 各类路由默认优先级
  3. linux内核符号表
  4. 开源项目使用 appveyor 自动构建
  5. 51nod 1832 前序后序遍历
  6. 2018-2-13-win10-uwp-从Type使用构造
  7. redis scan count的含义/二进制安全问题
  8. 利用Aspose.cells 将查询出的数据导出为excel,并在浏览器中下载。
  9. 通过Servlet生成验证码图片(转)
  10. 从头学pytorch(三) 线性回归