#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
#define all(x) x.begin(), x.end()
#define len(x) (int)(x).size()
#define x first
#define y second
template <typename T>
ostream &operator<<(ostream &o, const vector<T> &t);
template <typename T, typename T2>
ostream &operator<<(ostream &o, const pair<T, T2> &t);
template <typename T, typename T2>
ostream &operator<<(ostream &o, const pair<T, T2> &t)
{
return o << "{" << t.x << "," << t.y << "}";
}
template <typename T>
ostream &operator<<(ostream &o, const vector<T> &t)
{
o << "[";
for (int i = 0; i < len(t); i++)
{
cout << (i ? "," : "") << t[i];
}
return o << "]";
}
set<int> unknown, device;
int myQuery(int x)
{
if (device.count(x))
device.erase(x);
else
device.insert(x);
return Query(x);
}
void Solve(int n)
{
unknown.clear();
device.clear();
for (int i = 1; i <= 2 * n; i++)
unknown.insert(i);
while (len(unknown))
{
int v = *unknown.begin();
Query(v);
for (auto u : unknown | ranges::views::drop(1))
{
if (Query(u) == 1)
{
Answer(v, u);
unknown.erase(u);
unknown.erase(v);
Query(u);
break;
}
Query(u);
}
Query(v);
}
// while (len(unknown))
// {
// for (auto u : unknown | ranges::views::drop(1))
// {
// if (Query(u) != len(device))
// {
// int v = Query(u);
// // for(int i = 0;i < n)
// }
// }
// Query(v);
// }
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |