Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'You have a bag which contains n cards. There is a number written on each card; the number on i -th card is a_i . You are playing the following game. During each turn, you choose and remove a random card from the bag (all cards that are still left inside the bag are chosen equiprobably). Nothing else happens during the first turn -- but during the next turns, after removing a card (let the number on it be x ), you compare it with the card that was removed during the previous turn (let the number on it be y ). Possible outcomes are: If there are no cards left in the bag, you lose. Cards are not returned into the bag after you remove them. You have to calculate the probability of winning in this game. It can be shown that it is in the form of frac{P}{Q} where P and Q are non-negative integers and Q neq 0 , P <= Q . Output the value of P cdot Q^{ xe2 x88 x921} ~(mod ~~ 998244353) . The first line contains one integer n ( 2 <= n <= 5000 ) -- the number of cards in the bag. The second live contains n integers a_1, a_2, ... a_n ( 1 <= a_i <= n ) -- the i -th integer is the number written on the i -th card. Print one integer -- the probability of winning in this game modulo 998244353 . In the first test case the probability of winning is frac{1}{10} . In the second test case the probability of winning is 1 . In the third test case the probability of winning is 0 . In the fourth test case the probability of winning is frac{1}{4} . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
55181029 |
sansen |
F |
June 5, 2019, 10:18 p.m. |
OK |
GNU C11 |
TESTS |
35 |
93 |
102400 |
|
2500 |
55276643 |
rainboy |
F |
June 7, 2019, 7:36 p.m. |
OK |
GNU C11 |
TESTS |
35 |
748 |
102400 |
|
2500 |
54315255 |
about |
F |
May 17, 2019, 6:08 p.m. |
OK |
GNU C11 |
TESTS |
35 |
1107 |
201728000 |
|
2500 |
54019047 |
Trrui |
F |
May 12, 2019, 8:33 a.m. |
OK |
GNU C++11 |
TESTS |
35 |
78 |
102400 |
|
2500 |
60279342 |
code_struck |
F |
Sept. 8, 2019, 7:43 p.m. |
OK |
GNU C++11 |
TESTS |
35 |
93 |
102400 |
|
2500 |
53732840 |
2016wudi |
F |
May 4, 2019, 8:03 a.m. |
OK |
GNU C++11 |
TESTS |
35 |
108 |
200908800 |
|
2500 |
53774673 |
EncodeTalker |
F |
May 5, 2019, 7:34 a.m. |
OK |
GNU C++11 |
TESTS |
35 |
108 |
204492800 |
|
2500 |
53809863 |
11235813213455 |
F |
May 6, 2019, 5:42 a.m. |
OK |
GNU C++11 |
TESTS |
35 |
124 |
100556800 |
|
2500 |
54540892 |
Michael_Li |
F |
May 24, 2019, 1:35 a.m. |
OK |
GNU C++11 |
TESTS |
35 |
124 |
200908800 |
|
2500 |
53686441 |
caoyue |
F |
May 3, 2019, 1:24 a.m. |
OK |
GNU C++11 |
TESTS |
35 |
140 |
204800 |
|
2500 |
53734463 |
2016wudi |
F |
May 4, 2019, 8:45 a.m. |
OK |
GNU C++11 |
TESTS |
35 |
140 |
200704000 |
|
2500 |
69175516 |
vjudge5 |
F |
Jan. 20, 2020, 7:56 a.m. |
OK |
GNU C++11 |
TESTS |
35 |
156 |
102400 |
|
2500 |
53636442 |
zlc1114 |
F |
May 1, 2019, 4:06 p.m. |
OK |
GNU C++11 |
TESTS |
35 |
156 |
2867200 |
|
2500 |
55611023 |
ReaLNero1 |
F |
June 16, 2019, 5:43 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
78 |
102400 |
|
2500 |
54024170 |
krijgertje |
F |
May 12, 2019, 11:34 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
93 |
102400 |
|
2500 |
53637234 |
atoiz |
F |
May 1, 2019, 4:12 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
109 |
204800 |
|
2500 |
53678405 |
ccsu_cat_love_jiejie |
F |
May 2, 2019, 5:24 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
109 |
100556800 |
|
2500 |
54326594 |
sunyunqi |
F |
May 18, 2019, 3:10 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
124 |
200601600 |
|
2500 |
53836764 |
cn_bmh201601 |
F |
May 7, 2019, 3:48 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
124 |
201318400 |
|
2500 |
57139497 |
zzb111 |
F |
July 16, 2019, 10:23 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
171 |
204800 |
|
2500 |
69704352 |
Combi |
F |
Jan. 29, 2020, 3:31 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
171 |
100454400 |
|
2500 |
53636631 |
MazzForces |
F |
May 1, 2019, 4:07 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
186 |
1843200 |
|
2500 |
53627300 |
dreamoon_love_AA |
F |
May 1, 2019, 3:22 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
218 |
204800 |
|
2500 |
53642156 |
Global_Elite |
F |
May 1, 2019, 5:04 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
124 |
204800 |
|
2500 |
53989649 |
cjnwq |
F |
May 11, 2019, 11:39 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
140 |
204800 |
|
2500 |
61350364 |
JBer |
F |
Sept. 27, 2019, 7:47 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
140 |
201318400 |
|
2500 |
53634754 |
pachico |
F |
May 1, 2019, 3:55 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
171 |
409600 |
|
2500 |
53740836 |
vjudge2 |
F |
May 4, 2019, 1:43 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
171 |
100352000 |
|
2500 |
53641582 |
HatsuneMikuo |
F |
May 1, 2019, 4:54 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
202 |
202342400 |
|
2500 |
53667402 |
HatsuneMikuo |
F |
May 2, 2019, 11:19 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
202 |
202342400 |
|
2500 |
53667520 |
interestingLSY |
F |
May 2, 2019, 11:23 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
202 |
202342400 |
|
2500 |
53895024 |
roll_no_1 |
F |
May 9, 2019, 5:07 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
218 |
100556800 |
|
2500 |
53633484 |
Vladyslav |
F |
May 1, 2019, 3:48 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
218 |
100556800 |
|
2500 |
54001601 |
emma |
F |
May 11, 2019, 4:43 p.m. |
OK |
Go |
TESTS |
35 |
124 |
102400 |
|
2500 |
54997384 |
islammohsen |
F |
June 3, 2019, 12:53 a.m. |
OK |
Java 8 |
TESTS |
35 |
779 |
146944000 |
|
2500 |
53641361 |
uwi |
F |
May 1, 2019, 4:50 p.m. |
OK |
Java 8 |
TESTS |
35 |
841 |
0 |
|
2500 |
55834472 |
tmwilliamlin168 |
F |
June 20, 2019, 2:40 p.m. |
OK |
Java 8 |
TESTS |
35 |
857 |
0 |
|
2500 |
54997367 |
islammohsen |
F |
June 3, 2019, 12:52 a.m. |
OK |
Java 8 |
TESTS |
35 |
857 |
138956800 |
|
2500 |
53655503 |
dalt |
F |
May 2, 2019, 4:26 a.m. |
OK |
Java 8 |
TESTS |
35 |
873 |
0 |
|
2500 |
53682564 |
wadissimo |
F |
May 2, 2019, 8:24 p.m. |
OK |
Java 8 |
TESTS |
35 |
1122 |
275251200 |
|
2500 |
54021978 |
Srinivasa_Ramanujan |
F |
May 12, 2019, 10:19 a.m. |
OK |
Java 8 |
TESTS |
35 |
1138 |
250777600 |
|
2500 |
53682543 |
wadissimo |
F |
May 2, 2019, 8:23 p.m. |
OK |
Java 8 |
TESTS |
35 |
1138 |
271974400 |
|
2500 |
53638667 |
Jeel_Vaishnav |
F |
May 1, 2019, 4:23 p.m. |
OK |
Java 8 |
TESTS |
35 |
1325 |
260300800 |
|
2500 |
55276641 |
Dukkha |
F |
June 7, 2019, 7:36 p.m. |
OK |
Java 8 |
TESTS |
35 |
1372 |
0 |
|
2500 |
59890885 |
Spheniscine |
F |
Sept. 2, 2019, 10:19 a.m. |
OK |
Kotlin |
TESTS |
35 |
794 |
0 |
|
2500 |
58242124 |
Spheniscine |
F |
Aug. 4, 2019, 2:12 a.m. |
OK |
Kotlin |
TESTS |
35 |
811 |
1945600 |
|
2500 |
59890695 |
Spheniscine |
F |
Sept. 2, 2019, 10:14 a.m. |
OK |
Kotlin |
TESTS |
35 |
857 |
0 |
|
2500 |
58222179 |
Spheniscine |
F |
Aug. 3, 2019, 12:59 p.m. |
OK |
Kotlin |
TESTS |
35 |
1091 |
1945600 |
|
2500 |
58178829 |
Spheniscine |
F |
Aug. 2, 2019, 2:16 p.m. |
OK |
Kotlin |
TESTS |
35 |
1154 |
1945600 |
|
2500 |
58241931 |
Spheniscine |
F |
Aug. 4, 2019, 2:02 a.m. |
OK |
Kotlin |
TESTS |
35 |
1216 |
1945600 |
|
2500 |
69174667 |
vjudge2 |
F |
Jan. 20, 2020, 7:37 a.m. |
OK |
MS C++ |
TESTS |
35 |
670 |
102400 |
|
2500 |
69176512 |
vjudge4 |
F |
Jan. 20, 2020, 8:19 a.m. |
OK |
MS C++ |
TESTS |
35 |
1294 |
307200 |
|
2500 |
remove filters
Back to search problems