School Team Contest 3 (Winter Computer School 2010/11)

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
45 School Team Contest 3 (Winter Computer School 2010/11) FINISHED False 18000 486673180 Nov. 13, 2010, 11 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1144 ) C Dancing Lessons PROGRAMMING data structures 2000

There are n people taking dancing lessons. Every person is characterized by his/her dancing skill a i . At the beginning of the lesson they line up from left to right. While there is at least one couple of a boy and a girl in the line, the following process is repeated: the boy and girl who stand next to each other, having the minimal difference in dancing skills start to dance. If there are several such couples, the one first from the left starts to dance. After a couple leaves to dance, the line closes again, i.e. as a result the line is always continuous. The difference in dancing skills is understood as the absolute value of difference of a i variable. Your task is to find out what pairs and in what order will start dancing. The first line contains an integer n ( 1 ≤ n ≤ 2·10 5 ) — the number of people. The next line contains n symbols B or G without spaces. B stands for a boy, G stands for a girl. The third line contains n space-separated integers a i ( 1 ≤ a i ≤ 10 7 ) — the dancing skill. People are specified from left to right in the order in which they lined up. Print the resulting number of couples k . Then print k lines containing two numerals each — the numbers of people forming the couple. The people are numbered with integers from 1 to n from left to right. When a couple leaves to dance you shouldn't renumber the people. The numbers in one couple should be sorted in the increasing order. Print the couples in the order in which they leave to dance.

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
194992 Ministr Georgy Vladl1313 C Nov. 13, 2010, 3:52 p.m. OK Delphi TESTS 31 200 45363200 2000
195065 Anton92nd mimirrow ilya.korovin C Nov. 13, 2010, 3:58 p.m. OK Delphi TESTS 31 230 10752000 2000
193250 tourist C Nov. 13, 2010, 1:11 p.m. OK Delphi TESTS 31 300 19251200 2000
193773 BLIZZARD GR1n map C Nov. 13, 2010, 1:47 p.m. OK Delphi TESTS 31 780 31846400 2000
192435 flashmt C Nov. 13, 2010, 12:21 p.m. OK FPC TESTS 31 200 7475200 2000
194564 Beetl C Nov. 13, 2010, 3:06 p.m. OK FPC TESTS 31 250 14438400 2000
193404 Sereja C Nov. 13, 2010, 1:22 p.m. OK FPC TESTS 31 270 11161600 2000
191724 zpl1 chensqi plokzfadai C Nov. 13, 2010, 11:45 a.m. OK GNU C TESTS 31 270 9523200 2000
194532 LRYBC zzldjk wuyanv1 C Nov. 13, 2010, 3:03 p.m. OK GNU C TESTS 31 360 45363200 2000
192210 hpfdf ysyshtc C Nov. 13, 2010, 12:10 p.m. OK GNU C++ TESTS 31 310 63897600 2000
192640 AlTimin JOZHEG fadeevs C Nov. 13, 2010, 12:34 p.m. OK GNU C++ TESTS 31 330 11673600 2000
191737 Matt lala C.sis C Nov. 13, 2010, 11:46 a.m. OK GNU C++ TESTS 31 340 9523200 2000
194236 havaliza C Nov. 13, 2010, 2:30 p.m. OK GNU C++ TESTS 31 380 14745600 2000
192917 kemichar toi333 Krpa C Nov. 13, 2010, 12:49 p.m. OK GNU C++ TESTS 31 440 13721600 2000
192407 ACube C Nov. 13, 2010, 12:19 p.m. OK GNU C++ TESTS 31 440 19353600 2000
193648 Artishok dimad C Nov. 13, 2010, 1:39 p.m. OK GNU C++ TESTS 31 450 9625600 2000
192786 igor.lifar sankear C Nov. 13, 2010, 12:42 p.m. OK GNU C++ TESTS 31 480 20377600 2000
192613 subscriber CherryTree C Nov. 13, 2010, 12:32 p.m. OK GNU C++ TESTS 31 530 14540800 2000
191301 LGM kyriapelagia AKGMA C Nov. 13, 2010, 11:26 a.m. OK GNU C++ TESTS 31 590 12800000 2000
192598 xiaoyoulei zlly 19910517 C Nov. 13, 2010, 12:31 p.m. OK MS C++ TESTS 31 250 9113600 2000
194490 allocator kate1543 Sender C Nov. 13, 2010, 2:58 p.m. OK MS C++ TESTS 31 450 12800000 2000
193088 The_Guardian kirill vanilla C Nov. 13, 2010, 12:59 p.m. OK MS C++ TESTS 31 450 14028800 2000
194611 yvasyliv knock-knock Renderhp C Nov. 13, 2010, 3:12 p.m. OK MS C++ TESTS 31 580 13721600 2000
194119 skaramouche C Nov. 13, 2010, 2:19 p.m. OK MS C++ TESTS 31 950 12288000 2000

remove filters

Back to search problems