#include "avoid.h"
#include <bits/stdc++.h>
using namespace std;
const int n = 1000;
void my_send(function<bool(int)> f) {
vector<int> to_send;
for (int i = 0; i < n; ++i) {
if (f(i)) to_send.push_back(i + 1);
}
send(to_send);
}
std::pair<int, int> scout(int R, int H) {
for (int bit = 0; bit < 10; ++bit) {
my_send([&](int x) { return (x & (1 << bit)) == 0; });
}
for (int bit = 0; bit < 10; ++bit) {
my_send([&](int x) { return (x & (1 << bit)) != 0; });
}
auto p = wait();
int anb = 0, aob = 0;
int fst_diff = -1;
for (int bit = 0; bit < 10; ++bit) {
int has0 = p[bit], has1 = p[bit + 10];
if (has1) aob |= 1 << bit;
if (!has0) anb |= 1 << bit;
if (has0 && has1) {
if (fst_diff == -1) fst_diff = bit;
else {
my_send([&](int x) { return ((x >> bit) & 1) == ((x >> fst_diff) & 1);});
}
}
}
auto p2 = wait();
int p2i = 0;
// 13 8
int a = anb, b = anb | (1 << fst_diff);
for (int bit = 0; bit < 10; ++bit) {
int has0 = p[bit], has1 = p[bit + 10];
if (has0 && has1) {
if (bit == fst_diff) continue;
bool is_same = p2[p2i++];
if (!is_same) {
a |= 1 << bit;
} else {
b |= 1 << bit;
}
}
}
return {a + 1, b + 1};
}
#ifndef EVAL
#include "sample_grader.cpp"
#endif
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct: 21 robot(s) used, 2 hour(s) passed |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
420 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
424 KB |
Correct: 29 robot(s) used, 2 hour(s) passed |
2 |
Correct |
1 ms |
416 KB |
Correct: 29 robot(s) used, 2 hour(s) passed |
3 |
Correct |
1 ms |
416 KB |
Correct: 29 robot(s) used, 2 hour(s) passed |
4 |
Correct |
1 ms |
424 KB |
Correct: 29 robot(s) used, 2 hour(s) passed |
5 |
Correct |
1 ms |
420 KB |
Correct: 29 robot(s) used, 2 hour(s) passed |
6 |
Incorrect |
1 ms |
344 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
416 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |