ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#214297 | #3851. 多项式乘法 | one_zero_four_zero | 60 | 193ms | 4320kb | C++11 | 653b | 2024-11-17 09:43:46 | 2024-11-17 13:05:47 |
answer
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
int N, M, Q;
long long A[200005], B[200005];
int c, d;
int main(){
#ifndef ONLINE_JUDGE
freopen("../data.in", "r", stdin);
freopen("../data.out", "w", stdout);
#endif
scanf("%d %d %d", &N, &M, &Q);
for (int i = 0; i <= N; i ++){
scanf("%lld", &A[i]);
}
for (int i = 0; i <= N; i ++){
scanf("%lld", &B[i]);
}
while (Q --){
scanf("%d %d", &c, &d);
long long ans = 0;
for (int i = 0; i <= M / c; i ++){
int j = (M - i * c);
if (j % d) continue;
j /= d;
ans += A[i] * B[j];
}
printf("%lld\n", ans);
}
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1212kb
input:
999 996 1000 181 806 745 589 721 351 654 278 172 787 785 328 876 63 436 237 822 649 932 55 332 99 13...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 1000 tokens
Test #2:
score: 10
Accepted
time: 0ms
memory: 1212kb
input:
999 999 998 629 817 295 274 803 741 680 334 314 300 960 880 958 153 650 621 830 812 753 954 925 128 ...
output:
0 0 0 0 0 573534 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 998 tokens
Test #3:
score: 10
Accepted
time: 0ms
memory: 1212kb
input:
999 1000 996 405 332 85 45 221 452 98 110 660 639 88 132 660 917 688 160 46 739 398 344 813 746 593 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 87480 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 996 tokens
Test #4:
score: 10
Accepted
time: 0ms
memory: 1216kb
input:
1000 998 998 166 218 178 246 965 67 723 748 446 558 450 939 19 72 123 256 942 873 269 573 991 463 68...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 998 tokens
Test #5:
score: 10
Accepted
time: 93ms
memory: 4320kb
input:
199997 199999 199998 1302 180172 139335 170014 31751 7467 183386 71639 67797 140829 155107 61564 984...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 199998 tokens
Test #6:
score: 10
Accepted
time: 100ms
memory: 4320kb
input:
199997 199997 200000 84501 46291 64694 156236 116548 147672 10286 54151 157755 190434 70365 145475 1...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 200000 tokens
Test #7:
score: 0
Time Limit Exceeded
input:
200000 199996 199997 10072 125769 117200 152038 170661 109407 73931 21884 144280 181053 47148 44210 ...
output:
334685832754280 2006121597481107 2006121597481107 334685832754280 1003645394194469 1003985461234743 ...
result:
Test #8:
score: 0
Time Limit Exceeded
input:
200000 200000 200000 94005 71739 112951 57403 31797 74173 113981 44673 166545 101677 135207 32182 50...
output:
331980465051390 665207656334083 331980465051390 667144879609525 995955892733627 665207656334083 6671...
result:
Test #9:
score: 0
Time Limit Exceeded
input:
199997 199998 199997 114782 89426 5154 72561 99785 66889 106549 2708 46310 108849 58268 188339 12902...
output:
668064176928395 1006036966789885 1002037134949456 2007398588671654 332516419084262 1006036966789885 ...
result:
Test #10:
score: 0
Time Limit Exceeded
input:
199998 199997 199997 194270 184004 139383 148257 117737 8328 66533 187509 47247 118806 176038 42976 ...
output:
1999294464955238 1999294464955238 0 329637326523124 1000882324376412 0 666546849218999 6665468492189...