QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#555814#7281. How to Avoid Disqualification in 75 Easy Stepsuser1008630 1ms3820kbC++173.6kb2024-09-10 10:19:202024-09-10 10:19:21

Judging History

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

  • [2024-09-10 10:19:21]
  • 评测
  • 测评结果:30
  • 用时:1ms
  • 内存:3820kb
  • [2024-09-10 10:19:20]
  • 提交

answer

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

using namespace std;

const int N = 1000;

//int log(int k, int n)
//{
//	int cnt = 0;
//	while (n > 1) cnt++, n = (n + k - 1) / k;
//	return cnt;
//}
//
//int n, f[N], from[N];

//void filter(vector<int>& v)
//{
//	vector<int> nxt;
//	for (int x : v)
//		if (x >= 0 && x < n) v.push_back(x);
//	v = nxt;
//}

//signed main()
//{
////	cin >> n;
////	for (int a = 0; a < n; a++)
////		for (int b = a + 1; b < n; b++)
////			for (int c = 0; c < n; c++)
////				for (int d = c + 1; d < n; d++)
////				{
////					auto v = [&](int a, int b) { return (a - b + n) % n; };
////					set<int> c1 = {v(c, a), v(d, b)}, c2 = {v(c, b), v(d, a)};
////					int f1 = ((!!c1.count(0)) << 1) | (c1.count(1)), f2 = ((!!c2.count(0)) << 1) | (c2.count(1));
////					if (f1 == f2)
////					{
////						cout << a << ' ' << b << endl << c << ' ' << d << endl;
////						return 0;
////					}
////				}
////	f[1] = 0;
////	for (int i = 2; i <= n; i++)
////	{
////		f[i] = 1e9;
////		for (int j = 2; j <= i; j++)
////		{
////			int val = f[(i + j - 1) / j] + 2 * log(2, (n + i - 1) / i) + j;
////			if (val < f[i]) f[i] = val, from[i] = j;
////		}
////	}
////	cout << f[n] << endl;
////	vector<int> b;
////	for (int i = n; i != 1; i = (i + from[i] - 1) / from[i]) b.push_back(from[i]);
////	reverse(b.begin(), b.end());
////	int tot = 1; for (int x : b) tot *= x;
////	for (int x : b) cout << x << ' '; cout << endl;
//	
//}

//int a, b;
//vector<int> ret;
//
//void send(vector<int>& v)
//{
//	set<int> s;
//	for (int x : v) s.insert(x);
//	ret.push_back(s.count(a) || s.count(b));
//}
//
//vector<int> wait()
//{
//	return ret;
//}

pair<int, int> scout(int R, int H)
{
	assert(R == 75 && H == 1);
	// Q = 40
	int idx = 0;
	for (int i = 0; i < 5; i++)
	{
		for (int v = 0; v < 4; v++)
		{
			vector<int> q;
			for (int j = 0; j < N; j++)
				if ((j >> (i << 1) & 3) == v) q.push_back(j);
			for (int& x : q) x++;
			send(q), idx++;
		}
	}
	int id[5][5];
	for (int i = 0; i < 5; i++)
		for (int j = i + 1; j < 5; j++)
		{
			vector<int> q0, q1;
			for (int k = 0; k < N; k++)
				if (((k >> (j << 1) & 3) - (k >> (i << 1) & 3) + 4) % 4 == 0) q0.push_back(k);
				else if (((k >> (j << 1) & 3) - (k >> (i << 1) & 3) + 4) % 4 == 1) q1.push_back(k);
			id[i][j] = idx;
			for (int& x : q0) x++;
			for (int& x : q1) x++;
			send(q0), send(q1), idx += 2;
		}
	vector<int> res = wait();
//	for (int x : res) cout << x; cout << endl;
	int ans[5][2];
	for (int i = 0; i < 5; i++)
	{
		set<int> s;
		for (int v = 0; v < 4; v++)
			if (res[i * 4 + v]) s.insert(v);
		assert(!s.empty());
		if (s.size() == 1) ans[i][0] = ans[i][1] = *s.begin();
		else assert(s.size() == 2), ans[i][0] = *s.begin(), ans[i][1] = *s.rbegin();
//		cout << ans[i][0] << ' ' << ans[i][1] << endl;
//		cout << s.size() << endl;
	}
	for (int i = 0, fi = -1; i < 5; i++)
	{
		if (ans[i][0] == ans[i][1]) continue;
		if (fi == -1) 
		{
			fi = i;
			continue;
		}
		int idx = id[fi][i];
		set<int> s; s.insert((ans[i][0] - ans[fi][0] + 4) % 4), s.insert((ans[i][1] - ans[fi][1] + 4) % 4);
//		cout << s.count(0) << ' ' << s.count(1) << endl;
		if (!!s.count(0) != res[idx] || !!s.count(1) != res[idx + 1]) swap(ans[i][0], ans[i][1]);
	}
	int a = 0, b = 0;
//	for (int i = 0; i < 5; i++) 		cout << ans[i][0] << ' ' << ans[i][1] << endl;
	for (int i = 4; i >= 0; i--)
		a = (a << 2) | ans[i][0], b = (b << 2) | ans[i][1];
	return {a + 1, b + 1};
}

//signed main()
//{
//	cin >> a >> b;
//	auto res = scout(75, 1);
//	cout << res.first << ' ' << res.second;
//}

详细

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:



output:


result:


Subtask #2:

score: 0
Runtime Error

Test #11:

score: 0
Runtime Error

input:

\x14

output:


result:


Subtask #3:

score: 0
Runtime Error

Test #66:

score: 0
Runtime Error

input:

\x1e

output:


result:


Subtask #4:

score: 30
Acceptable Answer

Test #120:

score: 30
Acceptable Answer
time: 0ms
memory: 3784kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #121:

score: 30
Acceptable Answer
time: 1ms
memory: 3520kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #122:

score: 30
Acceptable Answer
time: 1ms
memory: 3616kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #123:

score: 30
Acceptable Answer
time: 0ms
memory: 3820kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #124:

score: 30
Acceptable Answer
time: 1ms
memory: 3600kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #125:

score: 30
Acceptable Answer
time: 1ms
memory: 3612kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #126:

score: 30
Acceptable Answer
time: 1ms
memory: 3596kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #127:

score: 30
Acceptable Answer
time: 1ms
memory: 3820kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #128:

score: 30
Acceptable Answer
time: 1ms
memory: 3592kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #129:

score: 30
Acceptable Answer
time: 1ms
memory: 3620kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #130:

score: 30
Acceptable Answer
time: 1ms
memory: 3612kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #131:

score: 30
Acceptable Answer
time: 0ms
memory: 3620kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #132:

score: 30
Acceptable Answer
time: 1ms
memory: 3596kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #133:

score: 30
Acceptable Answer
time: 1ms
memory: 3820kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed

Test #134:

score: 30
Acceptable Answer
time: 0ms
memory: 3612kb

input:

K

output:


result:

points 0.4000000060 points  0.4000000060 Correct: 40 robot(s) used, 1 hour(s) passed