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'Tenzing has an array a of length n and an integer v . Tenzing will perform the following operation m times: Tenzing wants to know the expected value of prod_{i=1}^n a_i after performing the m operations, modulo 10^9+7 . Formally, let M = 10^9+7 . It can be shown that the answer can be expressed as an irreducible fraction frac{p}{q} , where p and q are integers and q not equiv 0 pmod{M} . Output the integer equal to p cdot q^{-1} bmod M . In other words, output the integer x that 0 <= x < M and x cdot q equiv p pmod{M} . The first line of input contains three integers n , m and v ( 1 <= q n <= q 5000 , 1 <= q m,v <= q 10^9 ). The second line of input contains n integers a_1,a_2, ldots,a_n ( 1 <= q a_i <= q 10^9 ). Output the expected value of prod_{i=1}^n a_i modulo 10^9+7 . There are three types of a after performing all the m operations : 1. a_1=2,a_2=12 with frac{1}{4} probability. 2. a_1=a_2=12 with frac{1}{4} probability. 3. a_1=7,a_2=12 with frac{1}{2} probability. So the expected value of a_1 cdot a_2 is frac{1}{4} cdot (24+144) + frac{1}{2} cdot 84=84 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
210980834 |
KumaTachiRen |
G |
June 25, 2023, 1:25 a.m. |
OK |
C# 8 |
TESTS |
81 |
280 |
1536000 |
|
|
210965648 |
rainboy |
G |
June 24, 2023, 7:58 p.m. |
OK |
GNU C11 |
TESTS |
81 |
608 |
102400 |
|
|
210990360 |
_Diu_ |
G |
June 25, 2023, 5:10 a.m. |
OK |
GNU C++14 |
TESTS |
81 |
249 |
0 |
|
|
210986602 |
KING_OF_TURTLE |
G |
June 25, 2023, 3:52 a.m. |
OK |
GNU C++14 |
TESTS |
81 |
390 |
409600 |
|
|
210985320 |
MoRanSky |
G |
June 25, 2023, 3:22 a.m. |
OK |
GNU C++14 |
TESTS |
81 |
780 |
102400 |
|
|
210960296 |
0wuming0 |
G |
June 24, 2023, 6:53 p.m. |
OK |
GNU C++14 |
TESTS |
81 |
1559 |
200806400 |
|
|
210949073 |
DRA |
G |
June 24, 2023, 5 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
374 |
200704000 |
|
|
210938701 |
alireza_kaviani |
G |
June 24, 2023, 4:19 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
405 |
202035200 |
|
|
210945038 |
Forested |
G |
June 24, 2023, 4:44 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
483 |
409600 |
|
|
210985947 |
NKheyuxiang |
G |
June 25, 2023, 3:37 a.m. |
OK |
GNU C++17 |
TESTS |
81 |
514 |
200806400 |
|
|
210957538 |
HuTao_Oya_OyaOya |
G |
June 24, 2023, 6:25 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
592 |
100454400 |
|
|
210949363 |
TeasingMaster |
G |
June 24, 2023, 5:01 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
592 |
202444800 |
|
|
210946670 |
penguinhacker |
G |
June 24, 2023, 4:50 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
624 |
102400 |
|
|
210975051 |
Cyborg_1 |
G |
June 24, 2023, 10:42 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
748 |
512000 |
|
|
210942050 |
i_will_be_less_than_blue |
G |
June 24, 2023, 4:32 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
794 |
402636800 |
|
|
210936010 |
yuto1115 |
G |
June 24, 2023, 4:11 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
1013 |
201216000 |
|
|
210981674 |
yyyyxh |
G |
June 25, 2023, 1:48 a.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
62 |
0 |
|
|
210978314 |
nicksms |
G |
June 25, 2023, 12:12 a.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
93 |
102400 |
|
|
210939031 |
q-w-q-w-q |
G |
June 24, 2023, 4:21 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
93 |
100454400 |
|
|
210940193 |
dorijanlendvaj |
G |
June 24, 2023, 4:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
93 |
100659200 |
|
|
210967571 |
Kude |
G |
June 24, 2023, 8:25 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
109 |
0 |
|
|
210980696 |
SanweiTreap |
G |
June 25, 2023, 1:22 a.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
109 |
102400 |
|
|
210981116 |
neal |
G |
June 25, 2023, 1:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
109 |
4096000 |
|
|
210937008 |
AoLiGei |
G |
June 24, 2023, 4:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
124 |
7270400 |
|
|
210938602 |
Warriors_fsy |
G |
June 24, 2023, 4:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
140 |
102400 |
|
|
210944413 |
yzc2005 |
G |
June 24, 2023, 4:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
140 |
100454400 |
|
|
210955849 |
abeker |
G |
June 24, 2023, 6:12 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
61 |
0 |
|
|
210963856 |
abc864197532 |
G |
June 24, 2023, 7:35 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
62 |
102400 |
|
|
210945751 |
Golovanov399 |
G |
June 24, 2023, 4:47 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
78 |
102400 |
|
|
210986587 |
Legitimity |
G |
June 25, 2023, 3:52 a.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
93 |
202752000 |
|
|
210986784 |
xianboyu |
G |
June 25, 2023, 3:56 a.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
109 |
0 |
|
|
210954354 |
Low-Deny-Cup |
G |
June 24, 2023, 6:02 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
109 |
204800 |
|
|
210990088 |
keta_tsimakuridze |
G |
June 25, 2023, 5:05 a.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
124 |
1638400 |
|
|
210972499 |
nishkarsh |
G |
June 24, 2023, 9:45 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
124 |
4198400 |
|
|
210985159 |
juju527 |
G |
June 25, 2023, 3:18 a.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
124 |
100352000 |
|
|
210982205 |
MakaPakka |
G |
June 25, 2023, 2:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
124 |
100454400 |
|
|
remove filters
Back to search problems