답안 #829324

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829324 2023-08-18T09:21:25 Z rainboy Nicelines (RMI20_nicelines) C
컴파일 오류
0 ms 0 KB
#include "nice_lines.h"
#include <cmath>
#include <vector>

using namespace std;

typedef long double ld;
typedef vector<int> vi;

const int N = 100;
const int M = 10000;
const int X = 10000000;
const ld eps = 1e-9;

vi aa, bb;

void solve_(int al, ld ul1, ld ul2, int ar, ld ur1, ld ur2) {
	long long y1 = (long long) (al + 1) * X - M, y2 = (long long) ar * X + M;
	long long y = roundl(((X - M * 2) * (ur1 - ul2) + y1 * (ul2 - ul1) - y2 * (ur2 - ur1)) / ((ul2 - ul1) - (ur2 - ur1)));
	int a = roundl(y / X), b = y - a * X;
	ld u1 = query(X, (long long) (a - 1) * X + M), u2 = query(X, (long long) a * X - M);
	if (fabsl(((u2 - u1) - (ul2 - ul1)) / (X - M * 2)) > eps)
		solve_(al, ul1, ul2, a - 1, u1, u2), solve_(a - 1, ul1, ul2, ar, ur1, ur2);
	else if (((ur2 - ur1) - (ul2 - ul1)) / (X - M * 2) > (1 / sqrt(a * a + 1)) * 2 + eps) {
		ld v1 = query(X, (long long) a * X + M), v2 = query(X, (long long) (a + 1) * X - M);
		solve_(a, v1, v2, ar, ur1, ur2);
		al = a - 1, ul1 = u1, ul2 = u2, ar = a, ur1 = v1, ur2 = v2;
		y1 = (long long) (al + 1) * X - M, y2 = (long long) ar * X + M;
		y = roundl(((X - M * 2) * (ur1 - ul2) + y1 * (ul2 - ul1) - y2 * (ur2 - ur1)) / ((ul2 - ul1) - (ur2 - ur1)));
		a = roundl(y / X), b = y - a * X;
		aa.push_back(a), bb.push_back(b);
	} else
		aa.push_back(a), bb.push_back(b);
}

void solve(int subtask_id, int n) {
	int al = -(M + 1);
	ld ul1 = query(X, (long long) al * X + M), ul2 = query(X, (long long) (al + 1) * X - M);
	int ar = M;
	ld ur1 = query(X, (long long) ar * X + M), ur2 = query(X, (long long) (ar + 1) * X - M);
	aa.clear(), bb.clear(), solve_(al, ul1, ul2, ar, ur1, ur2);
	the_lines_are(aa, bb);
}

Compilation message

In file included from nicelines.c:1:
nice_lines.h:4:10: fatal error: vector: No such file or directory
    4 | #include <vector>
      |          ^~~~~~~~
compilation terminated.