#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std;
typedef long long ll;
const ll L = 1000000000LL;
// 预生成每个j对应的平面点
vector<pair<ll, ll>> pt;
// 寻找分割直线 ax + by + c < 0 恰好选中target集合
bool find_line(int n, const vector<bool>& target, ll &a, ll &b, ll &c)
{
srand(time(0));
for (int trycnt = 0; trycnt < 120; trycnt++)
{
a = rand() % (L / 4) + 1;
b = rand() % (L / 4) + 1;
ll min_in = L, max_out = -L;
bool ok = true;
for (int j = 0; j < n; j++)
{
ll val = a * pt[j].first + b * pt[j].second;
if (target[j])
{
if (val <= max_out) { ok = false; break; }
min_in = min(min_in, val);
}
else
{
if (val >= min_in) { ok = false; break; }
max_out = max(max_out, val);
}
}
if (ok)
{
// c = -(mid), ax+by +c <0 ⇔ ax+by < mid
ll mid = (min_in + max_out) / 2;
c = -mid;
if (c < 1) continue;
return true;
}
}
return false;
}
int main()
{
// ============ 输出指令程序(mode.out内容)============
// 使用官方库语法,输出指令源码
puts("Func(main)");
puts(" Int n1,n2,n3;");
puts(" Read(n1); Read(n2); Read(n3);");
puts(" Ptr<Int> A,B,C;");
puts(" // allocate memory omitted, use continuous storage");
}
ai的错了x2