#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
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 |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |