QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#777651#2810. Speedrunursus#Compile Error//C++201.8kb2024-11-24 06:02:222024-11-24 06:02:23

Judging History

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

  • [2024-11-24 06:02:23]
  • 评测
  • [2024-11-24 06:02:22]
  • 提交

speedrun

#include <bits/stdc++.h>

using namespace std;

#define int long long

using vec = vector<int>;
using vvec = vector<vec>;
using bvec = vector<bool>;
using pii = pair<int,int>;

#define VECT(T) vector<T>
#define PRINT(vector) for(auto ele : vector) cout << ele << " "; cout << "\n";
#define RANGE(vector) vector.begin(), vector.end()

constexpr int E9 = 1e9 + 7;
constexpr int NUFFIN = 1023;

extern void setHintLen(int l);
extern void setHint(int i, int j, bool b);
extern int getLength();
extern bool getHint(int j);
extern bool goTo(int x);

void bettersethint(int p, int x, int y) {
	for(int i = 0 ; i < 10 ; ++i) {
		setHint(p, i, x&1);
		x >>= 1;
	}
	for(int i = 0 ; i < 10 ; ++i) {
		setHint(p, 10+i, x&1);
		x >>= 1;
	}
}

pii bettergethint(int p) {
	int x = 0, y = 0;
	for(int i = 0 ; i < 10 ; ++i) {
		x <<= 1;
		x += (int)getHint(i);
	}
	for(int i = 0 ; i < 10 ; ++i) {
		x <<= 1;
		x += (int)getHint(10+i);
	}
	return {x,y};
}

void dfs(vvec &g, int p, int par, pii next) {
	int n = (int)g[p].size();

	for(int i = 0 ; i < n ; ++i) {
		pii nx = next;
		if(i+1 < n) nx = {p, g[p][i+1]};
		dfs(g, g[p][i], p, nx);
	}

	if(n == 1) bettersethint(p, next.first, next.second);
	else bettersethint(p, g[p][0], NUFFIN);
}

void assignHints(int subtask , int N, int A[], int B[]) {
	setHintLen(20);
	vvec g(N);
	for(int i = 0 ; i < N-1 ; ++i) {
		g[A[i]].push_back(B[i]);
		g[B[i]].push_back(A[i]);
	}
}

void speedrun(int subtask, int N, int start) {
	int p = start;
	vec par(N, -1);
	while(p != -1) {
		auto [x,y] = bettergethint(p);
		if(x == NUFFIN) break;
		if(y == NUFFIN) {
			assert(goTo(x));
			par[x] = p;
			p = x;
		} else {
			while(p != -1 && p != x) {
				assert(goTo(par[p]));
				p = par[p];
			}
			assert(p != -1);

			assert(goTo(y));
			par[y] = p;
			p = y;
		}
	}
}

详细

grader_speedrun.cpp: In function ‘int readvalue()’:
grader_speedrun.cpp:9:9: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   fscanf(input, "%d", &val);
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccBYj7qm.o: in function `bettersethint(long long, long long, long long)':
speedrun.code:(.text+0x23): undefined reference to `setHint(long long, long long, bool)'
/usr/bin/ld: speedrun.code:(.text+0x43): undefined reference to `setHint(long long, long long, bool)'
/usr/bin/ld: /tmp/ccBYj7qm.o: in function `bettergethint(long long)':
speedrun.code:(.text+0x78): undefined reference to `getHint(long long)'
/usr/bin/ld: speedrun.code:(.text+0x98): undefined reference to `getHint(long long)'
/usr/bin/ld: /tmp/ccBYj7qm.o: in function `dfs(std::vector<std::vector<long long, std::allocator<long long> >, std::allocator<std::vector<long long, std::allocator<long long> > > >&, long long, long long, std::pair<long long, long long>)':
speedrun.code:(.text+0x163): undefined reference to `setHint(long long, long long, bool)'
/usr/bin/ld: speedrun.code:(.text+0x183): undefined reference to `setHint(long long, long long, bool)'
/usr/bin/ld: speedrun.code:(.text+0x1f3): undefined reference to `setHint(long long, long long, bool)'
/usr/bin/ld: speedrun.code:(.text+0x213): undefined reference to `setHint(long long, long long, bool)'
/usr/bin/ld: /tmp/ccBYj7qm.o: in function `speedrun(long long, long long, long long)':
speedrun.code:(.text+0x2cd): undefined reference to `goTo(long long)'
/usr/bin/ld: speedrun.code:(.text+0x30c): undefined reference to `goTo(long long)'
/usr/bin/ld: speedrun.code:(.text+0x34c): undefined reference to `goTo(long long)'
/usr/bin/ld: /tmp/ccBYj7qm.o: in function `assignHints(long long, long long, long long*, long long*)':
speedrun.code:(.text+0x411): undefined reference to `setHintLen(long long)'
/usr/bin/ld: /tmp/ccvwIQNm.o: in function `main':
grader_speedrun.cpp:(.text.startup+0x4c): undefined reference to `speedrun(int, int, int)'
/usr/bin/ld: grader_speedrun.cpp:(.text.startup+0x1a2): undefined reference to `assignHints(int, int, int*, int*)'
collect2: error: ld returned 1 exit status