CodeCraft-20 (Div. 2)

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1316 CodeCraft-20 (Div. 2) FINISHED False 7200 148490699 March 4, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 809 ) F Battalion Strength PROGRAMMING data structures divide and conquer probabilities 2800

B"There are n officers in the Army of Byteland. Each officer has some power associated with him. The power of the i -th officer is denoted by p_{i} . As the war is fast approaching, the General would like to know the strength of the army. The strength of an army is calculated in a strange way in Byteland. The General selects a random subset of officers from these n officers and calls this subset a battalion.(All 2^n subsets of the n officers can be chosen equally likely, including empty subset and the subset of all officers). The strength of a battalion is calculated in the following way: Let the powers of the chosen officers be a_{1},a_{2}, ldots,a_{k} , where a_1 <= a_2 <= ... <= a_k . The strength of this battalion is equal to a_1a_2 + a_2a_3 + ... + a_{k-1}a_k . (If the size of Battalion is <= q 1 , then the strength of this battalion is 0 ). The strength of the army is equal to the expected value of the strength of the battalion. As the war is really long, the powers of officers may change. Precisely, there will be q changes. Each one of the form i x indicating that p_{i} is changed to x . You need to find the strength of the army initially and after each of these q updates. Note that the changes are permanent. The strength should be found by modulo 10^{9}+7 . Formally, let M=10^{9}+7 . It can be shown that the answer can be expressed as an irreducible fraction p/q , where p and q are integers and q not equiv 0 bmod M ). Output the integer equal to p cdot q^{-1} bmod M . In other words, output such an integer x that 0 <= q x < M and x xe2 x8b x85 q equiv p bmod M ). The first line of the input contains a single integer n ( 1 <= q n <= q 3 xe2 x8b x8510^{5} ) -- the number of officers in Byteland's Army. The second line contains n integers p_{1},p_{2}, ldots,p_{n} ( 1 <= q p_{i} <= q 10^{"...

Tutorials

Codecraft-20 (Div.2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
72450856 rainboy F March 4, 2020, 4 p.m. OK GNU C11 TESTS 103 2761 37273600 2800
72506179 Backseat-Stargazer F March 5, 2020, 11:19 a.m. OK GNU C++11 TESTS 103 982 50380800 2800
72493738 DeaphetS F March 5, 2020, 7:40 a.m. OK GNU C++11 TESTS 103 1013 50483200 2800
72592576 danya090699 F March 6, 2020, 5:40 p.m. OK GNU C++11 TESTS 103 1123 59494400 2800
72518714 LTK_Inha F March 5, 2020, 2:26 p.m. OK GNU C++11 TESTS 103 1169 64921600 2800
72582191 EncodeTalker F March 6, 2020, 2:58 p.m. OK GNU C++11 TESTS 103 1200 88985600 2800
72455261 Pigbrain F March 4, 2020, 4:16 p.m. OK GNU C++11 TESTS 103 1310 72601600 2800
72495917 Kubic F March 5, 2020, 8:26 a.m. OK GNU C++11 TESTS 103 1341 52940800 2800
72546230 superbigjuruo F March 6, 2020, 1:51 a.m. OK GNU C++11 TESTS 103 1512 42086400 2800
72480705 Frame233 F March 5, 2020, 1:46 a.m. OK GNU C++11 TESTS 103 1528 75776000 2800
72570524 code_struck F March 6, 2020, 11:57 a.m. OK GNU C++11 TESTS 103 1575 58470400 2800
72526054 mateusz F March 5, 2020, 4:25 p.m. OK GNU C++14 TESTS 103 998 71782400 2800
72581810 ddykz F March 6, 2020, 2:52 p.m. OK GNU C++14 TESTS 103 1434 88985600 2800
72498772 yan-zp F March 5, 2020, 9:14 a.m. OK GNU C++14 TESTS 103 1512 67276800 2800
72528977 BakaC1rno F March 5, 2020, 5:14 p.m. OK GNU C++14 TESTS 103 1512 92569600 2800
72571806 meowmeow321 F March 6, 2020, 12:17 p.m. OK GNU C++14 TESTS 103 1559 65126400 2800
72529397 BakaC1rno F March 5, 2020, 5:22 p.m. OK GNU C++14 TESTS 103 1559 92569600 2800
72466541 Nyaan F March 4, 2020, 7:06 p.m. OK GNU C++14 TESTS 103 1590 45670400 2800
72572571 meowmeow321 F March 6, 2020, 12:30 p.m. OK GNU C++14 TESTS 103 1684 65228800 2800
72444313 tmwilliamlin168 F March 4, 2020, 3:36 p.m. OK GNU C++14 TESTS 103 1746 88268800 2800
72478116 kmjp F March 5, 2020, 12:03 a.m. OK GNU C++14 TESTS 103 1747 134963200 2800
72504525 cerberus97 F March 5, 2020, 10:50 a.m. OK GNU C++17 TESTS 103 1154 59494400 2800
72547143 Suzukaze F March 6, 2020, 2:35 a.m. OK GNU C++17 TESTS 103 1154 94310400 2800
72520685 Rahul F March 5, 2020, 2:56 p.m. OK GNU C++17 TESTS 103 1169 39321600 2800
72448478 natsugiri F March 4, 2020, 3:51 p.m. OK GNU C++17 TESTS 103 1200 51712000 2800
72448757 Egor F March 4, 2020, 3:52 p.m. OK GNU C++17 TESTS 103 1263 53555200 2800
72523397 jhdonghj112 F March 5, 2020, 3:40 p.m. OK GNU C++17 TESTS 103 1310 55296000 2800
72568662 WaluntOvO F March 6, 2020, 11:23 a.m. OK GNU C++17 TESTS 103 1357 60108800 2800
72452025 Golovanov399 F March 4, 2020, 4:04 p.m. OK GNU C++17 TESTS 103 1372 49254400 2800
72558838 ILLLZKQF F March 6, 2020, 7:57 a.m. OK GNU C++17 TESTS 103 1388 117862400 2800
72510581 Felerius F March 5, 2020, 12:28 p.m. OK GNU C++17 TESTS 103 1404 49254400 2800
72546415 Suzukaze F March 6, 2020, 2:01 a.m. OK Java 11 TESTS 103 3556 162918400 2800
72481851 cwise F March 5, 2020, 2:26 a.m. OK Java 8 TESTS 103 3025 88576000 2800
72481980 cwise F March 5, 2020, 2:31 a.m. OK Java 8 TESTS 103 3041 88576000 2800
72511446 DarLam F March 5, 2020, 12:41 p.m. OK Java 8 TESTS 103 4992 27033600 2800
72515514 Spheniscine F March 5, 2020, 1:38 p.m. OK Kotlin TESTS 103 2682 63385600 2800
72515140 Spheniscine F March 5, 2020, 1:33 p.m. OK Kotlin TESTS 103 2713 63590400 2800
72512152 Spheniscine F March 5, 2020, 12:51 p.m. OK Kotlin TESTS 103 2947 102400000 2800
72513245 AleksanderBalobanov F March 5, 2020, 1:06 p.m. OK MS C++ 2017 TESTS 103 1388 64921600 2800
72466600 pajenegod F March 4, 2020, 7:07 p.m. OK PyPy 2 TESTS 103 1372 78438400 2800
72470041 sansen F March 4, 2020, 7:56 p.m. OK Rust TESTS 103 1184 55296000 2800

remove filters

Back to search problems