#include "nice_lines_h.h"
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
long double get_slope(long double x, long double y) {
const long double eps = 1e-4;
return (query(x, y + eps) - query(x, y - eps)) / (2.0 * eps);
}
void find_points(long double x, long double y_min, long double y_max,
long double slope_min, long double slope_max, vector<long double>& found_y) {
if (abs(slope_max - slope_min) < 1e-9) return;
if (y_max - y_min < 1e-1) {
found_y.push_back((y_min + y_max) / 2.0);
return;
}
long double mid = (y_min + y_max) / 2.0;
long double slope_mid = get_slope(x, mid);
find_points(x, y_min, mid, slope_min, slope_mid, found_y);
find_points(x, mid, y_max, slope_mid, slope_max, found_y);
}
void solve(int subtask_id, int N) {
long double X = 20000000;
vector<long double> found_y;
long double Y_LIMIT = 2e12;
find_points(X, -Y_LIMIT, Y_LIMIT, get_slope(X, -Y_LIMIT), get_slope(X, Y_LIMIT), found_y);
vector<int> va, vb;
for (auto y_val : found_y) {
int a = round(y_val / X);
int b = round(y_val - (long double)a * X);
va.push_back(a);
vb.push_back(b);
}
the_lines_are(va, vb); [cite: 36]
}