QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#121271#67. Two Transportationszhylj0 ✓0ms0kbC++204.0kb2023-07-07 20:20:392023-09-11 02:08:20

Judging History

你现在查看的是测评时间为 2023-09-11 02:08:20 的历史记录

  • [2023-09-11 02:12:28]
  • 管理员手动重测该提交记录
  • 测评结果:100
  • 用时:162ms
  • 内存:33304kb
  • [2023-09-11 02:08:20]
  • 管理员手动重测该提交记录
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-09-11 02:06:39]
  • 管理员手动重测该提交记录
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-07 20:20:41]
  • 评测
  • 测评结果:100
  • 用时:168ms
  • 内存:33148kb
  • [2023-07-07 20:20:39]
  • 提交

Azer

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

namespace {

#define fi first
#define se second
#define mkp std::make_pair
typedef std::pair <int, int> pii;

const int N_MAX = 2000 + 5, INF = 0x3fffffff, CINF = 511;

int N, d[N_MAX], lst_mn, cur_mn_idx, cur_mn, cnt, cnt_mx, res;
bool flag[N_MAX];
std::vector <int> q;

std::vector <pii> E[N_MAX];

void Add(int u, int v, int w) {
	E[u].push_back(mkp(v, w));
	E[v].push_back(mkp(u, w));
}

}

void InitA(int N, int A, std::vector <int> U, std::vector <int> V,
			std::vector <int> C) {
	memset(flag, false, sizeof(flag));
	::N = res = N;
	for(int i = 0; i < A; ++i)
		Add(U[i], V[i], C[i]);
	for(int i = 0; i < N; ++i)
		d[i] = INF;
	d[0] = lst_mn = 0; flag[0] = true;
	for(auto p : E[0]) {
		int v = p.fi, w = p.se;
		d[v] = std::min(d[v], d[0] + w);
	}
	cur_mn = CINF;
	for(int i = 0; i < N; ++i)
		if(!flag[i] && cur_mn > d[i] - lst_mn) {
			cur_mn = d[i] - lst_mn;
			cur_mn_idx = i;
		}
	for(int i = 0; i < 9; ++i)
		SendA((cur_mn >> i) & 1);
	cnt_mx = 9; q.clear();
	--res;
}

void ReceiveA(bool x) {
	++cnt; q.push_back((int)x);
	if(cnt < cnt_mx || !res) return;
	int val = 0;
	for(int i = 0; i < cnt_mx; ++i)
		if(q[i]) val |= 1 << i;
	q.clear(); cnt = 0;
	if(cnt_mx == 9) {
		if(cur_mn < val) {
			int u = cur_mn_idx;
			for(int i = 0; i < 11; ++i)
				SendA((u >> i) & 1);
			if(res) cnt_mx = 9;
			else cnt_mx = 0;
		} else {
			cur_mn = val;
			cnt_mx = 11;
			return;
		}
	} else if(cnt_mx == 11) {
		cur_mn_idx = val;
		if(res) cnt_mx = 9;
		else cnt_mx = 0;
	}
	lst_mn += cur_mn;
	int u = cur_mn_idx;
	flag[u] = true;
	d[u] = lst_mn;
	for(auto p : E[u]) {
		int v = p.fi, w = p.se;
		d[v] = std::min(d[v], d[u] + w);
	}
	cur_mn = CINF;
	for(int i = 0; i < N; ++i)
		if(!flag[i] && cur_mn > d[i] - lst_mn) {
			cur_mn = d[i] - lst_mn;
			cur_mn_idx = i;
		}
	for(int i = 0; i < 9; ++i)
		SendA((cur_mn >> i) & 1);
	--res;
}

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

Baijan

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

