ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#214861 | #2704. Layered Graph | nodgd | 0 | 163ms | 2564kb | C++11 | 2.0kb | 2024-11-22 20:07:04 | 2024-11-22 23:13:44 |
answer
#include <bits/stdc++.h>
using namespace std;
const int BUFFER_SIZE = 1 << 20;
char rb[BUFFER_SIZE], *rp = rb, *rt = rb;
inline char read_char() {
return rp == rt ? (rt = rb + fread(rb, 1, BUFFER_SIZE, stdin), rp = rb, *rp ++) : *rp ++;
}
inline int read_int() {
int x = 0;
char ch = read_char(), flag = 0;
while (ch != '-' && (ch < '0' || ch > '9')) {
ch = read_char();
}
if (ch == '-') {
flag = 1;
ch = read_char();
}
for (x = 0; ch >= '0' && ch <= '9'; ch = read_char()) {
x = x * 10 + (ch - '0');
}
return flag ? -x : x;
}
typedef long long i64;
const int MAX_N = 100000 + 5;
const int MAX_M = 50 + 5;
const int P = 1000000007;
const i64 PP = 8ll * P * P;
int T, N, L, M;
int b[MAX_N], fa[MAX_M], fb[MAX_M], fc[MAX_M];
void multi_mod_f_eq(int a[], int b[]) {
static i64 t[MAX_M << 1];
for (int i = 0; i < M; i ++) {
for (int j = 0; j < M; j ++) {
t[i + j] += 1ll * a[i] * b[j];
t[i + j] -= t[i + j] >= PP ? PP : 0;
}
}
for (int i = 0; i < M; i ++) {
a[i] = (t[i] + t[i + M]) % P;
t[i] = t[i + M] = 0;
}
}
void power_mod_f_eq(int a[], int b) {
static int c[MAX_M];
for (int i = 0; i < M; i ++) c[i] = !i;
for (; b; b >>= 1) {
if (b & 1) multi_mod_f_eq(c, a);
multi_mod_f_eq(a, a);
}
for (int i = 0; i < M; i ++) a[i] = c[i];
}
int main() {
for (T = read_int(); T --; ) {
N = read_int(), L = read_int(), M = read_int();
for (int i = 1; i <= N; i ++) fa[read_int()] ++;
for (int i = 1; i <= N; i ++) fb[b[i] = read_int()] ++;
for (int i = 1; i <= N; i ++) fc[b[i] += read_int(), b[i] -= b[i] >= M ? M : 0] ++;
power_mod_f_eq(fb, L - 2);
multi_mod_f_eq(fc, fb);
multi_mod_f_eq(fc, fa);
printf("%d\n", fc[0]);
for (int i = 0; i < M; i ++) fa[i] = fb[i] = fc[i] = 0;
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1164kb
input:
5 100 100 50 32 12 11 9 9 18 31 21 7 6 44 30 18 48 24 11 23 2 45 46 24 14 22 28 18 15 3 10 42 5 41 1...
output:
890147134 746643217 417578554 -790413349 938572720
result:
wrong answer 1st lines differ - expected: '256484961', found: '890147134'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 1160kb
input:
5 100 100 50 27 42 2 20 37 40 45 34 17 5 6 49 12 35 44 25 12 48 25 2 38 24 16 44 0 45 26 4 0 6 7 47 ...
output:
143696625 545169722 84383945 649650134 62556876
result:
wrong answer 1st lines differ - expected: '268228217', found: '143696625'
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 1160kb
input:
5 100 100 50 10 2 23 18 49 11 5 18 7 22 33 7 20 9 16 9 25 12 18 19 22 13 2 17 9 12 17 29 19 3 45 20 ...
output:
838303459 375881959 -846496894 773346987 -92665796
result:
wrong answer 1st lines differ - expected: '368262031', found: '838303459'
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 1160kb
input:
5 100 100 50 35 28 4 22 33 20 44 41 27 32 30 43 43 30 45 13 35 21 28 47 15 10 18 14 41 23 19 11 23 4...
output:
-670044952 83086787 -711285245 668505859 267864022
result:
wrong answer 1st lines differ - expected: '631584619', found: '-670044952'
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 1160kb
input:
5 100 100 50 47 10 10 0 35 38 41 29 40 48 32 19 34 3 39 3 4 27 13 7 4 27 32 40 30 29 22 11 29 13 10 ...
output:
213405120 977512824 192321726 -868191597 728608541
result:
wrong answer 1st lines differ - expected: '88526727', found: '213405120'
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 1160kb
input:
5 100 100 50 21 49 36 14 4 38 28 34 36 37 39 29 47 10 15 36 47 43 37 22 35 1 17 27 12 28 14 21 9 42 ...
output:
951501962 603042866 -863309532 532528776 115412542
result:
wrong answer 1st lines differ - expected: '213489050', found: '951501962'
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 1160kb
input:
5 100 100 50 34 31 10 31 39 11 33 41 43 22 7 32 12 8 34 16 15 22 44 49 44 14 47 35 20 37 49 42 19 13...
output:
680831953 274809855 507806168 258628136 -701208050
result:
wrong answer 1st lines differ - expected: '946958806', found: '680831953'
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 1160kb
input:
5 100 100 50 14 18 43 4 22 31 33 34 46 1 4 41 12 5 10 19 20 49 5 31 48 23 46 31 36 26 39 22 20 21 1 ...
output:
974949768 88206918 670693658 136920452 60007047
result:
wrong answer 1st lines differ - expected: '458596684', found: '974949768'
Test #9:
score: 0
Wrong Answer
time: 15ms
memory: 2560kb
input:
5 100000 100000 50 23 34 28 46 34 18 36 20 26 10 12 25 30 41 19 17 26 1 28 35 24 22 10 27 39 42 0 49...
output:
-84244061 -214865975 -911258980 622933887 -681642785
result:
wrong answer 1st lines differ - expected: '70561313', found: '-84244061'
Test #10:
score: 0
Wrong Answer
time: 15ms
memory: 2564kb
input:
5 100000 100000 50 14 1 21 5 17 40 34 12 40 31 7 42 36 36 0 21 20 25 5 10 19 5 34 39 43 45 5 11 14 2...
output:
-688641578 841953490 349067214 -141532948 -938054689
result:
wrong answer 1st lines differ - expected: '994268276', found: '-688641578'
Test #11:
score: 0
Wrong Answer
time: 15ms
memory: 2564kb
input:
5 100000 100000 50 18 48 15 0 26 18 8 33 13 33 33 45 24 12 31 34 38 47 48 43 34 24 28 35 34 10 22 14...
output:
638960906 803296335 81440336 -883496766 243129652
result:
wrong answer 1st lines differ - expected: '748222759', found: '638960906'
Test #12:
score: 0
Wrong Answer
time: 15ms
memory: 2560kb
input:
5 100000 100000 50 29 39 33 23 21 22 32 39 49 32 31 23 21 21 45 48 12 31 48 22 33 14 28 5 4 26 33 20...
output:
705764549 -816972547 -618152100 -122284593 -113814487
result:
wrong answer 1st lines differ - expected: '360713362', found: '705764549'
Test #13:
score: 0
Wrong Answer
time: 11ms
memory: 2560kb
input:
5 100000 100000 50 3 33 0 45 27 19 16 21 11 46 14 8 8 18 38 24 44 22 34 18 38 41 20 22 11 10 34 24 4...
output:
85869581 765766826 -665974772 246355422 -551947485
result:
wrong answer 1st lines differ - expected: '557420187', found: '85869581'
Test #14:
score: 0
Wrong Answer
time: 8ms
memory: 2560kb
input:
5 100000 100000 50 41 7 15 45 21 32 10 8 8 2 35 22 45 39 40 39 14 11 44 32 37 8 34 48 49 5 7 42 22 1...
output:
-399313206 -134798203 -140637510 -27524396 -784066180
result:
wrong answer 1st lines differ - expected: '926016839', found: '-399313206'
Test #15:
score: 0
Wrong Answer
time: 15ms
memory: 2564kb
input:
5 100000 100000 50 16 41 15 33 12 46 37 15 33 27 47 8 44 30 33 9 38 2 6 14 42 45 15 20 3 29 27 27 36...
output:
515236176 888198910 -369840951 -367858330 361510589
result:
wrong answer 1st lines differ - expected: '591140332', found: '515236176'
Test #16:
score: 0
Wrong Answer
time: 16ms
memory: 2560kb
input:
5 100000 100000 50 45 7 6 5 46 1 1 7 35 32 47 12 32 23 39 33 29 14 26 44 21 26 6 13 34 2 19 46 44 20...
output:
-395310507 -143296417 907008891 991160169 -851330924
result:
wrong answer 1st lines differ - expected: '643992931', found: '-395310507'
Test #17:
score: 0
Wrong Answer
time: 11ms
memory: 2560kb
input:
5 100000 100000 50 14 6 40 39 26 11 25 8 20 39 42 15 42 47 1 49 32 42 6 30 37 38 47 44 42 38 37 27 1...
output:
667120381 304950287 584077526 168798478 -923076066
result:
wrong answer 1st lines differ - expected: '693284936', found: '667120381'
Test #18:
score: 0
Wrong Answer
time: 15ms
memory: 2564kb
input:
5 100000 100000 50 40 33 35 43 48 35 38 43 23 17 41 48 40 8 13 8 31 48 13 29 39 16 38 11 15 42 34 21...
output:
618334032 -90530807 100188974 974592538 716279212
result:
wrong answer 1st lines differ - expected: '265244724', found: '618334032'
Test #19:
score: 0
Wrong Answer
time: 12ms
memory: 2560kb
input:
5 100000 100000 50 39 21 5 26 26 38 41 15 33 11 14 42 49 41 38 37 42 1 40 41 37 17 19 29 12 26 13 30...
output:
926806486 65747418 183406444 -220578024 -556311988
result:
wrong answer 1st lines differ - expected: '422422628', found: '926806486'
Test #20:
score: 0
Wrong Answer
time: 15ms
memory: 2564kb
input:
5 100000 100000 50 28 45 35 35 47 2 9 38 25 34 44 42 4 20 15 28 11 46 21 41 19 46 30 15 49 46 0 35 3...
output:
367101664 326250362 -292720380 466227716 -273435885
result:
wrong answer 1st lines differ - expected: '825400868', found: '367101664'