#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define _SIZE_ 100000
char _b[_SIZE_],*_b1,*_b2;
#define getc() (_b1==_b2?fread(_b,1,_SIZE_,stdin),_b2=_b+_SIZE_,*((_b1=_b)++):*(_b1++))
#define read(__x) {register signed _x(0);register char _c=getc(),_f(0);for(;_c<47;_c=getc())_f=(_c==45);for(;_c>47;_c=getc())_x=_x*10+(_c^48);_f&&(_x=-_x),__x=_x;}
char _d[_SIZE_],*_p=_d;
#define putc(__c) (_p-_d==_SIZE_?fwrite(_d,1,_SIZE_,stdout),_p=_d,*_p++=__c:*_p++=__c)
#define write(__x) {register signed _x=__x;(_x<0)&&(putc(45),_x=-_x);static signed _q[11];register char _t=0;do{_q[_t++]=_x%10,_x/=10;}while(_x);while(_t)putc(_q[--_t]+48);}
#define fwflush() (fwrite(_d,1,_p-_d,stdout),_p=_d)
#define pi 3.14159265358979323846
struct C
{
double x,y;
C operator+(const C b)const{return {x+b.x,y+b.y};}
C operator-(const C b)const{return {x-b.x,y-b.y};}
C operator*(const C b)const{return {x*b.x-y*b.y,x*b.y+y*b.x};}
};
using namespace std;
int tmp1,n,m,N;
void fft(C*a,int n,int fl)
{
if(n==1)return;
int mid=n>>1;
C b[n],x__={1,0},x_={cos(2*pi/n),sin(2*pi/n)};;
for(int i=0;i<mid;i++)b[i]=a[i<<1];
for(int i=0;i<mid;i++)b[i|mid]=a[i<<1|1];
fft(b,mid,fl),fft(b+mid,mid,fl);
for(int i=0;i<mid;i++,x__=x__*x_)
{
C x(b[i+mid]*(C){x__.x,fl*x__.y});
a[i]=b[i]+x,a[i+mid]=b[i]-x;
}
}
C a[1<<21];
int main()
{
read(n);read(m);++n,++m,N=min(1<<21,1<<(int)(log2(n+m)+1));
for(int i=0;i<n;i++)read(a[i].x);
for(int i=0;i<m;i++)read(a[i].y);
fft(a,N,1);
for(int i=0;i<N;i++)a[i]=a[i]*a[i];
fft(a,N,-1);
for(int i=0;i<n+m-1;i++){write((int)round(a[i].y/N/2));putc(32);}
fwflush();
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Subtask #1 Testcase #1 | 36.71 us | 48 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #2 | 44.811 ms | 13 MB + 664 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #3 | 19.467 ms | 6 MB + 516 KB | Accepted | Score: 100 | 显示更多 |
| Subtask #1 Testcase #4 | 19.585 ms | 6 MB + 504 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #5 | 37.87 us | 48 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #6 | 37.2 us | 48 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #7 | 36.99 us | 48 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #8 | 43.888 ms | 13 MB + 396 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #9 | 43.904 ms | 13 MB + 396 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #10 | 42.999 ms | 13 MB + 128 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #11 | 45.087 ms | 13 MB + 744 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #12 | 41.287 ms | 12 MB + 624 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #13 | 36.35 us | 48 KB | Accepted | Score: 0 | 显示更多 |