namespace {

#define fi first
#define se second
#define mkp std::make_pair
typedef std::pair <int, int> pii;

const int N_MAX = 2000 + 5, INF = 0x3fffffff, CINF = 511;

int N, d[N_MAX], lst_mn, cur_mn_idx, cur_mn, cnt, cnt_mx, res;
bool flag[N_MAX];
std::vector <int> q;

std::vector <pii> E[N_MAX];

void Add(int u, int v, int w) {
	E[u].push_back(mkp(v, w));
	E[v].push_back(mkp(u, w));
}

}

void InitB(int N, int A, std::vector <int> U, std::vector <int> V,
			std::vector <int> C) {
	memset(flag, false, sizeof(flag));
	::N = res = N;
	for(int i = 0; i < A; ++i)
		Add(U[i], V[i], C[i]);
	for(int i = 0; i < N; ++i)
		d[i] = INF;
	d[0] = lst_mn = 0; flag[0] = true;
	for(auto p : E[0]) {
		int v = p.fi, w = p.se;
		d[v] = std::min(d[v], d[0] + w);
	}
	cur_mn = CINF;
	for(int i = 0; i < N; ++i)
		if(!flag[i] && cur_mn > d[i] - lst_mn) {
			cur_mn = d[i] - lst_mn;
			cur_mn_idx = i;
		}
	for(int i = 0; i < 9; ++i)
		SendB((cur_mn >> i) & 1);
	cnt_mx = 9; q.clear();
	--res;
}

void ReceiveB(bool x) {
	++cnt; q.push_back((int)x);
	if(cnt < cnt_mx || !res) return;
	int val = 0;
	for(int i = 0; i < cnt_mx; ++i)
		if(q[i]) val |= 1 << i;
	q.clear(); cnt = 0;
	if(cnt_mx == 9) {
		if(cur_mn <= val) {
			int u = cur_mn_idx;
			for(int i = 0; i < 11; ++i)
				SendB((u >> i) & 1);
			if(res) cnt_mx = 9;
			else cnt_mx = 0;
		} else {
			cur_mn = val;
			cnt_mx = 11;
			return;
		}
	} else if(cnt_mx == 11) {
		cur_mn_idx = val;
		if(res) cnt_mx = 9;
		else cnt_mx = 0;
	}
	lst_mn += cur_mn;
	int u = cur_mn_idx;
	flag[u] = true;
	d[u] = lst_mn;
	for(auto p : E[u]) {
		int v = p.fi, w = p.se;
		d[v] = std::min(d[v], d[u] + w);
	}
	cur_mn = CINF;
	for(int i = 0; i < N; ++i)
		if(!flag[i] && cur_mn > d[i] - lst_mn) {
			cur_mn = d[i] - lst_mn;
			cur_mn_idx = i;
		}
	for(int i = 0; i < 9; ++i)
		SendB((cur_mn >> i) & 1);
	--res;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Interactor Dangerous Syscalls

Test #1:

score: 0
Interactor Dangerous Syscalls

input:


output:


input:


output:


result:


Subtask #2:

score: 0
Interactor Dangerous Syscalls

Test #7:

score: 0
Interactor Dangerous Syscalls

input:


output:

-1

input:


output:


result:


Subtask #3:

score: 0
Interactor Dangerous Syscalls

Test #14:

score: 0
Interactor Dangerous Syscalls

input:


output:

-1

input:


output:


result:


Subtask #4:

score: 0
Interactor Dangerous Syscalls

Test #24:

score: 0
Interactor Dangerous Syscalls

input:


output:

-1

input:


output:


result:


Subtask #5:

score: 0
Interactor Dangerous Syscalls

Test #38:

score: 0
Interactor Dangerous Syscalls

input:


output:

-1

input:


output:


result:


Subtask #6:

score: 0
Interactor Dangerous Syscalls

Test #51:

score: 0
Interactor Dangerous Syscalls

input:


output:

-1

input:


output:


result:


Subtask #7:

score: 0
Interactor Dangerous Syscalls

Test #64:

score: 0
Interactor Dangerous Syscalls

input:


output:


input:


output:


result: