There is a
More formally, the loop can be described by a sequence of points
Given the value of
In one query you will give four integers
In the example below, the query gives four integers
The solid red line represents the loop, and the blue dashed line represents a rectangle from a query.
It can be shown that such a loop exists only if
Note that the grader is not adaptive: the loop is fixed before any queries are made.
Your code should contain #include "cantor.h"
. It should not read from standard input or write to standard output as doing so would give Checker error
verdict.
You should implement the following procedure:
pair<int,int> solve(int N)
You may make calls to the following procedure:
int count(int l,int r,int d,int u)
Suppose
The procedure solve
is called below:
solve(5)
This procedure may call the procedure count
some times.
The first call to count
is called:
count(2,3,3,5)
The grader returns
The second call to count
is called:
count(1,1,1,1)
The grader returns
The third call to count
is called:
count(3,3,5,5)
The grader returns
Finally, the procedure determines that the point solve
returns
A sample grader is provided in the attachments. The sample grader reads input in the following format:
If your program is judged as accepted, the sample grader prints Accepted (X Queries Used)
where
Otherwise, the grader prints Wrong Answer
.
Subtask | Score |
---|---|
1 | 100 |