QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#555767 | #7281. How to Avoid Disqualification in 75 Easy Steps | user10086 | 0 | 1ms | 3584kb | C++17 | 2.9kb | 2024-09-10 09:31:38 | 2024-09-10 09:31:40 |
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;
//
//}
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) & 4) == v) q.push_back(j);
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) & 4) - (k >> (i << 1) & 4) == 0) q0.push_back(k);
else if ((k >> (j << 1) & 4) - (k >> (i << 1) & 4) == 1) q1.push_back(k);
id[i][j] = idx;
send(q0), send(q1), idx += 2;
}
vector<int> res = wait();
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();
}
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]), s.insert(ans[i][1] - ans[fi][1]);
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++)
a = (a << 2) | ans[i][0], b = (b << 2) | ans[i][1];
return {a, b};
}
详细
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: 0
Wrong Answer
Test #120:
score: 0
Wrong Answer
time: 1ms
memory: 3584kb
input:
K
output:
result:
wrong answer Not correct