提交记录 13345
| 提交时间 |
评测时间 |
| 2020-08-01 11:21:29 |
2020-08-01 11:21:34 |
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn = 2e6 + 100;
const double pi = acos(-1);
struct complex{
double x,y;
complex operator + (const complex &rhs)const{return complex{x + rhs.x,y + rhs.y};}
complex operator - (const complex &rhs)const{return complex{x - rhs.x,y - rhs.y};}
complex operator * (const complex &rhs)const{return complex{x * rhs.x - y * rhs.y,x * rhs.y + y * rhs.x};}
}F[maxn << 1],G[maxn << 1];
int tr[maxn << 1],n,m;
inline void fft(complex *f,int flag){
for(int i = 0;i < n;i++)
if(i < tr[i])swap(f[i],f[tr[i]]);
for(int p = 2;p <= n;p <<= 1){
int len = p >> 1;
complex unit{cos(2 * pi / p),sin(2 * pi / p) * flag};
for(int k = 0;k < n;k += p){
complex g{1,0};
for(int l = k;l < k + len;l++){
complex t = f[l + len] * g;
f[l + len] = f[l] - t;
f[l] = f[l] + t;
g = g * unit;
}
}
}
}
int main(){
scanf("%d %d",&n,&m);
for(int i = 0;i <= n;i++)scanf("%lf",&F[i].x);
for(int i = 0;i <= m;i++)scanf("%lf",&G[i].x);
for(m += n,n = 1;n <= m;n <<= 1);
for(int i = 0;i < n;i++)
tr[i] = (tr[i >> 1] >> 1) | ((i & 1) ? (n >> 1) : 0);
fft(F,1),fft(G,1);
for(int i = 0;i < n;i++)F[i] = F[i] * G[i];
fft(F,-1);
for(int i = 0;i <= m;i++)printf("%d ",(int)(F[i].x / n + 0.49));
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Subtask #1 Testcase #1 | 11.03 us | 36 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #2 | 67.967 ms | 10 MB + 464 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #3 | 30.296 ms | 4 MB + 828 KB | Accepted | Score: 100 | 显示更多 |
| Subtask #1 Testcase #4 | 30.316 ms | 4 MB + 816 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #5 | 12.62 us | 36 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #6 | 11.86 us | 36 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #7 | 11.8 us | 36 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #8 | 61.95 ms | 10 MB + 196 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #9 | 61.886 ms | 10 MB + 196 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #10 | 55.859 ms | 9 MB + 952 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #11 | 68.207 ms | 10 MB + 544 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #12 | 68.151 ms | 9 MB + 424 KB | Accepted | Score: 0 | 显示更多 |
| Subtask #1 Testcase #13 | 10.73 us | 36 KB | Accepted | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-24 12:13:01 | Loaded in 2 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