P10364 [PA 2024] Divisors

Background

PA 2024 5B1

Description

**This problem is translated from [PA 2024](https://sio2.mimuw.edu.pl/c/pa-2024-1/dashboard/) Round 5 [Dzielniki](https://sio2.mimuw.edu.pl/c/pa-2024-1/p/dzi/).** We have chosen an integer $x$ from the interval $[1,n]$. Your task is to guess this number. You do not have to guess blindly; you can ask questions. In each question, you may choose an integer $y$ in the interval $[0,c]$, and we will tell you the number of divisors of $x+y$. To make the problem a bit harder, you need to solve $t$ test cases in a single run. The total number of questions is limited to $q$.

Input Format

At the beginning of your program, you **should not** use `#include "dzilib.h"` to include the interactive library. You need to implement the following function to solve this problem. - `void Solve()`:The program will call this function only once. In this function, you must implement all the logic for guessing all $t$ test cases. You may call the following functions. - `int GetT()`:Returns the value of $t$. - `long long GetN()`:Returns the value of $n$. - `int GetQ()`:Returns the value of $q$. - `long long GetC()`:Returns the value of $c$. - `int Ask(long long y)`:Returns the number of divisors of the sum of the hidden number $x$ and $y$. You must ensure $0\le y\le c$. - `void Answer(long long x)`:Make an answer. This function has no return value. If the total number of calls to `Ask()` exceeds $q$, your program will be judged as `Wrong Answer`. If for any call to `Answer()`, the number you guessed is different from the correct answer, your program will also be judged as `Wrong Answer`.

Output Format

N/A

Explanation/Hint

#### Constraints | Subtask ID | $t$ | $n$ | $q$ | $c$ | |:-:|:-:|:-:|:-:|:-:| | $1$ | $50$ | $10^5$ | $50000$ | $10^{12}$ | | $2$ | $50$ | $10^6$ | $5000$ | $10^{12}$ | | $3$ | $10$ | $10^9$ | $50000$ | $10^{12}$ | | $4$ | $10$ | $10^{14}$ | $5000$ | $10^{17}$ | | $5$ | $10$ | $10^{14}$ | $2000$ | $10^{17}$ | | $6$ | $10$ | $10^{14}$ | $1300$ | $10^{17}$ | | $7$ | $10$ | $10^{14}$ | $950$ | $10^{17}$ | | $8$ | $10$ | $10^{14}$ | $820$ | $10^{17}$ | | $9$ | $10$ | $10^{14}$ | $750$ | $10^{17}$ | | $10$ | $10$ | $10^{14}$ | $720$ | $10^{17}$ | Translated by ChatGPT 5