{"problem":{"name":"E. Napoléon","description":{"content":"In the world of chess, there is a good plan to start your game with which is “Napoléon plan”.  “Napoléon plan” is commonly based on two pieces, (the queen and a bishop), using these two pieces you can","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":65536},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10102E"},"statements":[{"statement_type":"Markdown","content":"In the world of chess, there is a good plan to start your game with which is “Napoléon plan”.  “Napoléon plan” is commonly based on two pieces, (the queen and a bishop), using these two pieces you can guarantee the win after some moves if you are facing a beginner opponent or any way you can start your game with it to explore your opponent qualifications.  Further, this plan can be used and applied in proceeding states of your game so you can disperse your opponent before you surprise him/her with a successful apply of “Napoléon plan” and saying your mortal word “checkmate”.\n\nThe plan; substantially, says that you can checkmate your opponent king by constricting it with its allies, threatening it with your queen which is guarded; commonly, by your bishop.\n\nThe picture displays a successful apply of “Napoléon plan”. \n\nOur problem goes in a further state of the game, when you need to get your bishop to the right state guarding your queen for a successful apply of the plan.  Given the Current location of the bishop and its Target state in the form Xc, Yc, Xt, Yt starting the count from zero, tell the queen: the minimum number of squares that the bishop pass in the minimum moves assuming an empty chess board.\n\nThe first line of input is the number of test cases 0<T<5000, the second line is an integer for the chessboard size 0<N<=20, then (2*T) lines follow. Each test case is two lines; the first line contains two integers 0<=Xc,Yc<N representing the current location of the bishop, the second line contains another two integers 0<=Xt,Yt<N representing the target location of the bishop.\n\nFor each test case, print a line containing the minimum number of squares passed by the bishop on its way to the target location taking the minimal possible moves or print “can't reach!” in case of impossible to reach the target from the current location.\n\n## Input\n\nThe first line of input is the number of test cases 0<T<5000, the second line is an integer for the chessboard size 0<N<=20, then (2*T) lines follow. Each test case is two lines; the first line contains two integers 0<=Xc,Yc<N representing the current location of the bishop, the second line contains another two integers 0<=Xt,Yt<N representing the target location of the bishop.\n\n## Output\n\nFor each test case, print a line containing the minimum number of squares passed by the bishop on its way to the target location taking the minimal possible moves or print “can't reach!” in case of impossible to reach the target from the current location.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case:  \n- Let $ n \\in \\mathbb{Z} $ be the number of universities.  \n- Let $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of positive integers, where $ a_i $ is the number of contestants from university $ i $.  \n\n**Constraints**  \n1. $ 1 \\leq T \\leq 1000 $  \n2. For each test case:  \n   - $ 1 \\leq n \\leq 1000 $  \n   - $ 1 \\leq a_i \\leq 10^6 $ for all $ i \\in \\{1, \\dots, n\\} $  \n\n**Objective**  \nFind integers $ k $ and $ m $ such that:  \n- $ k $ is the greatest common divisor of all $ a_i $:  \n  $$\n  k = \\gcd(a_1, a_2, \\dots, a_n)\n  $$  \n- $ m $ is the minimum total number of teams, where each team has exactly $ k $ contestants from the same university:  \n  $$\n  m = \\sum_{i=1}^{n} \\frac{a_i}{k}\n  $$  \nOutput $ (k, m) $.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10102E","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}