# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
250763 | IsaacMoris | Minerals (JOI19_minerals) | C++14 | 3 ms | 2816 KiB |
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<iostream>
#include <bits/stdc++.h>
#include "minerals.h"
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int low[100009], high[100009];
vector<int> v[100009];
void Solve(int N)
{
vector<int> v1, v2;
int last=0;
for (int i = 1; i <= 2 * N; ++i)
{
int x=Query(i);
if(x!=last)
v1.push_back(i);
else
v2.push_back(i);
last=x;
}
for(int i=0; i<N; i++)
high[i]=N-1;
int good=1;
bool p=1;
while(good)
{
good=0;
for(int i=0; i<N; i++)
if(low[i]!=high[i])
v[low[i]+high[i]>>1].push_back(i);
for(int i=0; i<N; i++)
{
int x=Query(v1[i]);
while(!v[i].empty())
{
int id=v[i].back();
good=1;
v[i].pop_back();
int q=Query(v2[id]);
if((q!=x && p) || (q==x && !p))
high[id]=i;
else
low[id]=i+1;
}
}
p=!p;
}
for(int i=0; i<N; i++)
Answer(v2[i], v1[low[i]]);
}
Compilation message (stderr)
# | 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... |