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 "cave.h"
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,I,f[5009],F[5009],E;
vector <int> v,vv,S,D;
int TryCombination(vector <int> q){
int Q[a];
for(int h=0; h<a; h++) Q[h]=q[h];
return tryCombination(Q);
}
void Answer(vector <int> q, vector <int> w){
int Q[a],W[a];
for(int h=0; h<a; h++){
Q[h]=q[h];W[h]=w[h];
}
answer(Q,W);
}
void rec(vector <int> qw){
if(qw.size()==1){
D[qw[0]]=I;
if(e==I){
S[qw[0]]=1;
}else{
S[qw[0]]=0;
}
return;
}
int mid=qw.size()/2;
for(int h=0; h<mid; h++){
v[qw[h]]=1;
}
E=TryCombination(v);
for(int h=0; h<mid; h++){
v[qw[h]]=0;
}
if(e!=E){
vector <int> we;
for(int h=0; h<mid; h++) we.push_back(qw[h]);
rec(we);
}else{
vector <int> we;
for(int h=mid; h<qw.size(); h++) we.push_back(qw[h]);
rec(we);
}
}
void exploreCave(int Nn) {
a=Nn;S.resize(a);D.resize(a);
for(i=0; i<a; i++){
S[i]=-1;D[i]=-1;
}
for(i=0; i<a; i++) v.push_back(0);
for(I=0; I<a; I++){
for(i=0; i<a; i++) v[i]=0;
vv.clear();for(i=0; i<a; i++){
if(S[i]!=-1){
v[D[i]]=S[i];
}else{
vv.push_back(i);
}
}
e=TryCombination(v);
rec(vv);
}
Answer(S,D);
}
Compilation message (stderr)
cave.cpp: In function 'void rec(std::vector<int>)':
cave.cpp:42:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
42 | for(int h=mid; h<qw.size(); h++) we.push_back(qw[h]);
| ~^~~~~~~~~~
# | 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... |