Good Bye 2016

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
750 Good Bye 2016 FINISHED False 9000 293298323 Dec. 30, 2016, 2:15 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 592 ) F New Year and Finding Roots PROGRAMMING constructive algorithms implementation interactive trees 2700

This is an interactive problem. In the interaction section below you will find the information about flushing the output. The New Year tree of height h is a perfect binary tree with vertices numbered 1 through 2 h - 1 in some order. In this problem we assume that h is at least 2 . The drawing below shows one example New Year tree of height 3 : Polar bears love decorating the New Year tree and Limak is no exception. To decorate the tree, he must first find its root, i.e. a vertex with exactly two neighbours (assuming that h ≥ 2 ). It won't be easy because Limak is a little bear and he doesn't even see the whole tree. Can you help him? There are t testcases. In each testcase, you should first read h from the input. Then you can ask at most 16 questions of format " ? x " (without quotes), where x is an integer between 1 and 2 h - 1 , inclusive. As a reply you will get the list of neighbours of vertex x (more details in the "Interaction" section below). For example, for a tree on the drawing above after asking " ? 1 " you would get a response with 3 neighbours: 4 , 5 and 7 . Your goal is to find the index of the root y and print it in the format " ! y ". You will be able to read h for a next testcase only after printing the answer in a previous testcase and flushing the output. Each tree is fixed from the beginning and it doesn't change during your questions. The first line of the input contains a single integer t ( 1 ≤ t ≤ 500 ) — the number of testcases. At the beginning of each testcase you should read from the input a single integer h ( 2 ≤ h ≤ 7 ) — the height of the tree. You can't read the value of h in a next testcase until you answer a previous testcase. To ask a question about neighbours of vertex x , print " ? x " (without quotes) on a separate line. Note, you must print an end-of-line character after the last character of the line and flush your output to get a response. The response will consist of two lines. The first line will contain a single i

Tutorials

Good Bye 2016 — hints and codes

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
23485701 Gassa F Jan. 1, 2017, 3:22 p.m. OK D TESTS 148 109 2969600 2700
23485756 Gassa F Jan. 1, 2017, 3:26 p.m. OK D TESTS 148 124 2969600 2700
23478078 Gassa F Jan. 1, 2017, 4:26 a.m. OK D TESTS 148 139 2969600 2700
23477822 Gassa F Jan. 1, 2017, 3:37 a.m. OK D TESTS 148 140 2969600 2700
23478000 Gassa F Jan. 1, 2017, 4:09 a.m. OK D TESTS 148 155 2969600 2700
23485019 Gassa F Jan. 1, 2017, 2:37 p.m. OK D TESTS 148 156 2969600 2700
23477933 Gassa F Jan. 1, 2017, 3:59 a.m. OK D TESTS 148 170 2969600 2700
23582216 bzh F Jan. 6, 2017, 10:16 a.m. OK FPC TESTS 148 93 1638400 2700
23615888 bzh F Jan. 7, 2017, 3:22 a.m. OK FPC TESTS 148 109 1638400 2700
23508534 dwjshift F Jan. 3, 2017, 1:28 a.m. OK GNU C++ TESTS 148 77 1945600 2700
24126062 FrostStar F Jan. 25, 2017, 3:53 p.m. OK GNU C++ TESTS 148 78 2048000 2700
24731740 Dylans F Feb. 17, 2017, 5:07 a.m. OK GNU C++ TESTS 148 78 2457600 2700
26881698 jiyutian F May 5, 2017, 1:33 p.m. OK GNU C++ TESTS 148 92 0 2700
33752805 nlgxh0 F Dec. 29, 2017, 6:51 a.m. OK GNU C++ TESTS 148 92 2252800 2700
23481342 TA123 F Jan. 1, 2017, 10:06 a.m. OK GNU C++ TESTS 148 93 2048000 2700
23925617 NagiNikaido F Jan. 18, 2017, 3:26 p.m. OK GNU C++ TESTS 148 93 2150400 2700
24731856 Dylans F Feb. 17, 2017, 5:18 a.m. OK GNU C++ TESTS 148 93 2252800 2700
26291630 zhan8855 F April 11, 2017, 6:43 a.m. OK GNU C++ TESTS 148 108 2048000 2700
23620689 axp F Jan. 7, 2017, 9:19 a.m. OK GNU C++ TESTS 148 108 2150400 2700
26752493 t1016d F April 29, 2017, 4:26 p.m. OK GNU C++11 TESTS 148 77 2048000 2700
23512420 liujunhao F Jan. 3, 2017, 8:19 a.m. OK GNU C++11 TESTS 148 77 2048000 2700
23477490 BSBandme F Jan. 1, 2017, 2:33 a.m. OK GNU C++11 TESTS 148 77 2150400 2700
23484439 Taube F Jan. 1, 2017, 1:54 p.m. OK GNU C++11 TESTS 148 92 2150400 2700
49971517 cx233666 F Feb. 16, 2019, 2:36 a.m. OK GNU C++11 TESTS 148 93 0 2700
49847927 darkfire F Feb. 13, 2019, 12:05 a.m. OK GNU C++11 TESTS 148 93 0 2700
47449736 star_magic_young F Dec. 24, 2018, 8:48 a.m. OK GNU C++11 TESTS 148 93 0 2700
31238002 _SHENZHEBEI_ F Oct. 12, 2017, 10:32 a.m. OK GNU C++11 TESTS 148 93 0 2700
49971549 luogu_bot1 F Feb. 16, 2019, 2:38 a.m. OK GNU C++11 TESTS 148 93 614400 2700
23796927 hitokoto F Jan. 14, 2017, 3:47 a.m. OK GNU C++11 TESTS 148 93 1945600 2700
23932369 Al.Cash F Jan. 18, 2017, 10:26 p.m. OK GNU C++14 TESTS 148 77 2048000 2700
23495444 AndreiNet F Jan. 2, 2017, 8:38 a.m. OK GNU C++14 TESTS 148 93 2048000 2700
23483647 bibibibi F Jan. 1, 2017, 12:56 p.m. OK GNU C++14 TESTS 148 93 2048000 2700
23527149 skipher. F Jan. 4, 2017, 2:53 a.m. OK GNU C++14 TESTS 148 108 1945600 2700
23918225 TianyiChen F Jan. 18, 2017, 9:15 a.m. OK GNU C++14 TESTS 148 108 2048000 2700
23688239 lukecavabarrett F Jan. 10, 2017, 9:50 p.m. OK GNU C++14 TESTS 148 108 2048000 2700
23685879 lukecavabarrett F Jan. 10, 2017, 6:04 p.m. OK GNU C++14 TESTS 148 108 2048000 2700
23638060 Batman F Jan. 7, 2017, 11:13 p.m. OK GNU C++14 TESTS 148 108 2048000 2700
23509468 pimenta F Jan. 3, 2017, 3:57 a.m. OK GNU C++14 TESTS 148 108 2048000 2700
47368951 vjudge1 F Dec. 22, 2018, 1:08 p.m. OK GNU C++14 TESTS 148 109 0 2700
40674009 des1997 F July 23, 2018, 2:16 p.m. OK GNU C++17 TESTS 148 124 204800 2700
63878390 SashaPROS3 F Oct. 30, 2019, 7:48 p.m. OK GNU C++17 TESTS 148 140 204800 2700
38473466 yaren F May 21, 2018, 3:39 a.m. OK GNU C++17 TESTS 148 140 307200 2700
66608884 -is-this-fft- F Dec. 10, 2019, 8:03 p.m. OK GNU C++17 TESTS 148 155 204800 2700
65447951 chikibambonator F Nov. 20, 2019, 4:45 p.m. OK GNU C++17 TESTS 148 155 204800 2700
46654345 Slaaava F Dec. 5, 2018, 3:33 p.m. OK GNU C++17 TESTS 148 155 204800 2700
42335544 yujinwunz F Sept. 1, 2018, 1:39 p.m. OK GNU C++17 TESTS 148 155 409600 2700
49397944 Masuk_Mia2018 F Feb. 3, 2019, 1:17 p.m. OK GNU C++17 TESTS 148 170 1740800 2700
64308259 Ancient_mage F Nov. 5, 2019, noon OK GNU C++17 TESTS 148 171 102400 2700
63780666 krasav4ik F Oct. 30, 2019, 10:56 a.m. OK GNU C++17 TESTS 148 171 204800 2700
37697158 happybelly F April 29, 2018, 12:30 a.m. OK Java 8 TESTS 148 264 20787200 2700
37677076 happybelly F April 28, 2018, 5:55 a.m. OK Java 8 TESTS 148 265 20787200 2700
23548089 JialinOuyang F Jan. 5, 2017, 5:34 a.m. OK Java 8 TESTS 148 311 20889600 2700
23538740 chemthan F Jan. 4, 2017, 3:48 p.m. OK Java 8 TESTS 148 389 20787200 2700
23525720 maria12881 F Jan. 3, 2017, 11:34 p.m. OK Java 8 TESTS 148 483 21196800 2700
23667135 edorundo F Jan. 9, 2017, 4:39 p.m. OK Java 8 TESTS 148 499 21094400 2700
23632585 uwi F Jan. 7, 2017, 5:58 p.m. OK Java 8 TESTS 148 561 21196800 2700
23476723 r57shell F Jan. 1, 2017, 12:09 a.m. OK MS C++ TESTS 148 108 2048000 2700
23486832 amethyst0 F Jan. 1, 2017, 4:43 p.m. OK MS C++ TESTS 148 124 2048000 2700
49663218 vjudge2 F Feb. 9, 2019, 1:20 p.m. OK MS C++ TESTS 148 156 0 2700

remove filters

Back to search problems