ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213544 | #2770. 子序列 | yiwei | 0 | 2787ms | 40280kb | C++11 | 652b | 2024-11-12 20:30:36 | 2024-11-12 23:31:02 |
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, P = 998244353;
int n,m,a[N];
long long f[N][25];
int main(){
cin >> n >> m;
for (int i = 1;i <= n;i++) cin >> a[i], a[i] %= m;
int q; cin >> q;
while (q--){
int l,r;
cin >> l >> r;
memset(f[l - 1],0,sizeof(f));
f[l - 1][0] = 1;
for (int i = l;i <= r;i++){
for (int j = 0;j < m;j++)
f[i][j] = f[i - 1][j];
for (int j = 0;j < m;j++){
(f[i][(j + a[i]) % m] += f[i - 1][j]) %= P;
}
}
cout << f[r][0] << '\n';
}
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 51ms
memory: 40264kb
input:
10 20 7 5 5 1 7 13 19 10 2 7 10 10 10 6 7 6 8 4 10 8 9 5 8 6 10 5 5 2 6 6 8
output:
2 4 8 128 4 16 32 2 32 8
result:
wrong answer 1st lines differ - expected: '1', found: '2'
Test #2:
score: 0
Wrong Answer
time: 56ms
memory: 40260kb
input:
10 20 15 0 15 10 6 18 1 13 3 1 10 1 2 4 9 3 7 4 8 6 10 2 3 1 4 2 5 2 9 5 9
output:
2 64 32 32 32 4 16 16 256 32
result:
wrong answer 2nd lines differ - expected: '4', found: '64'
Test #3:
score: 0
Wrong Answer
time: 56ms
memory: 40264kb
input:
10 20 8 9 17 13 10 13 16 11 19 3 10 6 9 3 9 2 6 1 10 5 10 6 10 4 5 2 4 10 10 3 5
output:
16 128 32 1024 64 32 4 8 2 8
result:
wrong answer 1st lines differ - expected: '2', found: '16'
Test #4:
score: 0
Wrong Answer
time: 57ms
memory: 40260kb
input:
10 20 12 8 11 1 0 3 2 3 19 17 10 5 7 1 3 1 10 2 6 4 10 5 9 5 9 3 10 4 8 4 8
output:
8 8 1024 32 128 32 32 256 32 32
result:
wrong answer 1st lines differ - expected: '2', found: '8'
Test #5:
score: 0
Wrong Answer
time: 59ms
memory: 40260kb
input:
10 20 7 0 2 2 8 12 10 7 1 2 10 9 9 6 9 3 7 3 8 1 6 2 4 6 8 4 5 1 6 8 9
output:
2 16 32 64 64 8 8 4 64 4
result:
wrong answer 1st lines differ - expected: '1', found: '2'
Test #6:
score: 0
Wrong Answer
time: 518ms
memory: 40276kb
input:
100 20 3 15 11 17 7 9 16 11 6 0 1 1 19 15 18 0 14 12 17 9 19 12 18 9 4 14 11 5 18 10 4 18 14 8 14 8 ...
output:
64 32 1048576 32 131961968 33554432 796434976 16495246 150994942 65980984 491011688 2097152 32768 41...
result:
wrong answer 1st lines differ - expected: '2', found: '64'
Test #7:
score: 0
Wrong Answer
time: 500ms
memory: 40276kb
input:
100 20 3 7 17 4 9 6 6 15 18 1 3 5 19 13 2 7 9 10 4 5 0 10 18 18 6 0 1 15 16 12 2 7 6 0 17 2 14 18 4 ...
output:
67108864 4096 932051910 199108744 965802399 134217728 128 2048 128 33554432 128 24888593 2 982023376...
result:
wrong answer 1st lines differ - expected: '3355488', found: '67108864'
Test #8:
score: 0
Wrong Answer
time: 504ms
memory: 40280kb
input:
100 20 1 11 5 10 8 2 11 14 2 11 7 4 13 4 2 1 13 4 0 13 4 8 3 12 12 17 12 13 16 2 5 12 13 0 5 11 0 7 ...
output:
527847872 256 49777186 49777186 876574883 8192 128 301989884 33554432 732135154 732135154 16384 32 6...
result:
wrong answer 1st lines differ - expected: '26391984', found: '527847872'
Test #9:
score: 0
Wrong Answer
time: 492ms
memory: 40276kb
input:
100 20 8 18 4 8 11 9 1 19 7 14 7 13 4 3 14 0 10 3 13 16 2 5 17 18 7 10 7 3 19 1 16 18 7 13 19 13 2 1...
output:
16384 512 524288 301989884 512 8192 889190246 150994942 65536 301989884 263923936 2048 4194304 67108...
result:
wrong answer 1st lines differ - expected: '804', found: '16384'
Test #10:
score: 0
Wrong Answer
time: 494ms
memory: 40276kb
input:
100 20 17 1 13 11 0 8 12 2 4 15 14 18 6 6 5 16 18 4 6 19 4 0 4 6 10 19 5 4 18 17 14 16 3 0 1 6 2 4 0...
output:
382013690 150994942 360709869 1024 67108864 679477111 8192 263923936 4 251622994 125811497 128 79643...
result:
wrong answer 1st lines differ - expected: '107223667', found: '382013690'
Test #11:
score: 0
Time Limit Exceeded
input:
1000 20 7 14 19 15 16 8 19 15 5 5 6 3 4 16 0 1 7 6 14 3 12 2 4 5 16 12 12 8 1 9 6 13 4 10 12 16 11 7...
output:
929481727 655792299 826297814 144574546 965802399 270436362 384382042 286928079 780136139 406565024 ...
result:
Test #12:
score: 0
Time Limit Exceeded
input:
1000 20 16 7 12 15 13 10 8 1 14 16 13 6 16 7 4 11 0 17 6 3 4 8 17 10 3 11 18 13 17 19 15 4 7 17 12 4...
output:
256 529810407 432485106 590413701 649489104 813130048 1048576 598713554 696417411 247454103 81313004...
result:
Test #13:
score: 0
Time Limit Exceeded
input:
1000 20 7 7 16 0 12 6 11 3 7 16 12 11 1 7 17 0 11 8 14 17 8 17 7 18 1 11 14 0 6 5 10 0 12 15 1 4 5 1...
output:
661026228 366067577 731696071 889190246 216242553 930295578 243588435 283185864 494274524 659759919 ...
result:
Test #14:
score: 0
Time Limit Exceeded
input:
1000 20 19 3 14 11 9 17 18 4 11 5 0 18 2 11 13 12 8 10 15 19 12 9 2 15 5 19 14 17 17 7 18 5 2 8 5 0 ...
output:
494908206 578298184 211365238 980288762 566371728 648800565 162897223 918448003 263631309 682155965 ...
result:
Test #15:
score: 0
Time Limit Exceeded
input:
1000 20 16 19 4 2 2 19 19 5 11 4 16 7 17 6 11 11 7 10 6 3 15 1 11 12 5 11 12 13 3 10 12 2 19 9 4 8 6...
output:
657620395 491462366 935971740 309520444 268998206 239837423 675546334 613524059 930295578 837180163 ...
result:
Test #16:
score: 0
Runtime Error
input:
10000 20 12 8 12 19 9 19 1 10 19 11 12 10 19 5 0 16 17 1 9 18 18 13 6 0 14 16 6 6 3 6 17 2 13 19 13 ...
output:
429968870 827018326 382468373 826720889 47790502 437613805
result:
Test #17:
score: 0
Runtime Error
input:
10000 20 8 15 6 17 5 13 11 1 7 9 16 16 15 12 4 19 18 2 3 10 13 15 12 5 3 6 15 2 0 11 8 19 13 18 12 1...
output:
292840345 279657501 309774269
result:
Test #18:
score: 0
Runtime Error
input:
10000 20 0 9 6 6 17 19 11 13 18 14 0 10 3 0 0 11 12 11 2 19 18 12 13 16 8 7 14 12 10 2 7 3 4 18 10 1...
output:
result:
Test #19:
score: 0
Runtime Error
input:
10000 20 5 13 8 2 2 13 16 17 9 8 15 10 1 12 2 18 19 1 0 17 9 7 16 14 0 9 19 14 13 3 19 17 5 3 19 17 ...
output:
result:
Test #20:
score: 0
Runtime Error
input:
10000 20 5 8 19 15 4 8 12 14 4 5 16 13 17 9 3 3 15 4 15 19 17 8 14 16 16 13 19 18 19 7 13 5 11 11 12...
output:
1024 60640429 445505540
result:
Test #21:
score: 0
Runtime Error
input:
200000 20 11 5 3 3 2 9 10 10 15 4 19 1 3 0 19 19 15 0 0 12 14 16 1 8 3 18 10 6 14 11 2 7 17 2 0 1 12...
output:
result:
Test #22:
score: 0
Runtime Error
input:
200000 20 13 15 5 3 2 0 3 4 6 16 14 0 4 11 8 10 18 5 3 12 1 7 2 16 13 19 16 16 3 16 6 8 2 6 10 0 13 ...
output:
result:
Test #23:
score: 0
Runtime Error
input:
200000 20 15 8 8 12 19 10 4 14 16 6 3 17 13 4 14 17 5 15 19 4 0 3 17 5 4 9 14 19 10 11 9 13 0 3 18 0...
output:
result:
Test #24:
score: 0
Runtime Error
input:
200000 20 11 4 7 18 16 15 15 18 11 2 4 1 17 18 6 9 19 12 2 14 8 6 10 4 15 16 17 13 18 1 15 18 15 9 1...
output:
result:
Test #25:
score: 0
Runtime Error
input:
200000 20 5 3 18 11 17 13 14 19 0 0 1 3 4 13 8 1 15 7 15 2 12 8 3 15 8 1 4 8 7 5 9 16 9 16 0 14 2 16...
output:
402597818