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>
using namespace std;
#define ll int
#define str string
#define ins insert
#define ld long double
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define sz size()
#define vll vector<ll>
#define bc back()
#define arr array
#define pll vector<pair<ll,ll>>
template<class S,class T>
bool chmin(S &a,const T &b) {
return a>b?(a=b)==b:false;
}
template<class S,class T>
bool chmax(S &a,const T &b) {
return a<b?(a=b)==b:false;
}
const ll N=1e5+5;
vll l,r;
vector<bool> vis(N);
pll ans;
ll x;
bool f[N*2];
void dnc(vll l,vll r){
if(l.sz==1){
Answer(l[0],r[0]);
return;
}
ld d=l.sz*382.0/1000.0;
ll m=d,i,j;
chmax(m,1);
vll nl,nr,nl2,nr2;
for(i=0;i<m;i++) {
nl.pb(l[i]);
x=Query(l[i]);
}
for(i=m;i<l.sz;i++){
nl2.pb(l[i]);
}
for(i=0;i<r.sz-1;i++){
ll y=Query(r[i]);
if(y==x)nr.pb(r[i]);
else nr2.pb(r[i]);
x=y;
}
if(nr.sz<nl.sz)nr.pb(r.bc);
else nr2.pb(r.bc);
dnc(nl,nr);
dnc(nl2,nr2);
}
void Solve(int n) {
ll i,j;
for(i=1;i<=n*2;i++){
ll y=Query(i);
f[i]=1;
if(x==y)r.pb(i);
else l.pb(i);
x=y;
}
dnc(l,r);
}
/*
4
1 5
2 6
3 4
7 8
*/
Compilation message (stderr)
minerals.cpp: In function 'void dnc(std::vector<int>, std::vector<int>)':
minerals.cpp:51:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
51 | for(i=m;i<l.sz;i++){
| ^
minerals.cpp:54:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
54 | for(i=0;i<r.sz-1;i++){
| ~^~~~~~~
minerals.cpp:44:14: warning: unused variable 'j' [-Wunused-variable]
44 | ll m=d,i,j;
| ^
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:66:10: warning: unused variable 'j' [-Wunused-variable]
66 | ll i,j;
| ^
# | 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... |