QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#130302#1146. RailAlinxesterCompile Error//C++141.3kb2023-07-23 20:10:062023-07-23 20:10:10

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-23 20:10:10]
  • 评测
  • [2023-07-23 20:10:06]
  • 提交

answer

#include<bits/stdc++.h>
#include "rail.h"
#define int long long
#define rep(i,x,y) for (int i = (x); i <= (y); ++i)
#define drep(i,x,y) for (int i = (x); i >= (y); --i)
#define go(i,u) for (int i = head[u]; i; i = edge[i].next)
using namespace std;
const int N = 5e3 + 2;
int a[N], dist[N], p[N], vis[N];
inline bool dist_cmp (int x, int y) {
	return dist[x] < dist[y]; }
set<int> s;
#define solve(x,d,opt) vis[x] = 1, stype[x] = opt, location[x] = first + d
void findLocation (int n, int first, int location[], int stype[]) {
	rep (i, 1, n - 1) a[i] = i, dist[i] = getDistance(0, i);
	sort(a + 1, a + n, dist_cmp);
	solve(a[0], 0, 1);
	int l = a[0], r = a[1];
	if (n < 2) return;
	solve(a[1], dist[r], 2);
	rep (i, 0, n - 1) if (!vis[a[i]]) {
		int pos = (dist[a[i]] - getDistance(r, a[i]) + dist[r]) >> 1;
		if (s.find(pos) != s.end()) {
			p[a[i]] = (pos << 1) - dist[a[i]];
			if (p[a[i]] > 0) solve(a[i], p[a[i]], 1);
		}
		else {
			solve(a[i], p[a[i]], 2);
			s.insert(dist[a[i]]), r = a[i];
		}
	}
	s.clear();
	s.insert(0);
	rep (i, 0, n - 1) if (!vis[a[i]]) {
		int pos = (p[a[i]] - getDistance(l, a[i]) - p[l]) >> 1;
		if (s.find(pos) != s.end()) solve(a[i], (pos << 1) - p[a[i]], 2);
		else {
			solve(a[i], p[a[i]], 1);
			s.insert(p[a[i]]), l = a[i];
		}
	}
}

详细

/usr/bin/ld: /tmp/ccxQ5NPo.o: in function `main':
implementer.cpp:(.text.startup+0x67): undefined reference to `findLocation'
collect2: error: ld returned 1 exit status