Task: | Fibonacci towers |
Sender: | bielaltes |
Submission time: | 2024-11-18 17:21:57 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | WRONG ANSWER | 0.00 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | WRONG ANSWER | 0.00 s | details |
#10 | WRONG ANSWER | 0.00 s | details |
#11 | WRONG ANSWER | 0.00 s | details |
#12 | WRONG ANSWER | 0.00 s | details |
#13 | WRONG ANSWER | 0.00 s | details |
#14 | WRONG ANSWER | 0.00 s | details |
#15 | WRONG ANSWER | 0.00 s | details |
#16 | WRONG ANSWER | 0.00 s | details |
#17 | WRONG ANSWER | 0.00 s | details |
#18 | WRONG ANSWER | 0.00 s | details |
#19 | WRONG ANSWER | 0.00 s | details |
#20 | WRONG ANSWER | 0.00 s | details |
#21 | WRONG ANSWER | 0.00 s | details |
#22 | WRONG ANSWER | 0.00 s | details |
#23 | WRONG ANSWER | 0.00 s | details |
#24 | WRONG ANSWER | 0.00 s | details |
#25 | WRONG ANSWER | 0.00 s | details |
#26 | WRONG ANSWER | 0.00 s | details |
#27 | WRONG ANSWER | 0.00 s | details |
#28 | WRONG ANSWER | 0.00 s | details |
#29 | WRONG ANSWER | 0.00 s | details |
#30 | WRONG ANSWER | 0.00 s | details |
#31 | WRONG ANSWER | 0.00 s | details |
#32 | WRONG ANSWER | 0.00 s | details |
#33 | WRONG ANSWER | 0.00 s | details |
#34 | WRONG ANSWER | 0.00 s | details |
#35 | WRONG ANSWER | 0.00 s | details |
#36 | WRONG ANSWER | 0.00 s | details |
#37 | WRONG ANSWER | 0.00 s | details |
#38 | WRONG ANSWER | 0.00 s | details |
#39 | WRONG ANSWER | 0.01 s | details |
#40 | WRONG ANSWER | 0.00 s | details |
#41 | WRONG ANSWER | 0.00 s | details |
#42 | WRONG ANSWER | 0.00 s | details |
#43 | WRONG ANSWER | 0.00 s | details |
#44 | WRONG ANSWER | 0.00 s | details |
#45 | WRONG ANSWER | 0.00 s | details |
#46 | WRONG ANSWER | 0.00 s | details |
#47 | WRONG ANSWER | 0.00 s | details |
#48 | WRONG ANSWER | 0.00 s | details |
#49 | WRONG ANSWER | 0.00 s | details |
#50 | WRONG ANSWER | 0.00 s | details |
#51 | WRONG ANSWER | 0.00 s | details |
#52 | WRONG ANSWER | 0.00 s | details |
#53 | WRONG ANSWER | 0.00 s | details |
#54 | WRONG ANSWER | 0.00 s | details |
#55 | WRONG ANSWER | 0.00 s | details |
#56 | WRONG ANSWER | 0.00 s | details |
#57 | WRONG ANSWER | 0.00 s | details |
#58 | WRONG ANSWER | 0.00 s | details |
#59 | WRONG ANSWER | 0.00 s | details |
#60 | WRONG ANSWER | 0.00 s | details |
#61 | WRONG ANSWER | 0.00 s | details |
#62 | WRONG ANSWER | 0.00 s | details |
#63 | WRONG ANSWER | 0.00 s | details |
#64 | WRONG ANSWER | 0.00 s | details |
#65 | WRONG ANSWER | 0.00 s | details |
#66 | WRONG ANSWER | 0.00 s | details |
#67 | WRONG ANSWER | 0.00 s | details |
#68 | WRONG ANSWER | 0.00 s | details |
#69 | WRONG ANSWER | 0.00 s | details |
#70 | WRONG ANSWER | 0.00 s | details |
#71 | WRONG ANSWER | 0.00 s | details |
#72 | WRONG ANSWER | 0.00 s | details |
#73 | WRONG ANSWER | 0.00 s | details |
#74 | WRONG ANSWER | 0.00 s | details |
#75 | WRONG ANSWER | 0.00 s | details |
#76 | WRONG ANSWER | 0.00 s | details |
#77 | WRONG ANSWER | 0.00 s | details |
#78 | WRONG ANSWER | 0.00 s | details |
#79 | WRONG ANSWER | 0.00 s | details |
#80 | WRONG ANSWER | 0.00 s | details |
Code
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; long long mod_exp(long long base, long long exp, long long mod) { long long result = 1; while (exp > 0) { if (exp % 2 == 1) { result = (result * base) % mod; } base = (base * base) % mod; exp /= 2; } return result; } long long binom(vector<long long>& fact, vector<long long>& inv, int n, int k) { if (k > n || k < 0) return 0; return fact[n] * inv[k] % MOD * inv[n - k] % MOD; } int main() { int n, a, b; cin >> n >> a >> b; int max_n = b+n -1; vector<long long> fact = vector<long long>(max_n +1); vector<long long> inv = vector<long long>(max_n +1); fact[0] = 1; for (int i = 1; i <= max_n; ++i) { fact[i] = fact[i - 1] * i % MOD; } inv[max_n] = mod_exp(fact[max_n], MOD - 2, MOD); for (int i = max_n - 1; i >= 0; --i) { inv[i] = inv[i + 1] * (i + 1) % MOD; } long long result = 0; for (int k = a; k <= b; ++k) { result = (result + binom(fact, inv, k + n - 1, n - 1)) % MOD; } cout << result << endl; return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
2 10 |
correct output |
---|
89 |
user output |
---|
14919398 |
Test 2
Verdict: WRONG ANSWER
input |
---|
2 6 |
correct output |
---|
13 |
user output |
---|
14919432 |
Test 3
Verdict: WRONG ANSWER
input |
---|
2 8 |
correct output |
---|
34 |
user output |
---|
14919417 |
Test 4
Verdict: WRONG ANSWER
input |
---|
2 68 |
correct output |
---|
977351119 |
user output |
---|
14917107 |
Test 5
Verdict: WRONG ANSWER
input |
---|
2 78 |
correct output |
---|
20929410 |
user output |
---|
14916372 |
Test 6
Verdict: WRONG ANSWER
input |
---|
2 76 |
correct output |
---|
878806424 |
user output |
---|
14916527 |
Test 7
Verdict: WRONG ANSWER
input |
---|
2 485 |
correct output |
---|
908660084 |
user output |
---|
14801598 |
Test 8
Verdict: WRONG ANSWER
input |
---|
2 519 |
correct output |
---|
838514871 |
user output |
---|
14784513 |
Test 9
Verdict: WRONG ANSWER
input |
---|
2 602 |
correct output |
---|
892152152 |
user output |
---|
14737950 |
Test 10
Verdict: WRONG ANSWER
input |
---|
2 165714 |
correct output |
---|
921473843 |
user output |
---|
0 |
Test 11
Verdict: WRONG ANSWER
input |
---|
3 6 |
correct output |
---|
6 |
user output |
---|
220699477 |
Test 12
Verdict: WRONG ANSWER
input |
---|
3 8 |
correct output |
---|
13 |
user output |
---|
220699413 |
Test 13
Verdict: WRONG ANSWER
input |
---|
2 7 |
correct output |
---|
21 |
user output |
---|
14919425 |
Test 14
Verdict: WRONG ANSWER
input |
---|
3 78 |
correct output |
---|
198155624 |
user output |
---|
220617373 |
Test 15
Verdict: WRONG ANSWER
input |
---|
2 76 |
correct output |
---|
878806424 |
user output |
---|
14916527 |
Test 16
Verdict: WRONG ANSWER
input |
---|
3 49 |
correct output |
---|
83316385 |
user output |
---|
220678708 |
Test 17
Verdict: WRONG ANSWER
input |
---|
2 519 |
correct output |
---|
838514871 |
user output |
---|
14784513 |
Test 18
Verdict: WRONG ANSWER
input |
---|
3 602 |
correct output |
---|
575081686 |
user output |
---|
184156929 |
Test 19
Verdict: WRONG ANSWER
input |
---|
2 166 |
correct output |
---|
833010588 |
user output |
---|
14905592 |
Test 20
Verdict: WRONG ANSWER
input |
---|
2 187222 |
correct output |
---|
206734446 |
user output |
---|
0 |
Test 21
Verdict: WRONG ANSWER
input |
---|
2 7 |
correct output |
---|
21 |
user output |
---|
14919425 |
Test 22
Verdict: WRONG ANSWER
input |
---|
5 8 |
correct output |
---|
5 |
user output |
---|
638230234 |
Test 23
Verdict: WRONG ANSWER
input |
---|
2 8 |
correct output |
---|
34 |
user output |
---|
14919417 |
Test 24
Verdict: WRONG ANSWER
input |
---|
5 49 |
correct output |
---|
486716 |
user output |
---|
635361341 |
Test 25
Verdict: WRONG ANSWER
input |
---|
2 52 |
correct output |
---|
409340464 |
user output |
---|
14918075 |
Test 26
Verdict: WRONG ANSWER
input |
---|
5 61 |
correct output |
---|
14215310 |
user output |
---|
629971138 |
Test 27
Verdict: WRONG ANSWER
input |
---|
2 166 |
correct output |
---|
833010588 |
user output |
---|
14905592 |
Test 28
Verdict: WRONG ANSWER
input |
---|
2 188 |
correct output |
---|
914862760 |
user output |
---|
14901687 |
Test 29
Verdict: WRONG ANSWER
input |
---|
5 611 |
correct output |
---|
386811672 |
user output |
---|
71624519 |
Test 30
Verdict: WRONG ANSWER
input |
---|
4 672099 |
correct output |
---|
5039638 |
user output |
---|
0 |
Test 31
Verdict: WRONG ANSWER
input |
---|
77 10 |
correct output |
---|
1 |
user output |
---|
920497325 |
Test 32
Verdict: WRONG ANSWER
input |
---|
76 1 |
correct output |
---|
1 |
user output |
---|
440039363 |
Test 33
Verdict: WRONG ANSWER
input |
---|
80 7 |
correct output |
---|
1 |
user output |
---|
242010206 |
Test 34
Verdict: WRONG ANSWER
input |
---|
72 56 |
correct output |
---|
1 |
user output |
---|
560727186 |
Test 35
Verdict: WRONG ANSWER
input |
---|
57 97 |
correct output |
---|
42 |
user output |
---|
135900087 |
Test 36
Verdict: WRONG ANSWER
input |
---|
54 58 |
correct output |
---|
6 |
user output |
---|
13314409 |
Test 37
Verdict: WRONG ANSWER
input |
---|
50 639 |
correct output |
---|
373574336 |
user output |
---|
367306738 |
Test 38
Verdict: WRONG ANSWER
input |
---|
58 195 |
correct output |
---|
5403 |
user output |
---|
418105872 |
Test 39
Verdict: WRONG ANSWER
input |
---|
61 694 |
correct output |
---|
605984493 |
user output |
---|
888011917 |
Test 40
Verdict: WRONG ANSWER
input |
---|
9 616206422053543989 |
correct output |
---|
952862778 |
user output |
---|
0 |
Test 41
Verdict: WRONG ANSWER
input |
---|
6 169825965437345849 |
correct output |
---|
513277084 |
user output |
---|
0 |
Test 42
Verdict: WRONG ANSWER
input |
---|
5 191867851255868863 |
correct output |
---|
33742481 |
user output |
---|
0 |
Test 43
Verdict: WRONG ANSWER
input |
---|
9 625431978270398522 |
correct output |
---|
737838270 |
user output |
---|
0 |
Test 44
Verdict: WRONG ANSWER
input |
---|
8 688779226095035965 |
correct output |
---|
162344930 |
user output |
---|
0 |
Test 45
Verdict: WRONG ANSWER
input |
---|
10 802140689263714569 |
correct output |
---|
90271065 |
user output |
---|
0 |
Test 46
Verdict: WRONG ANSWER
input |
---|
6 326105735534681902 |
correct output |
---|
815511427 |
user output |
---|
0 |
Test 47
Verdict: WRONG ANSWER
input |
---|
6 714378023239269070 |
correct output |
---|
974264931 |
user output |
---|
0 |
Test 48
Verdict: WRONG ANSWER
input |
---|
8 389060406667759103 |
correct output |
---|
997632165 |
user output |
---|
0 |
Test 49
Verdict: WRONG ANSWER
input |
---|
5 752611790930241374 |
correct output |
---|
663785595 |
user output |
---|
0 |
Test 50
Verdict: WRONG ANSWER
input |
---|
9 616206422053543989 |
correct output |
---|
952862778 |
user output |
---|
0 |
Test 51
Verdict: WRONG ANSWER
input |
---|
9 616206422053543989 |
correct output |
---|
952862778 |
user output |
---|
0 |
Test 52
Verdict: WRONG ANSWER
input |
---|
10 292432805466778024 |
correct output |
---|
54188787 |
user output |
---|
0 |
Test 53
Verdict: WRONG ANSWER
input |
---|
12 877206118126603157 |
correct output |
---|
50978391 |
user output |
---|
0 |
Test 54
Verdict: WRONG ANSWER
input |
---|
15 106209626593822568 |
correct output |
---|
26611817 |
user output |
---|
0 |
Test 55
Verdict: WRONG ANSWER
input |
---|
20 599479100988098599 |
correct output |
---|
119658586 |
user output |
---|
0 |
Test 56
Verdict: WRONG ANSWER
input |
---|
19 751085324932436268 |
correct output |
---|
362164431 |
user output |
---|
0 |
Test 57
Verdict: WRONG ANSWER
input |
---|
13 653792349017119940 |
correct output |
---|
727329363 |
user output |
---|
0 |
Test 58
Verdict: WRONG ANSWER
input |
---|
14 922927469528725341 |
correct output |
---|
702679243 |
user output |
---|
0 |
Test 59
Verdict: WRONG ANSWER
input |
---|
18 278820978471154000 |
correct output |
---|
447470474 |
user output |
---|
0 |
Test 60
Verdict: WRONG ANSWER
input |
---|
19 595145428494262541 |
correct output |
---|
321383191 |
user output |
---|
0 |
Test 61
Verdict: WRONG ANSWER
input |
---|
16 733419934325111819 |
correct output |
---|
603915854 |
user output |
---|
0 |
Test 62
Verdict: WRONG ANSWER
input |
---|
42 977794035917013551 |
correct output |
---|
535001165 |
user output |
---|
0 |
Test 63
Verdict: WRONG ANSWER
input |
---|
46 107297864267805308 |
correct output |
---|
557129508 |
user output |
---|
0 |
Test 64
Verdict: WRONG ANSWER
input |
---|
47 423649320883482177 |
correct output |
---|
894439428 |
user output |
---|
0 |
Test 65
Verdict: WRONG ANSWER
input |
---|
35 923635615021083310 |
correct output |
---|
306200203 |
user output |
---|
0 |
Test 66
Verdict: WRONG ANSWER
input |
---|
27 119042622192684556 |
correct output |
---|
95698341 |
user output |
---|
0 |
Test 67
Verdict: WRONG ANSWER
input |
---|
50 394425873219136058 |
correct output |
---|
461849248 |
user output |
---|
0 |
Test 68
Verdict: WRONG ANSWER
input |
---|
27 702344952743354850 |
correct output |
---|
361328763 |
user output |
---|
0 |
Test 69
Verdict: WRONG ANSWER
input |
---|
34 148052957467783205 |
correct output |
---|
883611228 |
user output |
---|
0 |
Test 70
Verdict: WRONG ANSWER
input |
---|
49 120057477600708020 |
correct output |
---|
411727310 |
user output |
---|
0 |
Test 71
Verdict: WRONG ANSWER
input |
---|
77 985532091144101696 |
correct output |
---|
533259046 |
user output |
---|
0 |
Test 72
Verdict: WRONG ANSWER
input |
---|
76 62568531781086688 |
correct output |
---|
111230040 |
user output |
---|
0 |
Test 73
Verdict: WRONG ANSWER
input |
---|
80 638842883372078079 |
correct output |
---|
843571033 |
user output |
---|
0 |
Test 74
Verdict: WRONG ANSWER
input |
---|
72 568029317340376926 |
correct output |
---|
760917479 |
user output |
---|
0 |
Test 75
Verdict: WRONG ANSWER
input |
---|
57 993363883840818838 |
correct output |
---|
125996687 |
user output |
---|
0 |
Test 76
Verdict: WRONG ANSWER
input |
---|
54 587462523883449402 |
correct output |
---|
707247678 |
user output |
---|
0 |
Test 77
Verdict: WRONG ANSWER
input |
---|
50 654341799647462242 |
correct output |
---|
823275735 |
user output |
---|
0 |
Test 78
Verdict: WRONG ANSWER
input |
---|
58 198843859011456415 |
correct output |
---|
392227014 |
user output |
---|
0 |
Test 79
Verdict: WRONG ANSWER
input |
---|
61 710225245014179861 |
correct output |
---|
352309063 |
user output |
---|
0 |
Test 80
Verdict: WRONG ANSWER
input |
---|
81 435847411137743327 |
correct output |
---|
639314946 |
user output |
---|
0 |