QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#398765#2338. Beautiful BridgesBIXIANCompile Error//C++141.4kb2024-04-25 18:02:162024-04-25 18:02:16

Judging History

你现在查看的是最新测评结果

  • [2024-04-25 18:02:16]
  • 评测
  • [2024-04-25 18:02:16]
  • 提交

answer

#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int f[100001];
long long n, h, a, d,ans,w;
long long s[100001][2];
long long qw[100001][100001];
bool df(int a, int b)
{
	double midx = ((double)a + (double)b) / 2;
	double midy = h - ((double)b - (double)a) / 2;
	if (midy < f[a] || midy < f[b])
	{
		return 0;
	}
	double r = ((double)b - (double)a) / 2;
	for (int i = a; i <= b; i++)
	{
		if (f[i]>=0)
		{
			if ((f[i]>=midy)&&((midx - (double)i) * (midx - (double)i) + (midy - (double)f[i]) * (midy - (double)f[i]))>(r*r))
				return 0;
		}
	}
	return 1;
}
int vv = 0;
long long min1 = -1;
void dfs(int qe)
{
	for (int i = 2; i <= ans; i++)
	{
		for (int j = 1; j <= i-1; j++)
		{
			for (int u = 1; u < i; u++)
			{
				if ((df(s[u][0], s[i][0])))
				{
					qw[j][i]= min(qw[j][i],qw[j-1][u]+d * ((s[i][0] - s[u][0]) * (s[i][0] - s[u][0])) + a * (h - f[s[i][0]]));
					if (i == ans)
					{
						if (min1 > qw[j][i]||min1==-1)
							min1 = qw[j][i];
						vv = 1;
					}
				}
			}
		}
	}
}
int main()
{
	cin >> n >> h >> a >> d;
	int max1 = 0,x,fr;
	for (int i = 1; i <= 100000; i++)
		f[i] = -1;
	for (int i = 1; i <= n; i++)
	{
		cin >> x;
		cin >> f[x];
		ans++;
		s[ans][0] = x;
		if (f[x] > max1)
			max1 = f[x];
	}
	memset(qw, 0x3f3f, sizeof(qw));
	qw[0][1] = a*(h-f[s[1][0]]);
	dfs(1);
	if (!vv)
		cout << "impossible";
	if(vv)
		cout << min1 << endl;
}

Details

/tmp/cckQCKdU.o: in function `df(int, int)':
answer.code:(.text+0x2c): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/cckQCKdU.o
answer.code:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against symbol `h' defined in .bss section in /tmp/cckQCKdU.o
/tmp/cckQCKdU.o: in function `dfs(int)':
answer.code:(.text+0x105): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cckQCKdU.o
answer.code:(.text+0x11a): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cckQCKdU.o
answer.code:(.text+0x12e): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cckQCKdU.o
answer.code:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `h' defined in .bss section in /tmp/cckQCKdU.o
answer.code:(.text+0x141): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/cckQCKdU.o
answer.code:(.text+0x178): relocation truncated to fit: R_X86_64_PC32 against symbol `s' defined in .bss section in /tmp/cckQCKdU.o
answer.code:(.text+0x1b3): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/cckQCKdU.o
/tmp/cckQCKdU.o: in function `main':
answer.code:(.text.startup+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cckQCKdU.o
answer.code:(.text.startup+0x15): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status