QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#848352#8629. 寻宝WilliamFranklinCompile Error//C++142.1kb2025-01-08 19:49:432025-01-08 19:49:43

Judging History

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

  • [2025-01-08 19:49:43]
  • 评测
  • [2025-01-08 19:49:43]
  • 提交

answer

#include <bits/stdc++.h>
#include "treasure.h"
using namespace std;
#define x first
#define y second
#define mp(Tx, Ty) make_pair(Tx, Ty)
#define For(Ti, Ta, Tb) for(auto Ti = (Ta); Ti <= (Tb); Ti++)
#define Dec(Ti, Ta, Tb) for(auto Ti = (Ta); Ti >= (Tb); Ti--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define range(Tx) begin(Tx),end(Tx)
const int N = 5e6;
int d[N];
int h[N], e[N * 2], ne[N * 2], w[N * 2], idx;
void add(int a, int b, int c) {
	e[idx] = b, ne[idx] = h[a], w[idx] = c, h[a] = idx++;
}

void Alice(const int testid, const int n, const int m, const int x, const int u[], const int v[], bool dir[]) {
	memset(h, -1, sizeof(h));
	memset(d, 0, sizeof(d));
	For(i, 0, m - 1) {
		add(u[i], v[i], i), add(v[i], u[i], i);
	}
	queue<int> q;
	q.push(x);
	d[x] = 1;
	while (q.size()) {
		int t = q.front();
		q.pop();
		for (int i = h[t]; ~i; i = ne[i]) {
			int j = e[i];
			if (d[j]) continue;
			int id = w[i];
			if (u[id] == t) {
				d[v[id]] = d[t] + 1;
				q.push(v[id]);
			} else {
				d[u[id]] = d[t] + 1;
				q.push(u[id]);
			}
		}
	}
	int k = 1000;
	For(i, 0, m - 1) {
		if (u[i] <= k && v[i] <= k) {
			if (d[u[i]] < d[v[i]]) dir[i] = 0;
			else dir[i] = 1; 
		}
	}
	For(i, 0, m - 1) {
		if (u[i] <= k && v[i] > k) {
			dir[i] = 1;
		}
		if (u[i] > k && v[i] <= k) {
			dir[i] = 0;
		}
	}
	For(i, 0, m - 1) {
		if (u[i] > k && v[i] > k) {
			if (d[u[i]] % 2 == 0) dir[i] = 1;
			else dir[i] = 0;
		}
	}
}

int Bob(const int testid, const int n) {
	mt19937 rnd(time(0));
	int s = -1;
	vector<pair<int, bool> > e;
	For(i, 1, 4000) {
		int x = rnd() % n;
		e = discover(x);
		int cnt = 0;
		for (auto i : e) cnt = cnt + e.y;
		if (cnt != e.size()) {
			s = x;
			break;
		}
	}
	if (s == -1) {
		int x = rnd() % n;
		e = discover(x);
		while (e[0].y != 0) {
			x = rnd() % n;
			e = discover(x);
		}
		return e[0].x;
	}
	int cnt = 0;
	for (auto i : e) cnt = cnt + e.y;
	while (cnt) {
		for (auto i : e) {
			if (i.y == 0) {
				s = i.x;
				break;
			}
		}
		e = discover(s);
		cnt = 0;
		for (auto i : e) cnt = cnt + e.y;
	}
	return s;
}

Details

answer.code: In function ‘int Bob(int, int)’:
answer.code:5:11: error: ‘class std::vector<std::pair<int, bool> >’ has no member named ‘second’
    5 | #define y second
      |           ^~~~~~
answer.code:74:48: note: in expansion of macro ‘y’
   74 |                 for (auto i : e) cnt = cnt + e.y;
      |                                                ^
answer.code:5:11: error: ‘class std::vector<std::pair<int, bool> >’ has no member named ‘second’
    5 | #define y second
      |           ^~~~~~
answer.code:90:40: note: in expansion of macro ‘y’
   90 |         for (auto i : e) cnt = cnt + e.y;
      |                                        ^
answer.code:5:11: error: ‘class std::vector<std::pair<int, bool> >’ has no member named ‘second’
    5 | #define y second
      |           ^~~~~~
answer.code:100:48: note: in expansion of macro ‘y’
  100 |                 for (auto i : e) cnt = cnt + e.y;
      |                                                ^