Educational Codeforces Round 114 (Rated for 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
1574 Educational Codeforces Round 114 (Rated for Div. 2) FINISHED False 7200 105031463 Sept. 20, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 17388 ) C Slay the Dragon PROGRAMMING binary search greedy sortings

B'Recently, Petya learned about a new game "Slay the Dragon". As the name suggests, the player will have to fight with dragons. To defeat a dragon, you have to kill it and defend your castle. To do this, the player has a squad of n heroes, the strength of the i -th hero is equal to a_i . According to the rules of the game, exactly one hero should go kill the dragon, all the others will defend the castle. If the dragon 's defense is equal to x , then you have to send a hero with a strength of at least x to kill it. If the dragon 's attack power is y , then the total strength of the heroes defending the castle should be at least y . The player can increase the strength of any hero by 1 for one gold coin. This operation can be done any number of times. There are m dragons in the game, the i -th of them has defense equal to x_i and attack power equal to y_i . Petya was wondering what is the minimum number of coins he needs to spend to defeat the i -th dragon. Note that the task is solved independently for each dragon (improvements are not saved). The first line contains a single integer n ( 2 <= n <= 2 cdot 10^5 ) -- number of heroes. The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^{12} ), where a_i is the strength of the i -th hero. The third line contains a single integer m ( 1 <= m <= 2 cdot 10^5 ) -- the number of dragons. The next m lines contain two integers each, x_i and y_i ( 1 <= x_i <= 10^{12}; 1 <= y_i <= 10^{18} ) -- defense and attack power of the i -th dragon. Print m lines, i -th of which contains a single integer -- the minimum number of coins that should be spent to defeat the i -th dragon. To defeat the first dragon, you can increase the strength of the third hero by 1 , then the strength of the heroes will be equal to [3, 6, 3, 3] . '...

Tutorials

