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 are given a set of n elements indexed from 1 to n. The weight of i-th element is wi. The weight of some subset of a given set is denoted as . The weight of some partition R of a given set into k subsets is (recall that a partition of a given set is a set of its subsets such that every element of the given set belongs to exactly one subset in partition). Calculate the sum of weights of all partitions of a given set into exactly k non-empty subsets, and print it modulo 109 xe2 x80 x89+ xe2 x80 x897. Two partitions are considered different iff there exist two elements x and y such that they belong to the same set in one of the partitions, and to different sets in another partition. The first line contains two integers n and k (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89k xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x892 xc2 xb7105) -- the number of elements and the number of subsets in each partition, respectively. The second line contains n integers wi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89wi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109) -- weights of elements of the set. Print one integer -- the sum of weights of all partitions of a given set into k non-empty subsets, taken modulo 109 xe2 x80 x89+ xe2 x80 x897. Possible partitions in the first sample: Possible partitions in the second sample: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
40932422 |
ReaLNero1 |
G |
July 30, 2018, 1:47 a.m. |
OK |
GNU C++ |
TESTS |
42 |
78 |
819200 |
|
2700 |
37436471 |
Scut82 |
G |
April 18, 2018, 12:46 p.m. |
OK |
GNU C++ |
TESTS |
42 |
78 |
4300800 |
|
2700 |
37476436 |
vjudge1 |
G |
April 20, 2018, 3:17 a.m. |
OK |
GNU C++ |
TESTS |
42 |
93 |
5120000 |
|
2700 |
37449571 |
SylvanasS |
G |
April 19, 2018, 12:25 a.m. |
OK |
GNU C++ |
TESTS |
42 |
109 |
5939200 |
|
2700 |
36997066 |
bestFy |
G |
April 5, 2018, 12:25 p.m. |
OK |
GNU C++ |
TESTS |
42 |
140 |
5120000 |
|
2700 |
37088239 |
yasugongshang |
G |
April 8, 2018, 5:38 a.m. |
OK |
GNU C++ |
TESTS |
42 |
140 |
16793600 |
|
2700 |
36999058 |
htcheck |
G |
April 5, 2018, 1:46 p.m. |
OK |
GNU C++ |
TESTS |
42 |
156 |
12083200 |
|
2700 |
42023486 |
vjudge4 |
G |
Aug. 24, 2018, 10:50 a.m. |
OK |
GNU C++ |
TESTS |
42 |
171 |
1433600 |
|
2700 |
39978985 |
jesseliu612 |
G |
July 5, 2018, 9:22 a.m. |
OK |
GNU C++ |
TESTS |
42 |
171 |
4300800 |
|
2700 |
37242457 |
luogu_bot5 |
G |
April 12, 2018, 8:05 a.m. |
OK |
GNU C++ |
TESTS |
42 |
171 |
4300800 |
|
2700 |
61988553 |
SSL_XJQ |
G |
Oct. 6, 2019, 2:22 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
2457600 |
|
2700 |
59273607 |
luogu_bot5 |
G |
Aug. 22, 2019, 1:39 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
2457600 |
|
2700 |
59273495 |
luogu_bot2 |
G |
Aug. 22, 2019, 1:36 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
2457600 |
|
2700 |
59198291 |
zxyoi |
G |
Aug. 21, 2019, 2:59 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
8192000 |
|
2700 |
59878474 |
__trrbivial_innocence |
G |
Sept. 2, 2019, 2:34 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
10649600 |
|
2700 |
51483185 |
luogu_bot2 |
G |
March 19, 2019, 12:30 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
78 |
1638400 |
|
2700 |
37799122 |
Imperfect |
G |
May 1, 2018, 12:56 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
78 |
5120000 |
|
2700 |
47384412 |
luogu_bot4 |
G |
Dec. 23, 2018, 2:42 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
78 |
7270400 |
|
2700 |
56393325 |
ILoLy |
G |
July 1, 2019, 1:29 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
78 |
11980800 |
|
2700 |
66614612 |
luogu_bot4 |
G |
Dec. 11, 2019, 2:28 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
93 |
819200 |
|
2700 |
68584532 |
iotang |
G |
Jan. 11, 2020, 10:55 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
93 |
3276800 |
|
2700 |
66745486 |
vjudge5 |
G |
Dec. 13, 2019, 1:44 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
109 |
1638400 |
|
2700 |
66745503 |
vjudge5 |
G |
Dec. 13, 2019, 1:46 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
124 |
1638400 |
|
2700 |
41418781 |
DOlaBMOon |
G |
Aug. 10, 2018, 6:14 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
124 |
2867200 |
|
2700 |
38019688 |
Twishkle.Aevdark |
G |
May 8, 2018, 12:03 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
124 |
4403200 |
|
2700 |
66745524 |
vjudge3 |
G |
Dec. 13, 2019, 1:47 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
140 |
1638400 |
|
2700 |
37039398 |
g1n0st |
G |
April 7, 2018, 6:13 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
140 |
5939200 |
|
2700 |
51483162 |
DSL_HN_2002 |
G |
March 19, 2019, 12:30 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
155 |
1638400 |
|
2700 |
64055627 |
namnguyennn.89 |
G |
Nov. 2, 2019, 1:13 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
171 |
1638400 |
|
2700 |
51073614 |
Itst |
G |
March 9, 2019, 8:38 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
171 |
1638400 |
|
2700 |
67268597 |
vjudge1 |
G |
Dec. 20, 2019, 7:13 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
124 |
3174400 |
|
2700 |
66744521 |
Zhou_JK |
G |
Dec. 13, 2019, 12:35 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
124 |
3174400 |
|
2700 |
44662734 |
animalcoder |
G |
Oct. 21, 2018, 4:05 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
139 |
3481600 |
|
2700 |
36985658 |
q234rty |
G |
April 5, 2018, 2:26 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
139 |
16588800 |
|
2700 |
59567402 |
Asagami |
G |
Aug. 27, 2019, 11:16 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
155 |
2457600 |
|
2700 |
64677297 |
declare |
G |
Nov. 11, 2019, 8:33 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
156 |
3174400 |
|
2700 |
52896865 |
olahiuj |
G |
April 17, 2019, 9:14 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
156 |
4812800 |
|
2700 |
68046620 |
UESTC_Forsaken |
G |
Jan. 1, 2020, 4:45 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
171 |
3993600 |
|
2700 |
64578740 |
typhigh |
G |
Nov. 9, 2019, 11:29 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
171 |
4812800 |
|
2700 |
64317470 |
hjk1030 |
G |
Nov. 5, 2019, 2:32 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
187 |
2457600 |
|
2700 |
36993108 |
palayutm |
G |
April 5, 2018, 9:24 a.m. |
OK |
Java 8 |
TESTS |
42 |
327 |
20684800 |
|
2700 |
36980018 |
Suzukaze |
G |
April 4, 2018, 6:51 p.m. |
OK |
Java 8 |
TESTS |
42 |
592 |
28569600 |
|
2700 |
37136809 |
dalt |
G |
April 10, 2018, 6:10 a.m. |
OK |
Java 8 |
TESTS |
42 |
639 |
20684800 |
|
2700 |
37127877 |
8oka20 |
G |
April 9, 2018, 5:13 p.m. |
OK |
Java 8 |
TESTS |
42 |
655 |
26009600 |
|
2700 |
56952089 |
vjudge5 |
G |
July 13, 2019, 2:39 a.m. |
OK |
MS C++ |
TESTS |
42 |
701 |
1638400 |
|
2700 |
56951620 |
vjudge4 |
G |
July 13, 2019, 2:28 a.m. |
OK |
MS C++ |
TESTS |
42 |
795 |
3174400 |
|
2700 |
63903653 |
EDawn |
G |
Oct. 31, 2019, 5:47 a.m. |
OK |
MS C++ 2017 |
TESTS |
42 |
218 |
819200 |
|
2700 |
36986748 |
Yee_172 |
G |
April 5, 2018, 3:35 a.m. |
OK |
PyPy 3 |
TESTS |
42 |
1045 |
50278400 |
|
2700 |
36983823 |
sparkyyyy |
G |
April 4, 2018, 11:56 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
1185 |
77414400 |
|
2700 |
37018264 |
figure0907 |
G |
April 6, 2018, 10:28 a.m. |
OK |
PyPy 3 |
TESTS |
42 |
1247 |
64614400 |
|
2700 |
remove filters
Back to search problems