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"Today is the final contest of INOI (Iranian National Olympiad in Informatics). The contest room is a row with n computers. All computers are numbered with integers from 1 to n from left to right. There are m participants, numbered with integers from 1 to m . We have an array a of length m where a_{i} ( 1 <= q a_i <= q n ) is the computer behind which the i -th participant wants to sit. Also, we have another array b of length m consisting of characters 'L' and 'R'. b_i is the side from which the i -th participant enters the room. 'L' means the participant enters from the left of computer 1 and goes from left to right, and 'R' means the participant enters from the right of computer n and goes from right to left. The participants in the order from 1 to m enter the room one by one. The i -th of them enters the contest room in the direction b_i and goes to sit behind the a_i -th computer. If it is occupied he keeps walking in his direction until he reaches the first unoccupied computer. After that, he sits behind it. If he doesn't find any computer he gets upset and gives up on the contest. The madness of the i -th participant is the distance between his assigned computer ( a_i ) and the computer he ends up sitting behind. The distance between computers i and j is equal to |i - j| . The values in the array a can be equal. There exist n^m cdot 2^m possible pairs of arrays (a, b) . Consider all pairs of arrays (a, b) such that no person becomes upset. For each of them let's calculate the sum of participants madnesses. Find the sum of all these values. You will be given some prime modulo p . Find this sum by modulo p . The only line contains three integers n , m , p ( 1 <= q m <= q n <= q 500, 10^8 <= q p <= q 10 ^ 9 + 9 ). It is guaranteed, that the number p$"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
98720824 |
hos.lyric |
D |
Nov. 17, 2020, 3:52 p.m. |
OK |
D |
TESTS |
28 |
2542 |
4198400 |
|
|
98767590 |
ilnil |
D |
Nov. 18, 2020, 2:09 a.m. |
OK |
GNU C++11 |
TESTS |
28 |
702 |
6144000 |
|
|
98730544 |
LJC00118 |
D |
Nov. 17, 2020, 4:17 p.m. |
OK |
GNU C++11 |
TESTS |
28 |
1372 |
4096000 |
|
|
98778365 |
White-House |
D |
Nov. 18, 2020, 6:03 a.m. |
OK |
GNU C++11 |
TESTS |
28 |
1591 |
10240000 |
|
|
98730831 |
xyz32768 |
D |
Nov. 17, 2020, 4:18 p.m. |
OK |
GNU C++11 |
TESTS |
28 |
1637 |
3072000 |
|
|
98707816 |
gisp_zjz |
D |
Nov. 17, 2020, 3:17 p.m. |
OK |
GNU C++11 |
TESTS |
28 |
1809 |
3072000 |
|
|
98741795 |
mocania |
D |
Nov. 17, 2020, 4:45 p.m. |
OK |
GNU C++11 |
TESTS |
28 |
2215 |
5120000 |
|
|
98725990 |
ynsm |
D |
Nov. 17, 2020, 4:05 p.m. |
OK |
GNU C++11 |
TESTS |
28 |
2651 |
10240000 |
|
|
98721633 |
KingPonyHead |
D |
Nov. 17, 2020, 3:54 p.m. |
OK |
GNU C++14 |
TESTS |
28 |
967 |
3993600 |
|
|
98756971 |
receed |
D |
Nov. 17, 2020, 7:35 p.m. |
OK |
GNU C++14 |
TESTS |
28 |
2667 |
6144000 |
|
|
98755058 |
Kuzey |
D |
Nov. 17, 2020, 6:58 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
46 |
4198400 |
|
|
98739596 |
Swistakk |
D |
Nov. 17, 2020, 4:40 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
217 |
4300800 |
|
|
98737101 |
Errichto |
D |
Nov. 17, 2020, 4:34 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
717 |
3072000 |
|
|
98741204 |
Hazyknight |
D |
Nov. 17, 2020, 4:44 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
889 |
6144000 |
|
|
98757470 |
kefaa2 |
D |
Nov. 17, 2020, 7:45 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
1029 |
3072000 |
|
|
98723612 |
Radewoosh |
D |
Nov. 17, 2020, 3:59 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
1169 |
24371200 |
|
|
98719637 |
TadijaSebez |
D |
Nov. 17, 2020, 3:48 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
1762 |
3072000 |
|
|
98735862 |
SirShokoladina |
D |
Nov. 17, 2020, 4:31 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
1871 |
6041600 |
|
|
98733870 |
taeyeon_ss |
D |
Nov. 17, 2020, 4:26 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
2137 |
6041600 |
|
|
98737715 |
antontrygubO_o |
D |
Nov. 17, 2020, 4:36 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
2246 |
10035200 |
|
|
98728933 |
yosupo |
D |
Nov. 17, 2020, 4:13 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
514 |
3379200 |
|
|
98763931 |
wrinx |
D |
Nov. 17, 2020, 11:20 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
763 |
6144000 |
|
|
98716903 |
Um_nik |
D |
Nov. 17, 2020, 3:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
904 |
6144000 |
|
|
98754023 |
sh1194 |
D |
Nov. 17, 2020, 6:42 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
919 |
3072000 |
|
|
98705229 |
Itst |
D |
Nov. 17, 2020, 3:11 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
919 |
3072000 |
|
|
98772489 |
heno239 |
D |
Nov. 18, 2020, 4:12 a.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
1341 |
8294400 |
|
|
98735777 |
boboniu |
D |
Nov. 17, 2020, 4:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
1341 |
120012800 |
|
|
98739698 |
Maksim1744 |
D |
Nov. 17, 2020, 4:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
1357 |
6656000 |
|
|
98724071 |
jiangly |
D |
Nov. 17, 2020, 4 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
1481 |
3379200 |
|
|
98736469 |
aid |
D |
Nov. 17, 2020, 4:33 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
1590 |
3072000 |
|
|
98769011 |
cwise |
D |
Nov. 18, 2020, 2:49 a.m. |
OK |
Java 8 |
TESTS |
28 |
2901 |
0 |
|
|
remove filters
Back to search problems