95188

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
129437488 cyrus_msk C Sept. 20, 2021, 8:21 p.m. OK D TESTS 8 1388 81203200
129424439 Mrgglock C Sept. 20, 2021, 5:33 p.m. OK GNU C11 TESTS 8 1060 8499200
129425415 rainboy C Sept. 20, 2021, 5:42 p.m. OK GNU C11 TESTS 8 1075 5324800
129449435 ecjtuQAQ C Sept. 21, 2021, 2:22 a.m. OK GNU C++14 TESTS 9 233 10649600
129445141 Capitalist_Wang C Sept. 21, 2021, 12:15 a.m. OK GNU C++14 TESTS 9 295 5324800
129448206 zzzgw C Sept. 21, 2021, 1:51 a.m. OK GNU C++14 TESTS 9 296 5324800
129424086 yycyyc C Sept. 20, 2021, 5:30 p.m. OK GNU C++14 TESTS 8 311 8499200
129426356 jiuzhem C Sept. 20, 2021, 5:51 p.m. OK GNU C++14 TESTS 8 342 5324800
129455328 tjd229 C Sept. 21, 2021, 4:13 a.m. OK GNU C++14 TESTS 9 342 6963200
129450863 xuangou C Sept. 21, 2021, 2:50 a.m. OK GNU C++14 TESTS 9 343 5324800
129450251 IIoes C Sept. 21, 2021, 2:39 a.m. OK GNU C++14 TESTS 9 343 5324800
129453745 Dasheverless C Sept. 21, 2021, 3:44 a.m. OK GNU C++14 TESTS 9 343 5324800
129457175 looop C Sept. 21, 2021, 4:44 a.m. OK GNU C++14 TESTS 9 343 5324800
129449215 __Marksky C Sept. 21, 2021, 2:17 a.m. OK GNU C++17 TESTS 9 187 10649600
129423920 Mrgglock C Sept. 20, 2021, 5:29 p.m. OK GNU C++17 TESTS 8 295 6963200
129423523 Mrgglock C Sept. 20, 2021, 5:26 p.m. OK GNU C++17 TESTS 8 296 6963200
129423225 caan_do C Sept. 20, 2021, 5:23 p.m. OK GNU C++17 TESTS 8 327 6963200
129434983 Rabby33 C Sept. 20, 2021, 7:39 p.m. OK GNU C++17 TESTS 8 342 6963200
129415768 coolboy7 C Sept. 20, 2021, 4:37 p.m. OK GNU C++17 TESTS 8 343 5324800
129447572 Fau818 tjrac6019203189 C Sept. 21, 2021, 1:35 a.m. OK GNU C++17 TESTS 9 343 5324800
129437345 houren C Sept. 20, 2021, 8:19 p.m. OK GNU C++17 TESTS 8 343 5324800
129453529 1028459932 C Sept. 21, 2021, 3:40 a.m. OK GNU C++17 TESTS 9 358 5324800
129458092 IG-thexuan C Sept. 21, 2021, 4:59 a.m. OK GNU C++17 TESTS 9 358 5324800
129432548 jt.cheng26_orz C Sept. 20, 2021, 7:03 p.m. OK GNU C++17 (64) TESTS 8 109 6144000
129445726 njwrz C Sept. 21, 2021, 12:36 a.m. OK GNU C++17 (64) TESTS 9 124 73113600
129415473 zuichudemengxiang C Sept. 20, 2021, 4:34 p.m. OK GNU C++17 (64) TESTS 8 218 5939200
129445865 augg1e C Sept. 21, 2021, 12:40 a.m. OK GNU C++17 (64) TESTS 9 233 5939200
129443358 nlog C Sept. 20, 2021, 11:05 p.m. OK GNU C++17 (64) TESTS 9 233 5939200
129441991 ScarletS C Sept. 20, 2021, 10:14 p.m. OK GNU C++17 (64) TESTS 8 233 5939200
129440444 waste_of_space C Sept. 20, 2021, 9:26 p.m. OK GNU C++17 (64) TESTS 8 233 5939200
129435961 wjli C Sept. 20, 2021, 7:54 p.m. OK GNU C++17 (64) TESTS 8 233 5939200
129460797 rath772k C Sept. 21, 2021, 5:41 a.m. OK GNU C++17 (64) TESTS 9 233 5939200
129450123 Ryuzaki_L_07 C Sept. 21, 2021, 2:36 a.m. OK GNU C++17 (64) TESTS 9 233 5939200
129415145 Sarvjeet619 C Sept. 20, 2021, 4:34 p.m. OK Java 11 TESTS 8 483 35328000
129420505 vipulm7 C Sept. 20, 2021, 5:03 p.m. OK Java 11 TESTS 8 514 30105600
129431842 SaberXpro C Sept. 20, 2021, 6:54 p.m. OK Java 11 TESTS 8 545 29081600
129438642 Mihail_Zybenko C Sept. 20, 2021, 8:45 p.m. OK Java 11 TESTS 8 545 29184000
129438535 XerSon C Sept. 20, 2021, 8:43 p.m. OK Java 11 TESTS 8 545 29184000
129437506 megyeri99 C Sept. 20, 2021, 8:22 p.m. OK Java 11 TESTS 8 561 31027200
129412384 Comrad C Sept. 20, 2021, 4:30 p.m. OK Java 11 TESTS 8 607 29184000
129442604 Fubuki_AI C Sept. 20, 2021, 10:36 p.m. OK Java 11 TESTS 8 608 42905600
129456729 zoro_hiyori C Sept. 21, 2021, 4:36 a.m. OK Java 11 TESTS 9 639 43008000
129460817 rohanyeahyeah C Sept. 21, 2021, 5:41 a.m. OK Java 11 TESTS 9 655 29184000
129454300 Marig_Weizhi C Sept. 21, 2021, 3:54 a.m. OK Java 8 TESTS 9 358 20992000
129427874 fan_balae C Sept. 20, 2021, 6:06 p.m. OK Java 8 TESTS 8 373 25600000
129451054 Khadija_badrawy C Sept. 21, 2021, 2:54 a.m. OK Java 8 TESTS 9 467 36454400
129459752 pdk.abhishek C Sept. 21, 2021, 5:26 a.m. OK Java 8 TESTS 9 483 37990400
129453558 Marig_Weizhi C Sept. 21, 2021, 3:40 a.m. OK Java 8 TESTS 9 498 36454400
129459548 pdk.abhishek C Sept. 21, 2021, 5:23 a.m. OK Java 8 TESTS 9 514 37990400
129459519 pdk.abhishek C Sept. 21, 2021, 5:22 a.m. OK Java 8 TESTS 9 514 37990400
129451409 HastaLaVistaLa C Sept. 21, 2021, 3 a.m. OK Java 8 TESTS 9 529 72192000
129434297 dheerajchhatanidc C Sept. 20, 2021, 7:28 p.m. OK Java 8 TESTS 8 576 39424000
129422532 sajal7295 C Sept. 20, 2021, 5:17 p.m. OK Java 8 TESTS 8 608 37990400
129426014 Gompu123 C Sept. 20, 2021, 5:48 p.m. OK Kotlin TESTS 8 686 47001600
129452842 guud222 C Sept. 21, 2021, 3:27 a.m. OK MS C++ 2017 TESTS 9 343 5324800
129449784 break_dream C Sept. 21, 2021, 2:29 a.m. OK MS C++ 2017 TESTS 9 358 5324800
129448755 suing_ C Sept. 21, 2021, 2:06 a.m. OK MS C++ 2017 TESTS 9 358 5324800
129423026 kernel.bin C Sept. 20, 2021, 5:21 p.m. OK MS C++ 2017 TESTS 8 374 5324800
129447522 taotaotao123 C Sept. 21, 2021, 1:33 a.m. OK MS C++ 2017 TESTS 9 483 22118400
129420013 Tangerine C Sept. 20, 2021, 4:59 p.m. OK MS C++ 2017 TESTS 8 904 8499200
129450580 cmj0922 C Sept. 21, 2021, 2:45 a.m. OK MS C++ 2017 TESTS 9 919 7270400
129434796 abbkrnnl1 C Sept. 20, 2021, 7:35 p.m. OK MS C++ 2017 TESTS 8 935 5324800
129452097 cmj0922 C Sept. 21, 2021, 3:13 a.m. OK MS C++ 2017 TESTS 9 950 7372800
129419372 lanwang C Sept. 20, 2021, 4:56 p.m. OK MS C++ 2017 TESTS 8 1591 6963200
129456225 Greyhound C Sept. 21, 2021, 4:27 a.m. OK PyPy 3 TESTS 9 1201 66150400
129432883 strivetodeath C Sept. 20, 2021, 7:08 p.m. OK PyPy 3 TESTS 8 1262 68812800
129432832 strivetodeath C Sept. 20, 2021, 7:07 p.m. OK PyPy 3 TESTS 8 1278 68710400
129432853 strivetodeath C Sept. 20, 2021, 7:08 p.m. OK PyPy 3 TESTS 8 1310 68710400
129437108 strivetodeath C Sept. 20, 2021, 8:15 p.m. OK PyPy 3 TESTS 8 1310 121651200
129457265 shubh67678 C Sept. 21, 2021, 4:45 a.m. OK PyPy 3 TESTS 9 1340 70348800
129421276 VN.Kiet C Sept. 20, 2021, 5:08 p.m. OK PyPy 3 TESTS 8 1341 66048000
129421954 not_akshitm16 C Sept. 20, 2021, 5:13 p.m. OK PyPy 3 TESTS 8 1372 65536000
129418570 not_akshitm16 C Sept. 20, 2021, 4:51 p.m. OK PyPy 3 TESTS 8 1387 66048000
129428967 deepanshu_pali C Sept. 20, 2021, 6:18 p.m. OK PyPy 3 TESTS 8 1403 66560000
129437848 neel0086 C Sept. 20, 2021, 8:29 p.m. OK Python 3 TESTS 8 1200 25088000
129421257 SgnJp C Sept. 20, 2021, 5:08 p.m. OK Python 3 TESTS 8 1263 24576000
129417545 mezzou C Sept. 20, 2021, 4:46 p.m. OK Python 3 TESTS 8 1278 25190400
129421289 SgnJp C Sept. 20, 2021, 5:08 p.m. OK Python 3 TESTS 8 1294 24576000
129422122 SgnJp C Sept. 20, 2021, 5:14 p.m. OK Python 3 TESTS 8 1294 25190400
129435661 Skillful_Wanderer C Sept. 20, 2021, 7:49 p.m. OK Python 3 TESTS 8 1310 24576000
129419532 couhP1903 C Sept. 20, 2021, 4:57 p.m. OK Python 3 TESTS 8 1341 24576000
129455690 saurabh3195 C Sept. 21, 2021, 4:18 a.m. OK Python 3 TESTS 9 1357 24576000
129417411 kgtekito C Sept. 20, 2021, 4:45 p.m. OK Python 3 TESTS 8 1387 25088000
129422223 SgnJp C Sept. 20, 2021, 5:15 p.m. OK Python 3 TESTS 8 1387 25190400
129436256 noogler C Sept. 20, 2021, 8 p.m. OK Rust TESTS 8 311 16588800
129436792 noogler C Sept. 20, 2021, 8:09 p.m. OK Rust TESTS 8 312 16588800
129445893 Spheniscine C Sept. 21, 2021, 12:41 a.m. OK Rust TESTS 9 327 5529600
129440323 IvanDyachenko C Sept. 20, 2021, 9:23 p.m. OK Scala TESTS 8 1076 57139200

remove filters

Back to search problems