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 an integer x and an array of integers a_1, a_2, ldots, a_n . You have to determine if the number a_1! + a_2! + ldots + a_n! is divisible by x! . Here k! is a factorial of k -- the product of all positive integers less than or equal to k . For example, 3! = 1 cdot 2 cdot 3 = 6 , and 5! = 1 cdot 2 cdot 3 cdot 4 cdot 5 = 120 . The first line contains two integers n and x ( 1 <= n <= 500 ,000 , 1 <= x <= 500 ,000 ). The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= x ) -- elements of given array. In the only line print "Yes" (without quotes) if a_1! + a_2! + ldots + a_n! is divisible by x! , and "No" (without quotes) otherwise. In the first example 3! + 2! + 2! + 2! + 3! + 3! = 6 + 2 + 2 + 2 + 6 + 6 = 24 . Number 24 is divisible by 4! = 24 . In the second example 3! + 2! + 2! + 2! + 2! + 2! + 1! + 1! = 18 , is divisible by 3! = 6 . In the third example 7! + 7! + 7! + 7! + 7! + 7! + 7! = 7 cdot 7! . It is easy to prove that this number is not divisible by 8! . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
177571094 |
mban259 |
B |
Oct. 23, 2022, 8:36 a.m. |
OK |
C# 10 |
TESTS |
56 |
109 |
43008000 |
|
1600 |
177570220 |
DmitriyAnikeyev |
B |
Oct. 23, 2022, 8:34 a.m. |
OK |
C# 10 |
TESTS |
56 |
155 |
66969600 |
|
1600 |
177554661 |
KumaTachiRen |
B |
Oct. 23, 2022, 8:12 a.m. |
OK |
C# 8 |
TESTS |
56 |
124 |
3788800 |
|
1600 |
177542595 |
Gassa |
B |
Oct. 23, 2022, 8 a.m. |
OK |
D |
TESTS |
56 |
109 |
18944000 |
|
1600 |
177547903 |
hos.lyric |
B |
Oct. 23, 2022, 8:05 a.m. |
OK |
D |
TESTS |
56 |
124 |
23961600 |
|
1600 |
177562857 |
chro4896 |
B |
Oct. 23, 2022, 8:23 a.m. |
OK |
GNU C11 |
TESTS |
56 |
109 |
2048000 |
|
1600 |
177552179 |
Leasier |
B |
Oct. 23, 2022, 8:09 a.m. |
OK |
GNU C11 |
TESTS |
56 |
124 |
6041600 |
|
1600 |
177559174 |
CQYZWJH |
B |
Oct. 23, 2022, 8:18 a.m. |
OK |
GNU C++14 |
TESTS |
56 |
30 |
2048000 |
|
1600 |
177704193 |
ducati |
B |
Oct. 23, 2022, 11:48 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
31 |
2969600 |
|
1600 |
177707683 |
ducati |
B |
Oct. 24, 2022, 1:30 a.m. |
OK |
GNU C++14 |
TESTS |
58 |
31 |
2969600 |
|
1600 |
177558313 |
Iridescent2020 |
B |
Oct. 23, 2022, 8:17 a.m. |
OK |
GNU C++14 |
TESTS |
56 |
31 |
12390400 |
|
1600 |
177553444 |
happydef |
B |
Oct. 23, 2022, 8:11 a.m. |
OK |
GNU C++14 |
TESTS |
56 |
31 |
69529600 |
|
1600 |
177544555 |
20333333333 |
B |
Oct. 23, 2022, 8:02 a.m. |
OK |
GNU C++14 |
TESTS |
56 |
46 |
18124800 |
|
1600 |
177560719 |
enoamaoae |
B |
Oct. 23, 2022, 8:20 a.m. |
OK |
GNU C++14 |
TESTS |
56 |
46 |
22323200 |
|
1600 |
177552429 |
IcMtr |
B |
Oct. 23, 2022, 8:10 a.m. |
OK |
GNU C++14 |
TESTS |
56 |
93 |
1945600 |
|
1600 |
177556976 |
jiuruifu |
B |
Oct. 23, 2022, 8:15 a.m. |
OK |
GNU C++14 |
TESTS |
56 |
108 |
3993600 |
|
1600 |
177703310 |
Lq122030 |
B |
Oct. 23, 2022, 11:20 p.m. |
OK |
GNU C++14 |
TESTS |
58 |
109 |
3993600 |
|
1600 |
177586044 |
Bobocan |
B |
Oct. 23, 2022, 9:05 a.m. |
OK |
GNU C++17 |
TESTS |
56 |
31 |
2560000 |
|
1600 |
177566239 |
zhaojinxi |
B |
Oct. 23, 2022, 8:28 a.m. |
OK |
GNU C++17 |
TESTS |
56 |
31 |
6246400 |
|
1600 |
177552644 |
OctaneC8H18 |
B |
Oct. 23, 2022, 8:10 a.m. |
OK |
GNU C++17 |
TESTS |
56 |
124 |
1945600 |
|
1600 |
177650497 |
JunBinLiang |
B |
Oct. 23, 2022, 1:36 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
124 |
2048000 |
|
1600 |
177589672 |
ghoul932 |
B |
Oct. 23, 2022, 9:13 a.m. |
OK |
GNU C++17 |
TESTS |
56 |
124 |
2048000 |
|
1600 |
177589398 |
forerunner |
B |
Oct. 23, 2022, 9:12 a.m. |
OK |
GNU C++17 |
TESTS |
56 |
124 |
2048000 |
|
1600 |
177571480 |
nianheng233 |
B |
Oct. 23, 2022, 8:36 a.m. |
OK |
GNU C++17 |
TESTS |
56 |
124 |
2048000 |
|
1600 |
177553471 |
trainwithoutpain |
B |
Oct. 23, 2022, 8:11 a.m. |
OK |
GNU C++17 |
TESTS |
56 |
124 |
2048000 |
|
1600 |
177661151 |
dapingguo8 |
B |
Oct. 23, 2022, 2:52 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
124 |
2048000 |
|
1600 |
177698109 |
LucaLucaM |
B |
Oct. 23, 2022, 8:58 p.m. |
OK |
GNU C++17 |
TESTS |
58 |
124 |
2048000 |
|
1600 |
177564912 |
Hackenbush |
B |
Oct. 23, 2022, 8:26 a.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
31 |
2048000 |
|
1600 |
177557053 |
J_B_Y |
B |
Oct. 23, 2022, 8:15 a.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
31 |
2457600 |
|
1600 |
177546361 |
QAQAutoMaton |
B |
Oct. 23, 2022, 8:04 a.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
31 |
6246400 |
|
1600 |
177552594 |
bit5 |
B |
Oct. 23, 2022, 8:10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
31 |
10444800 |
|
1600 |
177548193 |
jockbutt |
B |
Oct. 23, 2022, 8:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
31 |
17100800 |
|
1600 |
177714734 |
jockbutt |
B |
Oct. 24, 2022, 3:42 a.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
31 |
17100800 |
|
1600 |
177680407 |
PurpleCrayon |
B |
Oct. 23, 2022, 5:39 p.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
77 |
2048000 |
|
1600 |
177552905 |
Sana |
B |
Oct. 23, 2022, 8:10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
77 |
2048000 |
|
1600 |
177718019 |
ChroneZU |
B |
Oct. 24, 2022, 4:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
58 |
78 |
2048000 |
|
1600 |
177562133 |
Lawali |
B |
Oct. 23, 2022, 8:22 a.m. |
OK |
GNU C++17 (64) |
TESTS |
56 |
78 |
2048000 |
|
1600 |
177545453 |
Depth_First_Search |
B |
Oct. 23, 2022, 8:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
56 |
31 |
2048000 |
|
1600 |
177561285 |
CLT |
B |
Oct. 23, 2022, 8:21 a.m. |
OK |
GNU C++20 (64) |
TESTS |
56 |
31 |
3993600 |
|
1600 |
177549528 |
maspy |
B |
Oct. 23, 2022, 8:07 a.m. |
OK |
GNU C++20 (64) |
TESTS |
56 |
31 |
4096000 |
|
1600 |
177704363 |
OotoriEmu |
B |
Oct. 23, 2022, 11:54 p.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
31 |
4096000 |
|
1600 |
177585396 |
METHOD_METAFALICA |
B |
Oct. 23, 2022, 9:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
56 |
31 |
6041600 |
|
1600 |
177650202 |
Sakuyalove |
B |
Oct. 23, 2022, 1:35 p.m. |
OK |
GNU C++20 (64) |
TESTS |
57 |
31 |
7168000 |
|
1600 |
177704362 |
Rencj |
B |
Oct. 23, 2022, 11:54 p.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
31 |
8089600 |
|
1600 |
177576773 |
Hencecho |
B |
Oct. 23, 2022, 8:46 a.m. |
OK |
GNU C++20 (64) |
TESTS |
56 |
46 |
150528000 |
|
1600 |
177710659 |
munhwas1140 |
B |
Oct. 24, 2022, 2:32 a.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
62 |
2048000 |
|
1600 |
177718240 |
catch22 |
B |
Oct. 24, 2022, 4:49 a.m. |
OK |
GNU C++20 (64) |
TESTS |
58 |
62 |
2048000 |
|
1600 |
177670811 |
kasiru_69 |
B |
Oct. 23, 2022, 4:10 p.m. |
OK |
Java 11 |
TESTS |
58 |
265 |
5734400 |
|
1600 |
177676638 |
aryangoyal2997 |
B |
Oct. 23, 2022, 5:04 p.m. |
OK |
Java 11 |
TESTS |
58 |
764 |
0 |
|
1600 |
177703412 |
KnightKnight |
B |
Oct. 23, 2022, 11:23 p.m. |
OK |
Java 11 |
TESTS |
58 |
951 |
34713600 |
|
1600 |
177591679 |
dusty.and.rusty |
B |
Oct. 23, 2022, 9:18 a.m. |
OK |
Java 17 |
TESTS |
56 |
499 |
48947200 |
|
1600 |
177558776 |
megaspazz |
B |
Oct. 23, 2022, 8:17 a.m. |
OK |
Java 8 |
TESTS |
56 |
155 |
0 |
|
1600 |
177545350 |
fetetriste |
B |
Oct. 23, 2022, 8:03 a.m. |
OK |
Java 8 |
TESTS |
56 |
202 |
13824000 |
|
1600 |
177570301 |
DarLam |
B |
Oct. 23, 2022, 8:34 a.m. |
OK |
Java 8 |
TESTS |
56 |
218 |
14438400 |
|
1600 |
177551485 |
EduRoundOnly |
B |
Oct. 23, 2022, 8:09 a.m. |
OK |
Kotlin 1.6 |
TESTS |
56 |
218 |
0 |
|
1600 |
177723178 |
LiuZhaocheng |
B |
Oct. 24, 2022, 6:03 a.m. |
OK |
MS C++ 2017 |
TESTS |
58 |
421 |
2048000 |
|
1600 |
177539533 |
ItamarNir |
B |
Oct. 23, 2022, 7:58 a.m. |
OK |
MS C++ 2017 |
TESTS |
56 |
421 |
2048000 |
|
1600 |
177569982 |
bcollet |
B |
Oct. 23, 2022, 8:34 a.m. |
OK |
PyPy 2 |
TESTS |
56 |
280 |
31334400 |
|
1600 |
177558380 |
SPD_9X2 |
B |
Oct. 23, 2022, 8:17 a.m. |
OK |
PyPy 3 |
TESTS |
56 |
436 |
44851200 |
|
1600 |
177580036 |
tassei903 |
B |
Oct. 23, 2022, 8:52 a.m. |
OK |
PyPy 3 |
TESTS |
56 |
452 |
35840000 |
|
1600 |
177557220 |
cai_lw |
B |
Oct. 23, 2022, 8:15 a.m. |
OK |
PyPy 3-64 |
TESTS |
56 |
171 |
34816000 |
|
1600 |
177712777 |
Alex239 |
B |
Oct. 24, 2022, 3:09 a.m. |
OK |
PyPy 3-64 |
TESTS |
58 |
186 |
44851200 |
|
1600 |
177589033 |
suncup224 |
B |
Oct. 23, 2022, 9:12 a.m. |
OK |
PyPy 3-64 |
TESTS |
56 |
187 |
40755200 |
|
1600 |
177561448 |
first_vil |
B |
Oct. 23, 2022, 8:21 a.m. |
OK |
PyPy 3-64 |
TESTS |
56 |
218 |
59904000 |
|
1600 |
177558074 |
toam |
B |
Oct. 23, 2022, 8:16 a.m. |
OK |
PyPy 3-64 |
TESTS |
56 |
218 |
60825600 |
|
1600 |
177549702 |
eepsilon |
B |
Oct. 23, 2022, 8:07 a.m. |
OK |
PyPy 3-64 |
TESTS |
56 |
218 |
61235200 |
|
1600 |
177572733 |
delena0702 |
B |
Oct. 23, 2022, 8:39 a.m. |
OK |
PyPy 3-64 |
TESTS |
56 |
218 |
61337600 |
|
1600 |
177545950 |
conqueror_of_tourist |
B |
Oct. 23, 2022, 8:03 a.m. |
OK |
PyPy 3-64 |
TESTS |
56 |
234 |
61337600 |
|
1600 |
177570019 |
oadey89 |
B |
Oct. 23, 2022, 8:34 a.m. |
OK |
PyPy 3-64 |
TESTS |
56 |
249 |
56729600 |
|
1600 |
177569520 |
9.86960440109 |
B |
Oct. 23, 2022, 8:33 a.m. |
OK |
PyPy 3-64 |
TESTS |
56 |
249 |
63283200 |
|
1600 |
177554099 |
Jimanbanashi |
B |
Oct. 23, 2022, 8:12 a.m. |
OK |
Python 2 |
TESTS |
56 |
420 |
27238400 |
|
1600 |
177654932 |
odinluca |
B |
Oct. 23, 2022, 2:04 p.m. |
OK |
Python 3 |
TESTS |
57 |
498 |
32972800 |
|
1600 |
177677756 |
Margylan |
B |
Oct. 23, 2022, 5:15 p.m. |
OK |
Python 3 |
TESTS |
58 |
560 |
32460800 |
|
1600 |
177576720 |
r57shell |
B |
Oct. 23, 2022, 8:46 a.m. |
OK |
Python 3 |
TESTS |
56 |
920 |
25395200 |
|
1600 |
177547213 |
sansen |
B |
Oct. 23, 2022, 8:04 a.m. |
OK |
Rust 2021 |
TESTS |
56 |
31 |
13312000 |
|
1600 |
177559135 |
sufficiently_large_boss |
B |
Oct. 23, 2022, 8:18 a.m. |
OK |
Rust 2021 |
TESTS |
56 |
62 |
14131200 |
|
1600 |
177562514 |
katand |
B |
Oct. 23, 2022, 8:22 a.m. |
OK |
Rust 2021 |
TESTS |
56 |
93 |
43724800 |
|
1600 |
remove filters
Back to search problems