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 <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define MAXN 1000005
using namespace std;
typedef long long ll;
typedef pair < int , int > ii;
typedef set < int > si;
int n, top, onc, h[MAXN];
set < int > :: iterator it;
int sor(int x){
if(h[x])
top--;
else
top++;
h[x] = 1 - h[x];
return top - Query(x);
}
void coz(si a, si b){
if(a.size() == 1){
Answer(*a.begin(), *b.begin());
return;
}
int n = a.size();
si x, y;
for(int i = 1; i <= n/2; i++){
int of = *a.begin();
a.erase(of);
x.insert(of);
onc = sor(of);
}
for(it = b.begin(); it != b.end(); it++){
int don = sor(*it);
if(don != onc){
y.insert(*it);
}
onc = don;
}
for(it = y.begin(); it != y.end(); it++)
b.erase(*it);
for(it = x.begin(); it != x.end(); it++)
onc = sor(*it);
coz(a, y);
coz(x, b);
}
void Solve(int N) {
n = N+N;
set < int > a, b;
for(int i = 1; i <= n; i++){
int don = sor(i);
// cout << don << " " << onc << endl;
if(don > onc)
a.insert(i);
else
b.insert(i);
onc = don;
}
coz(a, b);
// for(it = a.begin(); it != a.end(); it++)cout << *it << " ";cout << endl;
}
# | 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... |