This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "minerals.h"
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
typedef long long ll;
typedef long double ld;
using namespace std;
vector<int> h1, h2;
int c = 0; // kolko z h1 je vnutri?
int lst = 0;
bool other(int x) // je druhy prvok typu x vnutri?
{
int now = Query(x);
if (now != lst) return lst = now, false;
return lst = now, true;
}
void go(int c2)
{
while (c > c2) lst = Query(h1[--c]);
while (c < c2) lst = Query(h1[c++]);
}
void solve(int l, int r, vector<int> b)
{
if (l == r)
{
Answer(h1[l - 1], b[0]);
return;
}
int m = (l + r) / 2;
go(m);
vector<int> bl, br;
for (int i : b)
{
if (other(i)) bl.push_back(i);
else br.push_back(i);
}
solve(l, m, bl);
solve(m + 1, r, br);
}
void Solve(int n)
{
for (int i = 1; i <= 2 * n; i++)
{
if (other(i)) h2.push_back(i);
else h1.push_back(i), c++;
}
solve(1, n, h2);
}
# | 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... |