답안 #829304

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829304 2023-08-18T08:33:36 Z rainboy Nicelines (RMI20_nicelines) C
컴파일 오류
0 ms 0 KB
#include "nice_lines_c.h"
#include <math.h>

#define N	100
#define M	10000
#define X	10000000
#define Y	((long long) M * X + M + 1)
#define eps	1e-9

typedef long double ld;

void solve(int subtask_id, int n) {
	static int aa[N], bb[N];
	int i, a, a_, b, lower, upper;
	long long y1, y2;
	ld u1, u2, v1, v1_, v2, v2_;

	a_ = -(M + 1), u1 = query(X, (long long) -(M + 1) * X + M), u2 = query(X, (long long) -M * X - M);
	for (i = 0; i < n; i++) {
		lower = a_, upper = M + 1, v1_ = -1, v2_ = -1;
		while (upper - lower > 1) {
			a = (lower + upper) / 2;
			v1 = query(X, (long long) a * X + M);
			v2 = query(X, (long long) (a + 1) * X - M);
			if (fabsl(((v2 - v1) - (u2 - u1)) / (X - M * 2)) < eps)
				lower = a;
			else
				upper = a, v1_ = v1, v2_ = v2;
		}
		a = upper, v1 = v1_, v2 = v2_;
		y1 = (long long) (a_ + 1) * X - M, y2 = (long long) a * X + M;
		b = roundl(((X - M * 2) * (v1 - u2) + y1 * (u2 - u1) - y2 * (v2 - v1)) / ((u2 - u1) - (v2 - v1)) - (ld) a * X);
		aa[i] = a, bb[i] = b;
		a_ = a, u1 = v1, u2 = v2;
	}
	the_lines_are(aa, bb);
}

Compilation message

/usr/bin/ld: /tmp/cconr7Ij.o: in function `solve':
nicelines.c:(.text+0x240): undefined reference to `roundl'
collect2: error: ld returned 1 exit status