Codeforces Round 354 (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
676 Codeforces Round 354 (Div. 2) FINISHED False 7200 273423304 May 25, 2016, 3:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 13908 ) A Nicholas and Permutation PROGRAMMING constructive algorithms implementation 1000

B'Nicholas has an array a that contains n distinct integers from 1 to n. In other words, Nicholas has a permutation of size n. Nicholas want the minimum element (integer 1) and the maximum element (integer n) to be as far as possible from each other. He wants to perform exactly one swap in order to maximize the distance between the minimum and the maximum elements. The distance between two elements is considered to be equal to the absolute difference between their positions. The first line of the input contains a single integer n (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100) -- the size of the permutation. The second line of the input contains n distinct integers a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n), where ai is equal to the element at the i-th position. Print a single integer -- the maximum possible distance between the minimum and the maximum elements Nicholas can achieve by performing exactly one swap. In the first sample, one may obtain the optimal answer by swapping elements 1 and 2. In the second sample, the minimum and the maximum elements will be located in the opposite ends of the array if we swap 7 and 2. In the third sample, the distance between the minimum and the maximum elements is already maximum possible, so we just perform some unnecessary swap, for example, one can swap 5 and 2. '...

Tutorials

Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
18074808 Z8N A May 25, 2016, 3:13 p.m. OK Delphi TESTS 159 31 2662400 1000
18076798 NotOsikov A May 25, 2016, 3:21 p.m. OK Delphi TESTS 159 31 2764800 1000
18074685 ruban A May 25, 2016, 3:12 p.m. OK Delphi TESTS 159 31 34816000 1000
18087069 PAG A May 25, 2016, 4:46 p.m. OK FPC TESTS 159 15 1740800 1000
18076082 banany2001 A May 25, 2016, 3:18 p.m. OK FPC TESTS 159 15 1740800 1000
18074019 dmlocdmloc A May 25, 2016, 3:10 p.m. OK FPC TESTS 159 15 1945600 1000
18079402 Diarda A May 25, 2016, 3:38 p.m. OK FPC TESTS 159 30 1740800 1000
18078757 kenichi_9xpro A May 25, 2016, 3:34 p.m. OK FPC TESTS 159 30 1740800 1000
18078640 thtnqwe A May 25, 2016, 3:33 p.m. OK FPC TESTS 159 30 1740800 1000
18075464 Markellonchik A May 25, 2016, 3:15 p.m. OK FPC TESTS 159 30 1740800 1000
18075377 Ahriman A May 25, 2016, 3:15 p.m. OK FPC TESTS 159 30 1740800 1000
18076691 huynhnhat A May 25, 2016, 3:21 p.m. OK FPC TESTS 159 30 1945600 1000
18076205 miltonbw A May 25, 2016, 3:18 p.m. OK FPC TESTS 159 30 1945600 1000
18086148 Orpib A May 25, 2016, 4:38 p.m. OK GNU C TESTS 159 15 2048000 1000
18080870 mhiceiu A May 25, 2016, 3:50 p.m. OK GNU C TESTS 159 15 2048000 1000
18079395 shubhangipri A May 25, 2016, 3:38 p.m. OK GNU C TESTS 159 15 2048000 1000
18079120 Anti-Jermy A May 25, 2016, 3:37 p.m. OK GNU C TESTS 159 15 2048000 1000
18079039 Actsins A May 25, 2016, 3:36 p.m. OK GNU C TESTS 159 15 2048000 1000
18078966 Taran106 A May 25, 2016, 3:35 p.m. OK GNU C TESTS 159 15 2048000 1000
18076535 Thiagohnc A May 25, 2016, 3:20 p.m. OK GNU C TESTS 159 15 2048000 1000
18075351 -NOOB- A May 25, 2016, 3:15 p.m. OK GNU C TESTS 159 15 2048000 1000
18085620 naman545 A May 25, 2016, 4:33 p.m. OK GNU C TESTS 159 30 2048000 1000
18084029 Anisur_Rahman A May 25, 2016, 4:17 p.m. OK GNU C TESTS 159 30 2048000 1000
18081131 ovis96 A May 25, 2016, 3:52 p.m. OK GNU C++ TESTS 159 15 2048000 1000
18083115 cod_muskeeter A May 25, 2016, 4:09 p.m. OK GNU C++ TESTS 159 15 2048000 1000
18079208 Lee52 A May 25, 2016, 3:37 p.m. OK GNU C++ TESTS 159 15 2048000 1000
18078799 grated A May 25, 2016, 3:34 p.m. OK GNU C++ TESTS 159 15 2048000 1000
18077875 xingzhiruan A May 25, 2016, 3:28 p.m. OK GNU C++ TESTS 159 15 2048000 1000
18077527 zmx19951103 A May 25, 2016, 3:26 p.m. OK GNU C++ TESTS 159 15 2048000 1000
18077454 push-0_coder A May 25, 2016, 3:25 p.m. OK GNU C++ TESTS 159 15 2048000 1000
18077294 prachin_roy A May 25, 2016, 3:24 p.m. OK GNU C++ TESTS 159 15 2048000 1000
18077194 chansarav A May 25, 2016, 3:24 p.m. OK GNU C++ TESTS 159 15 2048000 1000
18077117 Lxyan A May 25, 2016, 3:23 p.m. OK GNU C++ TESTS 159 15 2048000 1000
18079347 gametube8 A May 25, 2016, 3:38 p.m. OK GNU C11 TESTS 159 15 2048000 1000
18078391 Ahsan_Rejwan A May 25, 2016, 3:31 p.m. OK GNU C11 TESTS 159 15 2048000 1000
18078502 1041287344 A May 25, 2016, 3:32 p.m. OK GNU C11 TESTS 159 30 2048000 1000
18088360 Blue_ghost A May 25, 2016, 4:58 p.m. OK GNU C11 TESTS 159 31 2048000 1000
18085015 Farhan007 A May 25, 2016, 4:27 p.m. OK GNU C11 TESTS 159 31 2048000 1000
18080059 zihad898 A May 25, 2016, 3:43 p.m. OK GNU C11 TESTS 159 31 2048000 1000
18077974 teja95 A May 25, 2016, 3:29 p.m. OK GNU C11 TESTS 159 31 2048000 1000
18076658 vasu14115 A May 25, 2016, 3:20 p.m. OK GNU C11 TESTS 159 31 2048000 1000
18075185 infinity A May 25, 2016, 3:14 p.m. OK GNU C++11 TESTS 159 15 2048000 1000
18074856 Mr_black A May 25, 2016, 3:13 p.m. OK GNU C++11 TESTS 159 15 2048000 1000
18082589 awaking_soul A May 25, 2016, 4:04 p.m. OK GNU C++11 TESTS 159 15 2048000 1000
18079802 cttung A May 25, 2016, 3:42 p.m. OK GNU C++11 TESTS 159 15 2048000 1000
18077428 nazmulasha A May 25, 2016, 3:25 p.m. OK GNU C++11 TESTS 159 15 2048000 1000
18077364 xavier A May 25, 2016, 3:25 p.m. OK GNU C++11 TESTS 159 15 2048000 1000
18076598 Beorn A May 25, 2016, 3:20 p.m. OK GNU C++11 TESTS 159 15 2048000 1000
18076113 szymonkot1 A May 25, 2016, 3:18 p.m. OK GNU C++11 TESTS 159 15 2048000 1000
18075659 blacktea123 A May 25, 2016, 3:16 p.m. OK GNU C++11 TESTS 159 15 2048000 1000
18075572 ltomic A May 25, 2016, 3:15 p.m. OK GNU C++11 TESTS 159 15 2048000 1000
18084249 daswas A May 25, 2016, 4:20 p.m. OK Go TESTS 159 46 6041600 1000
18079367 TheParad1se A May 25, 2016, 3:38 p.m. OK Java 7 TESTS 159 109 39116800 1000
18077417 younesleroi13 A May 25, 2016, 3:25 p.m. OK Java 7 TESTS 159 124 38912000 1000
18083200 mocshare17 A May 25, 2016, 4:10 p.m. OK Java 7 TESTS 159 124 39014400 1000
18079451 Mohannad A May 25, 2016, 3:39 p.m. OK Java 7 TESTS 159 124 39014400 1000
18076629 Sanatbek A May 25, 2016, 3:20 p.m. OK Java 7 TESTS 159 124 39014400 1000
18076560 trk A May 25, 2016, 3:20 p.m. OK Java 7 TESTS 159 124 39014400 1000
18076280 Korrot A May 25, 2016, 3:19 p.m. OK Java 7 TESTS 159 124 39014400 1000
18075927 chucha A May 25, 2016, 3:17 p.m. OK Java 7 TESTS 159 124 39014400 1000
18075670 sifatoooo A May 25, 2016, 3:16 p.m. OK Java 7 TESTS 159 124 39014400 1000
18074643 p1p13 A May 25, 2016, 3:12 p.m. OK Java 7 TESTS 159 124 39014400 1000
18076783 evil_beaver A May 25, 2016, 3:21 p.m. OK Java 8 TESTS 159 124 20275200 1000
18078650 Qazaqstan A May 25, 2016, 3:33 p.m. OK Java 8 TESTS 159 124 20582400 1000
18078983 shuangling A May 25, 2016, 3:35 p.m. OK Java 8 TESTS 159 124 20582400 1000
18077490 jetblack20 A May 25, 2016, 3:26 p.m. OK Java 8 TESTS 159 124 20582400 1000
18076194 JavaKurious A May 25, 2016, 3:18 p.m. OK Java 8 TESTS 159 124 20582400 1000
18075929 lebeg A May 25, 2016, 3:17 p.m. OK Java 8 TESTS 159 124 20582400 1000
18075657 visharad_05 A May 25, 2016, 3:16 p.m. OK Java 8 TESTS 159 124 20582400 1000
18075647 Raynger A May 25, 2016, 3:16 p.m. OK Java 8 TESTS 159 124 20582400 1000
18075399 Corvus A May 25, 2016, 3:15 p.m. OK Java 8 TESTS 159 124 20582400 1000
18074002 i_Love_Jaiman A May 25, 2016, 3:10 p.m. OK Java 8 TESTS 159 124 20582400 1000
18079449 StrangeGuy A May 25, 2016, 3:39 p.m. OK JavaScript TESTS 159 31 6041600 1000
18088088 GarmashSN603 A May 25, 2016, 4:56 p.m. OK MS C# TESTS 159 62 9216000 1000
18086796 iwa35 A May 25, 2016, 4:44 p.m. OK MS C# TESTS 159 62 9216000 1000
18080803 LarryLurex A May 25, 2016, 3:49 p.m. OK MS C# TESTS 159 62 9216000 1000
18079268 LevashovDA603 A May 25, 2016, 3:37 p.m. OK MS C# TESTS 159 62 9216000 1000
18077582 Egorsmir A May 25, 2016, 3:26 p.m. OK MS C# TESTS 159 62 9216000 1000
18076038 Tesla_d A May 25, 2016, 3:17 p.m. OK MS C# TESTS 159 62 9216000 1000
18074021 m.khooryani A May 25, 2016, 3:10 p.m. OK MS C# TESTS 159 62 9420800 1000
18076147 hdz A May 25, 2016, 3:18 p.m. OK MS C# TESTS 159 62 11571200 1000
18084255 LutsenckoAA603 A May 25, 2016, 4:20 p.m. OK MS C# TESTS 159 77 9216000 1000
18080246 Zedronar A May 25, 2016, 3:45 p.m. OK MS C# TESTS 159 77 9216000 1000
18077234 mhaj A May 25, 2016, 3:24 p.m. OK MS C++ TESTS 159 15 2048000 1000
18085981 customer101 A May 25, 2016, 4:36 p.m. OK MS C++ TESTS 159 15 2252800 1000
18083210 externalhardrive A May 25, 2016, 4:10 p.m. OK MS C++ TESTS 159 15 2252800 1000
18082867 ILoveBfsDfs A May 25, 2016, 4:07 p.m. OK MS C++ TESTS 159 15 2252800 1000
18079102 LampaHead A May 25, 2016, 3:36 p.m. OK MS C++ TESTS 159 15 2252800 1000
18078903 mmmb80 A May 25, 2016, 3:35 p.m. OK MS C++ TESTS 159 15 2252800 1000
18077570 Huyum_nik A May 25, 2016, 3:26 p.m. OK MS C++ TESTS 159 15 2252800 1000
18077071 wowoto9772 A May 25, 2016, 3:23 p.m. OK MS C++ TESTS 159 15 2252800 1000
18076881 GooYap A May 25, 2016, 3:22 p.m. OK MS C++ TESTS 159 15 2252800 1000
18076156 ZAFU_rookie A May 25, 2016, 3:18 p.m. OK MS C++ TESTS 159 15 2252800 1000
18074083 Darooha A May 25, 2016, 3:10 p.m. OK Ocaml TESTS 159 31 4096000 1000
18077796 mayakin A May 25, 2016, 3:28 p.m. OK PHP TESTS 159 62 4915200 1000
18074564 naresh7406 A May 25, 2016, 3:12 p.m. OK PyPy 2 TESTS 159 77 22630400 1000
18074270 demetoir A May 25, 2016, 3:11 p.m. OK PyPy 2 TESTS 159 249 35328000 1000
18074348 ogo A May 25, 2016, 3:11 p.m. OK PyPy 3 TESTS 159 109 23244800 1000
18079700 heyucongtom A May 25, 2016, 3:41 p.m. OK PyPy 3 TESTS 159 140 23244800 1000
18075031 yhn112 A May 25, 2016, 3:13 p.m. OK PyPy 3 TESTS 159 140 23244800 1000
18074730 SerVasilich A May 25, 2016, 3:12 p.m. OK PyPy 3 TESTS 159 140 23244800 1000
18073942 fallensoul A May 25, 2016, 3:10 p.m. OK PyPy 3 TESTS 159 155 23244800 1000
18073434 Vosatorp A May 25, 2016, 3:08 p.m. OK PyPy 3 TESTS 159 155 23244800 1000
18073474 Denzed A May 25, 2016, 3:08 p.m. OK PyPy 3 TESTS 159 202 23244800 1000
18081158 _Tornado_ A May 25, 2016, 3:52 p.m. OK Python 2 TESTS 159 61 4710400 1000
18077310 raviojha2105 A May 25, 2016, 3:24 p.m. OK Python 2 TESTS 159 62 4608000 1000
18084500 cliff_hanger A May 25, 2016, 4:22 p.m. OK Python 2 TESTS 159 62 4710400 1000
18079293 adityashrm21 A May 25, 2016, 3:38 p.m. OK Python 2 TESTS 159 62 4710400 1000
18079213 krystallize A May 25, 2016, 3:37 p.m. OK Python 2 TESTS 159 62 4710400 1000
18078821 coderbd A May 25, 2016, 3:34 p.m. OK Python 2 TESTS 159 62 4710400 1000
18077391 sjtuzlp A May 25, 2016, 3:25 p.m. OK Python 2 TESTS 159 62 4710400 1000
18077016 polarfool A May 25, 2016, 3:23 p.m. OK Python 2 TESTS 159 62 4710400 1000
18076685 uc-nuts A May 25, 2016, 3:21 p.m. OK Python 2 TESTS 159 62 4710400 1000
18076623 rabeckiy A May 25, 2016, 3:20 p.m. OK Python 2 TESTS 159 62 4710400 1000
18078659 pylol A May 25, 2016, 3:33 p.m. OK Python 3 TESTS 159 62 5120000 1000
18076686 LordVoldebug A May 25, 2016, 3:21 p.m. OK Python 3 TESTS 159 62 5120000 1000
18087277 MinQ A May 25, 2016, 4:48 p.m. OK Python 3 TESTS 159 62 5222400 1000
18081280 Constantor A May 25, 2016, 3:53 p.m. OK Python 3 TESTS 159 62 5222400 1000
18080030 peyha A May 25, 2016, 3:43 p.m. OK Python 3 TESTS 159 62 5222400 1000
18076130 MataMarrano A May 25, 2016, 3:18 p.m. OK Python 3 TESTS 159 62 5222400 1000
18075854 Aurinn A May 25, 2016, 3:17 p.m. OK Python 3 TESTS 159 62 5222400 1000
18075678 Renamed_Noname A May 25, 2016, 3:16 p.m. OK Python 3 TESTS 159 62 5222400 1000
18075426 whiord A May 25, 2016, 3:15 p.m. OK Python 3 TESTS 159 62 5222400 1000
18074555 sempav A May 25, 2016, 3:12 p.m. OK Python 3 TESTS 159 62 5222400 1000
18079689 wasiq.bhamla A May 25, 2016, 3:40 p.m. OK Ruby TESTS 159 78 6553600 1000
18077539 volodymyr.antoniuk A May 25, 2016, 3:26 p.m. OK Ruby TESTS 159 92 6553600 1000
18080125 wrick A May 25, 2016, 3:44 p.m. OK Scala TESTS 159 265 39731200 1000
18079563 Droidboy A May 25, 2016, 3:40 p.m. OK Scala TESTS 159 327 39936000 1000

remove filters

Back to search problems