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"There are n boxes placed in a line. The boxes are numbered from 1 to n . Some boxes contain one ball inside of them, the rest are empty. At least one box contains a ball and at least one box is empty. In one move, you have to choose a box with a ball inside and an adjacent empty box and move the ball from one box into another. Boxes i and i+1 for all i from 1 to n-1 are considered adjacent to each other. Boxes 1 and n are not adjacent. How many different arrangements of balls exist after exactly k moves are performed? Two arrangements are considered different if there is at least one such box that it contains a ball in one of them and doesn't contain a ball in the other one. Since the answer might be pretty large, print its remainder modulo 10^9+7 . The first line contains two integers n and k ( 2 <= n <= 1500 ; 1 <= k <= 1500 ) -- the number of boxes and the number of moves. The second line contains n integers a_1, a_2, ... , a_n ( a_i in {0, 1 } ) -- 0 denotes an empty box and 1 denotes a box with a ball inside. There is at least one 0 and at least one 1 . Print a single integer -- the number of different arrangements of balls that can exist after exactly k moves are performed, modulo 10^9+7 . In the first example, there are the following possible arrangements: In the second example, there are the following possible arrangements: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
211569020 |
Suwan |
E |
June 30, 2023, 4:14 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
889 |
1024000 |
|
|
211527325 |
wa_233 |
E |
June 29, 2023, 4:34 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
998 |
1331200 |
|
|
211553016 |
omeganot |
E |
June 29, 2023, 10:01 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
1122 |
9011200 |
|
|
211524581 |
minaduki_maple |
E |
June 29, 2023, 4:30 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
1482 |
27238400 |
|
|
211531476 |
ASPA |
E |
June 29, 2023, 4:57 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
1606 |
16793600 |
|
|
211562588 |
123abda |
E |
June 30, 2023, 2:23 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
1996 |
9113600 |
|
|
211572346 |
vjudge1 |
E |
June 30, 2023, 5:13 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
2090 |
11673600 |
|
|
211572306 |
wrhaco |
E |
June 30, 2023, 5:12 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
2121 |
11673600 |
|
|
211569010 |
zddtuus |
E |
June 30, 2023, 4:14 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
2589 |
3276800 |
|
|
211533847 |
Cu_OH_2 |
E |
June 29, 2023, 5:15 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
3042 |
9113600 |
|
|
211556997 |
AbdelmagedNour |
E |
June 29, 2023, 11:59 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
218 |
9113600 |
|
|
211563663 |
Mera_Azusa |
E |
June 30, 2023, 2:42 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
343 |
1024000 |
|
|
211532733 |
Hongzy |
E |
June 29, 2023, 5:06 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
795 |
1024000 |
|
|
211533437 |
ToTLeS |
E |
June 29, 2023, 5:12 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
904 |
9113600 |
|
|
211533852 |
ToTLeS |
E |
June 29, 2023, 5:15 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
982 |
9113600 |
|
|
211532847 |
ToTLeS |
E |
June 29, 2023, 5:07 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
998 |
9113600 |
|
|
211559400 |
thunopro |
E |
June 30, 2023, 1:06 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
1029 |
9113600 |
|
|
211553364 |
woruo27 |
E |
June 29, 2023, 10:10 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
1045 |
9113600 |
|
|
211534887 |
Ant_Man |
E |
June 29, 2023, 5:25 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
1092 |
1433600 |
|
|
211533319 |
ToTLeS |
E |
June 29, 2023, 5:11 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
1294 |
9113600 |
|
|
211535194 |
iLLusio |
E |
June 29, 2023, 5:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
234 |
9728000 |
|
|
211563905 |
hokarikanae |
E |
June 30, 2023, 2:46 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
358 |
1024000 |
|
|
211559214 |
yamate11 |
E |
June 30, 2023, 12:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
577 |
18944000 |
|
|
211574877 |
PEKKA_l |
E |
June 30, 2023, 5:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
624 |
18124800 |
|
|
211574832 |
PEKKA_l |
E |
June 30, 2023, 5:46 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
624 |
18124800 |
|
|
211535038 |
dong_liu |
E |
June 29, 2023, 5:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
717 |
921600 |
|
|
211535008 |
dong_liu |
E |
June 29, 2023, 5:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
795 |
1024000 |
|
|
211543137 |
Olerinskiy |
E |
June 29, 2023, 6:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
810 |
27443200 |
|
|
211559379 |
244mhq |
E |
June 30, 2023, 1:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
1076 |
4505600 |
|
|
211558765 |
Alex_Wei |
E |
June 30, 2023, 12:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
1310 |
2457600 |
|
|
211556952 |
AbdelmagedNour |
E |
June 29, 2023, 11:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
33 |
140 |
9113600 |
|
|
211551542 |
AbdelmagedNour |
E |
June 29, 2023, 9:24 p.m. |
OK |
GNU C++20 (64) |
TESTS |
31 |
140 |
9113600 |
|
|
211556985 |
AbdelmagedNour |
E |
June 29, 2023, 11:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
33 |
155 |
9113600 |
|
|
211556963 |
AbdelmagedNour |
E |
June 29, 2023, 11:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
33 |
155 |
9113600 |
|
|
211559474 |
AbdelmagedNour |
E |
June 30, 2023, 1:08 a.m. |
OK |
GNU C++20 (64) |
TESTS |
33 |
156 |
9113600 |
|
|
211557032 |
AbdelmagedNour |
E |
June 30, 2023, midnight |
OK |
GNU C++20 (64) |
TESTS |
33 |
156 |
9113600 |
|
|
211557022 |
AbdelmagedNour |
E |
June 30, 2023, midnight |
OK |
GNU C++20 (64) |
TESTS |
33 |
156 |
9113600 |
|
|
211557008 |
AbdelmagedNour |
E |
June 29, 2023, 11:59 p.m. |
OK |
GNU C++20 (64) |
TESTS |
33 |
156 |
9113600 |
|
|
211535250 |
propane |
E |
June 29, 2023, 5:29 p.m. |
OK |
GNU C++20 (64) |
TESTS |
31 |
171 |
5017600 |
|
|
211556925 |
AbdelmagedNour |
E |
June 29, 2023, 11:57 p.m. |
OK |
GNU C++20 (64) |
TESTS |
33 |
171 |
9113600 |
|
|
211547196 |
mr_sparkle70 |
E |
June 29, 2023, 7:56 p.m. |
OK |
Go |
TESTS |
31 |
1855 |
3584000 |
|
|
211547221 |
Dukkha |
E |
June 29, 2023, 7:56 p.m. |
OK |
Java 17 |
TESTS |
31 |
3478 |
1024000 |
|
|
remove filters
Back to search problems