Task: | Skittles |
Sender: | bubu2006 |
Submission time: | 2024-11-18 16:39:23 +0200 |
Language: | C++ (C++20) |
Status: | READY |
Result: | RUNTIME ERROR |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | ACCEPTED | 0.00 s | details |
#9 | ACCEPTED | 0.01 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | RUNTIME ERROR | 0.00 s | details |
#12 | ACCEPTED | 0.00 s | details |
#13 | ACCEPTED | 0.01 s | details |
#14 | ACCEPTED | 0.01 s | details |
#15 | ACCEPTED | 0.02 s | details |
#16 | RUNTIME ERROR | 0.00 s | details |
#17 | ACCEPTED | 0.03 s | details |
#18 | WRONG ANSWER | 0.02 s | details |
#19 | ACCEPTED | 0.04 s | details |
#20 | ACCEPTED | 0.03 s | details |
#21 | ACCEPTED | 0.03 s | details |
#22 | ACCEPTED | 0.04 s | details |
#23 | ACCEPTED | 0.01 s | details |
#24 | ACCEPTED | 0.02 s | details |
#25 | RUNTIME ERROR | 0.00 s | details |
#26 | ACCEPTED | 0.02 s | details |
#27 | ACCEPTED | 0.04 s | details |
#28 | ACCEPTED | 0.03 s | details |
#29 | RUNTIME ERROR | 0.00 s | details |
#30 | ACCEPTED | 0.03 s | details |
#31 | ACCEPTED | 0.02 s | details |
#32 | ACCEPTED | 0.01 s | details |
#33 | ACCEPTED | 0.03 s | details |
#34 | RUNTIME ERROR | 0.00 s | details |
#35 | RUNTIME ERROR | 0.00 s | details |
#36 | WRONG ANSWER | 0.03 s | details |
#37 | WRONG ANSWER | 0.02 s | details |
#38 | WRONG ANSWER | 0.01 s | details |
#39 | ACCEPTED | 0.01 s | details |
#40 | ACCEPTED | 0.04 s | details |
#41 | ACCEPTED | 0.01 s | details |
#42 | WRONG ANSWER | 0.02 s | details |
#43 | ACCEPTED | 0.02 s | details |
#44 | RUNTIME ERROR | 0.00 s | details |
#45 | ACCEPTED | 0.02 s | details |
#46 | ACCEPTED | 0.01 s | details |
#47 | ACCEPTED | 0.02 s | details |
#48 | WRONG ANSWER | 0.01 s | details |
#49 | ACCEPTED | 0.02 s | details |
#50 | ACCEPTED | 0.01 s | details |
#51 | ACCEPTED | 0.01 s | details |
#52 | WRONG ANSWER | 0.01 s | details |
#53 | WRONG ANSWER | 0.01 s | details |
#54 | ACCEPTED | 0.02 s | details |
#55 | ACCEPTED | 0.02 s | details |
#56 | ACCEPTED | 0.03 s | details |
#57 | WRONG ANSWER | 0.02 s | details |
#58 | ACCEPTED | 0.02 s | details |
#59 | ACCEPTED | 0.03 s | details |
#60 | RUNTIME ERROR | 0.00 s | details |
#61 | WRONG ANSWER | 0.01 s | details |
#62 | ACCEPTED | 0.03 s | details |
#63 | WRONG ANSWER | 0.03 s | details |
Code
#pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef long double ld; string to_string(string s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename A> string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; } void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); } #ifdef LOCAL #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #else #define debug(...) 42 #endif ll euclid(ll a, ll b, ll &x, ll &y) { if (!b) return x = 1, y = 0, a; ll d = euclid(b, a % b, y, x); return y -= a/b * x, d; } const ll mod = 998244353; // change to something else struct Mod { ll x; Mod(ll xx) : x(xx) {} Mod operator+(Mod b) { return Mod((x + b.x) % mod); } Mod operator-(Mod b) { return Mod((x - b.x + mod) % mod); } Mod operator*(Mod b) { return Mod((x * b.x) % mod); } Mod operator/(Mod b) { return *this * invert(b); } Mod invert(Mod a) { ll x, y, g = euclid(a.x, mod, x, y); assert(g == 1); return Mod((x + mod) % mod); } Mod operator^(ll e) { if (!e) return Mod(1); Mod r = *this ^ (e / 2); r = r * r; return e&1 ? *this * r : r; } }; void solve(){ int n,a,b; cin>>n>>a>>b; vector<Mod> fact(2*b+1,Mod(0)); fact[0]=Mod(1); for (int i = 1; i<=2*b; i++){ fact[i]=fact[i-1]*Mod(i); } auto cnk = [&](int nn, int k){ return fact[nn]/(fact[nn-k]*fact[k]); }; Mod ans = Mod(0); for (int i=a;i<=b;i++){ ans = ans + cnk(i+n-1,n-1); } cout<<ans.x; } signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); // RTE if input wrong datatype int t=1; // cin>>t; while(t--){ solve(); } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 1 10 |
correct output |
---|
10 |
user output |
---|
10 |
Test 2
Verdict: ACCEPTED
input |
---|
2 3 3 |
correct output |
---|
4 |
user output |
---|
4 |
Test 3
Verdict: ACCEPTED
input |
---|
2 4 5 |
correct output |
---|
11 |
user output |
---|
11 |
Test 4
Verdict: ACCEPTED
input |
---|
3 4 5 |
correct output |
---|
36 |
user output |
---|
36 |
Test 5
Verdict: ACCEPTED
input |
---|
3 2 2 |
correct output |
---|
6 |
user output |
---|
6 |
Test 6
Verdict: ACCEPTED
input |
---|
5 5 5 |
correct output |
---|
126 |
user output |
---|
126 |
Test 7
Verdict: ACCEPTED
input |
---|
10 10 10 |
correct output |
---|
92378 |
user output |
---|
92378 |
Test 8
Verdict: ACCEPTED
input |
---|
10 1 10 |
correct output |
---|
184755 |
user output |
---|
184755 |
Test 9
Verdict: ACCEPTED
input |
---|
100 100 100 |
correct output |
---|
866655715 |
user output |
---|
866655715 |
Test 10
Verdict: ACCEPTED
input |
---|
10 100 100 |
correct output |
---|
918123961 |
user output |
---|
918123961 |
Test 11
Verdict: RUNTIME ERROR
input |
---|
1000 10 10 |
correct output |
---|
84965120 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:79: Mod Mod::invert(Mod): Assertion `g == 1' failed.
Test 12
Verdict: ACCEPTED
input |
---|
10000 10000 10000 |
correct output |
---|
658363258 |
user output |
---|
658363258 |
Test 13
Verdict: ACCEPTED
input |
---|
100000 100000 100000 |
correct output |
---|
966937032 |
user output |
---|
966937032 |
Test 14
Verdict: ACCEPTED
input |
---|
54883 59286 71521 |
correct output |
---|
908996595 |
user output |
---|
908996595 |
Test 15
Verdict: ACCEPTED
input |
---|
41703 72034 99721 |
correct output |
---|
139159644 |
user output |
---|
139159644 |
Test 16
Verdict: RUNTIME ERROR
input |
---|
43601 2593 18509 |
correct output |
---|
804369499 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:79: Mod Mod::invert(Mod): Assertion `g == 1' failed.
Test 17
Verdict: ACCEPTED
input |
---|
55081 7073 70816 |
correct output |
---|
806880502 |
user output |
---|
806880502 |
Test 18
Verdict: WRONG ANSWER
input |
---|
96705 54725 90064 |
correct output |
---|
521461113 |
user output |
---|
704247586 |
Test 19
Verdict: ACCEPTED
input |
---|
22200 5519 87075 |
correct output |
---|
866679044 |
user output |
---|
866679044 |
Test 20
Verdict: ACCEPTED
input |
---|
89288 33199 94750 |
correct output |
---|
812654801 |
user output |
---|
812654801 |
Test 21
Verdict: ACCEPTED
input |
---|
7631 22735 77994 |
correct output |
---|
30255908 |
user output |
---|
30255908 |
Test 22
Verdict: ACCEPTED
input |
---|
87345 1112 96856 |
correct output |
---|
944788802 |
user output |
---|
944788802 |
Test 23
Verdict: ACCEPTED
input |
---|
1038 36447 50189 |
correct output |
---|
654272260 |
user output |
---|
654272260 |
Test 24
Verdict: ACCEPTED
input |
---|
41703 72034 99721 |
correct output |
---|
139159644 |
user output |
---|
139159644 |
Test 25
Verdict: RUNTIME ERROR
input |
---|
18028 1948 6831 |
correct output |
---|
631722506 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:79: Mod Mod::invert(Mod): Assertion `g == 1' failed.
Test 26
Verdict: ACCEPTED
input |
---|
4873 28912 79929 |
correct output |
---|
106074189 |
user output |
---|
106074189 |
Test 27
Verdict: ACCEPTED
input |
---|
28606 2900 95813 |
correct output |
---|
538554734 |
user output |
---|
538554734 |
Test 28
Verdict: ACCEPTED
input |
---|
25093 4610 68059 |
correct output |
---|
799962519 |
user output |
---|
799962519 |
Test 29
Verdict: RUNTIME ERROR
input |
---|
67575 4472 32712 |
correct output |
---|
857647130 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:79: Mod Mod::invert(Mod): Assertion `g == 1' failed.
Test 30
Verdict: ACCEPTED
input |
---|
82449 18136 86245 |
correct output |
---|
420446937 |
user output |
---|
420446937 |
Test 31
Verdict: ACCEPTED
input |
---|
18558 38661 75914 |
correct output |
---|
924425479 |
user output |
---|
924425479 |
Test 32
Verdict: ACCEPTED
input |
---|
35543 34086 47960 |
correct output |
---|
210554536 |
user output |
---|
210554536 |
Test 33
Verdict: ACCEPTED
input |
---|
20101 32903 99080 |
correct output |
---|
88647511 |
user output |
---|
88647511 |
Test 34
Verdict: RUNTIME ERROR
input |
---|
18028 1948 6831 |
correct output |
---|
631722506 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:79: Mod Mod::invert(Mod): Assertion `g == 1' failed.
Test 35
Verdict: RUNTIME ERROR
input |
---|
61218 12076 16908 |
correct output |
---|
820171450 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:79: Mod Mod::invert(Mod): Assertion `g == 1' failed.
Test 36
Verdict: WRONG ANSWER
input |
---|
78139 13111 69284 |
correct output |
---|
904117059 |
user output |
---|
-358739310 |
Test 37
Verdict: WRONG ANSWER
input |
---|
45455 2862 43952 |
correct output |
---|
430742811 |
user output |
---|
-476505728 |
Test 38
Verdict: WRONG ANSWER
input |
---|
84538 61888 77158 |
correct output |
---|
294818599 |
user output |
---|
-579680874 |
Test 39
Verdict: ACCEPTED
input |
---|
26937 59685 80971 |
correct output |
---|
680140546 |
user output |
---|
680140546 |
Test 40
Verdict: ACCEPTED
input |
---|
30632 9727 88573 |
correct output |
---|
877318826 |
user output |
---|
877318826 |
Test 41
Verdict: ACCEPTED
input |
---|
55737 66074 71002 |
correct output |
---|
123569267 |
user output |
---|
123569267 |
Test 42
Verdict: WRONG ANSWER
input |
---|
59351 587 51636 |
correct output |
---|
122513346 |
user output |
---|
-347516766 |
Test 43
Verdict: ACCEPTED
input |
---|
8954 7866 51810 |
correct output |
---|
961929284 |
user output |
---|
961929284 |
Test 44
Verdict: RUNTIME ERROR
input |
---|
61218 12076 16908 |
correct output |
---|
820171450 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:79: Mod Mod::invert(Mod): Assertion `g == 1' failed.
Test 45
Verdict: ACCEPTED
input |
---|
9556 43003 92502 |
correct output |
---|
424034313 |
user output |
---|
424034313 |
Test 46
Verdict: ACCEPTED
input |
---|
20433 945 23474 |
correct output |
---|
794687216 |
user output |
---|
794687216 |
Test 47
Verdict: ACCEPTED
input |
---|
9941 45344 78340 |
correct output |
---|
875489658 |
user output |
---|
875489658 |
Test 48
Verdict: WRONG ANSWER
input |
---|
82532 68582 70655 |
correct output |
---|
238007640 |
user output |
---|
66125001 |
Test 49
Verdict: ACCEPTED
input |
---|
52729 37586 66259 |
correct output |
---|
93243919 |
user output |
---|
93243919 |
Test 50
Verdict: ACCEPTED
input |
---|
10475 17392 24871 |
correct output |
---|
977605482 |
user output |
---|
977605482 |
Test 51
Verdict: ACCEPTED
input |
---|
76232 88012 95143 |
correct output |
---|
871309467 |
user output |
---|
871309467 |
Test 52
Verdict: WRONG ANSWER
input |
---|
77184 58424 64500 |
correct output |
---|
693972156 |
user output |
---|
-408262166 |
Test 53
Verdict: WRONG ANSWER
input |
---|
96888 47083 55295 |
correct output |
---|
406195062 |
user output |
---|
819521699 |
Test 54
Verdict: ACCEPTED
input |
---|
9556 43003 92502 |
correct output |
---|
424034313 |
user output |
---|
424034313 |
Test 55
Verdict: ACCEPTED
input |
---|
83891 47894 87748 |
correct output |
---|
686766192 |
user output |
---|
686766192 |
Test 56
Verdict: ACCEPTED
input |
---|
85080 21779 92819 |
correct output |
---|
114946782 |
user output |
---|
114946782 |
Test 57
Verdict: WRONG ANSWER
input |
---|
88235 6779 56603 |
correct output |
---|
70147249 |
user output |
---|
-54523078 |
Test 58
Verdict: ACCEPTED
input |
---|
88858 66896 98375 |
correct output |
---|
601764178 |
user output |
---|
601764178 |
Test 59
Verdict: ACCEPTED
input |
---|
50586 8901 76084 |
correct output |
---|
881324074 |
user output |
---|
881324074 |
Test 60
Verdict: RUNTIME ERROR
input |
---|
87594 26882 34225 |
correct output |
---|
42681251 |
user output |
---|
(empty) |
Error:
code: input/code.cpp:79: Mod Mod::invert(Mod): Assertion `g == 1' failed.
Test 61
Verdict: WRONG ANSWER
input |
---|
73130 30310 55103 |
correct output |
---|
843664756 |
user output |
---|
765880833 |
Test 62
Verdict: ACCEPTED
input |
---|
63584 31874 92876 |
correct output |
---|
437812641 |
user output |
---|
437812641 |
Test 63
Verdict: WRONG ANSWER
input |
---|
88714 2531 74051 |
correct output |
---|
603847190 |
user output |
---|
601446532 |