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 |
---|---|---|---|---|---|---|
979 | Codeforces Round 482 (Div. 2) | FINISHED | False | 7200 | 210957863 | May 14, 2018, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1885 ) | D | Kuro and GCD and XOR and SUM | PROGRAMMING | binary search bitmasks brute force data structures dp ds greedy math number theory strings trees | 2200 |
B"Kuro is currently playing an educational game about numbers. The game focuses on the greatest common divisor (GCD), the XOR value, and the sum of two numbers. Kuro loves the game so much that he solves levels by levels day by day. Sadly, he's going on a vacation for a day, and he isn't able to continue his solving streak on his own. As Katie is a reliable person, Kuro kindly asked her to come to his house on this day to play the game for him. Initally, there is an empty array a . The game consists of q tasks of two types. The first type asks Katie to add a number u_i to a . The second type asks Katie to find a number v existing in a such that k_i mid GCD(x_i, v) , x_i + v <= q s_i , and x_i oplus v is maximized, where oplus denotes the bitwise XOR operation, GCD(c, d) denotes the greatest common divisor of integers c and d , and y mid x means x is divisible by y , or report -1 if no such numbers are found. Since you are a programmer, Katie needs you to automatically and accurately perform the tasks in the game to satisfy her dear friend Kuro. Let's help her! The first line contains one integer q ( 2 <= q q <= q 10^{5} ) -- the number of tasks the game wants you to perform. q lines follow, each line begins with an integer t_i -- the type of the task: It is guaranteed that the type of the first task is type 1 , and there exists at least one task of type 2 . For each task of type 2 , output on one line the desired number v , or -1 if no such numbers are found. In the first example, there are 5 tasks: "... |
Codeforces Round #482 (Div. 2) Editorial |
No solutions yet.