QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#507868#67. Two TransportationsNelofus0 0ms3720kbC++203.4kb2024-08-06 22:02:122024-08-06 22:02:13

Judging History

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

  • [2024-08-06 22:02:13]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3720kb
  • [2024-08-06 22:02:12]
  • 提交

Azer

#include "Azer.h"
#include <bits/stdc++.h>

namespace Heratino {
	template<typename T>
		inline void chkmin(T &a, const T &b)	{if (a > b)	a = b;}
	// 从高到低
	inline void send_k(int x, int k) {
		for (int i = k - 1; i >= 0; i--)
			SendA((x >> i) & 1);
	}

	int CurrentBits;
	int res, query_type;
	int self, sp;
	/* ---------------------------------------------------- */
	int N;
	constexpr int M = 2000;
	int dis[M], vis[M];
	std::vector<std::array<int, 2>> G[M];

	int timer;
	int LAST_DIS;
	int otherSide;
	void Extend(int u) {
		vis[u] = true;
		if (++timer == N)
			return ;
		for (const auto &[v, w] : G[u])
			chkmin(dis[v], dis[u] + w);
		LAST_DIS = dis[u];
		int NewMin = dis[u] + 511, NewPos = -1;
		for (int i = 0; i < N; i++)
			if (!vis[i] && dis[i] < NewMin)
				NewMin = dis[i], NewPos = -1;

		self = NewMin - LAST_DIS, sp = NewPos;
		res = 9, query_type = 1;
		send_k(self, 9);
	}
}
using namespace Heratino;

void InitA(int n, int A, std::vector<int> U, std::vector<int> V,
		std::vector<int> C) {
	for (int i = 0; i < A; i++) {
		G[U[i]].push_back({V[i], C[i]});
		G[V[i]].push_back({U[i], C[i]});
	}

	N = n;
	memset(dis, 0x7f, sizeof(dis));
	dis[0] = 0;
	Extend(0);
}

void ReceiveA(bool x) {
	CurrentBits <<= 1, CurrentBits |= x;
	res--;
	if (!res) {
		switch (query_type) {
			case 1:
				otherSide = CurrentBits;
				// 等于的情况交给 Azer
				if (self <= otherSide)
					send_k(sp, 11), dis[sp] = self + LAST_DIS, Extend(sp);
				else
					res = 11, query_type = 2;
				break;
			case 2:
				int otherPos = CurrentBits;
				dis[otherPos] = LAST_DIS + otherSide;
				Extend(otherPos);
				break;
		}

		CurrentBits = 0;
	}
}

std::vector<int> Answer() {
	std::vector<int> ans(N);
	for (int k = 0; k < N; ++k)
		ans[k] = dis[k];
	return ans;
}

Baijan

#include "Baijan.h"
#include <bits/stdc++.h>

namespace Nelofus {
	template<typename T>
		inline void chkmin(T &a, const T &b)	{if (a > b)	a = b;}
	// 从高到低
	inline void send_k(int x, int k) {
		for (int i = k - 1; i >= 0; i--)
			SendB((x >> i) & 1);
	}

	int CurrentBits;
	int res, query_type;
	int self, sp;
	/* ---------------------------------------------------- */
	int N;
	constexpr int M = 2000;
	int dis[M], vis[M];
	std::vector<std::array<int, 2>> G[M];

	int timer;
	int LAST_DIS;
	int otherSide;
	void Extend(int u) {
		vis[u] = true;
		if (++timer == N)
			return ;
		for (const auto &[v, w] : G[u])
			chkmin(dis[v], dis[u] + w);
		LAST_DIS = dis[u];
		int NewMin = dis[u] + 511, NewPos = -1;
		for (int i = 0; i < N; i++)
			if (!vis[i] && dis[i] < NewMin)
				NewMin = dis[i], NewPos = -1;

		self = NewMin - LAST_DIS, sp = NewPos;
		res = 9, query_type = 1;
		send_k(self, 9);
	}

}
using namespace Nelofus;

void InitB(int n, int B, std::vector<int> S, std::vector<int> T,
		std::vector<int> D) {
	for (int i = 0; i < B; i++) {
		G[S[i]].push_back({T[i], D[i]});
		G[T[i]].push_back({S[i], D[i]});
	}

	N = n;
	memset(dis, 0x7f, sizeof(dis));
	dis[0] = 0;
	Extend(0);
}

void ReceiveB(bool y) {
	CurrentBits <<= 1, CurrentBits |= y;
	res--;
	if (!res) {
		switch (query_type) {
			case 1:
				otherSide = CurrentBits;
				// 等于的情况交给 Azer
				if (self <  otherSide)
					send_k(sp, 11), dis[sp] = self + LAST_DIS, Extend(sp);
				else
					res = 11, query_type = 2;
				break;
			case 2:
				int otherPos = CurrentBits;
				dis[otherPos] = LAST_DIS + otherSide;
				Extend(otherPos);
				break;
		}

		CurrentBits = 0;
	}
}

詳細信息

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

1 1 1 1 1 1 1 1 1 -1

output:

-1

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #2:

score: 0
Runtime Error

Test #7:

score: 8
Accepted
time: 0ms
memory: 3720kb

input:

-1

output:

-1
-1

input:


output:

0

result:

ok single line: '0'

Test #8:

score: 0
Runtime Error

input:

1 1 1 1 1 1 1 1 1 -1

output:

-1

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #3:

score: 0
Interactor Runtime Error

Test #14:

score: 0
Interactor Runtime Error

input:

1 0 0 1 1 1 0 0 1 -1

output:

-1
1 1 0 1 0 0 1 0 1 -1

input:


output:


result:


Subtask #4:

score: 0
Runtime Error

Test #24:

score: 0
Runtime Error

input:

1 1 1 1 1 1 1 1 1 -1

output:

-1

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #5:

score: 0
Interactor Runtime Error

Test #38:

score: 0
Interactor Runtime Error

input:

0 0 1 0 1 1 1 1 0 -1

output:

-1
1 1 1 1 1 1 1 1 1 -1

input:


output:


result:


Subtask #6:

score: 0
Runtime Error

Test #51:

score: 0
Runtime Error

input:

1 1 1 1 1 1 1 1 1 -1

output:

-1

input:


output:


result:

wrong answer 1st lines differ - expected: '0', found: ''

Subtask #7:

score: 0
Interactor Runtime Error

Test #64:

score: 0
Interactor Runtime Error

input:

1 1 1 1 1 0 0 0 0 -1

output:

-1
1 1 1 1 1 0 0 1 1 -1

input:


output:


result: