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 "icc.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
int n;
vector <int> kiri,kanan;
int tanya(vector <int> a,vector <int> b){
int arr1[105];
int arr2[105];
for(int i=0;i<a.size();i++)
arr1[i]=a[i];
for(int i=0;i<b.size();i++)
arr2[i]=b[i];
return query(a.size(),b.size(),arr1,arr2);
}
void print(vector <int> arr){
cout<<"printing arr"<<endl;
for(int i=0;i<arr.size();i++)
cout<<arr[i]<<" ";
cout<<endl;
}
void perkecil(int jenis){
vector <int> now,temp,other;
if(jenis==0)
{
now=kiri;
other=kanan;
}
else
{
now=kanan;
other=kiri;
}
while(now.size()>1)
{
assert(tanya(now,other));
temp.clear();
for(int i=now.size()/2;i<now.size();i++)
temp.pb(now[i]);
now.resize(now.size()/2);
if(tanya(now,other)==0)
{
now=temp;
assert(tanya(temp,other));
}
}
if(jenis==0)
kiri=now;
else
kanan=now;
}
void findAnggota(){
while(true)
{
vector <int> anggota;
anggota.resize(n);
for(int i=0;i<n;i++)
anggota[i]=i+1;
random_shuffle(all(anggota));
kiri.clear();
for(int i=0;i<n/2;i++)
kiri.pb(anggota[i]);
kanan.clear();
for(int i=n/2;i<n;i++)
kanan.pb(anggota[i]);
if(tanya(kiri,kanan))
break;
}
assert(tanya(kiri,kanan)==1);
}
void run(int _n){
srand(2305);
n=_n;
for(int i=0;i<n-1;i++)
{
findAnggota();
perkecil(0);
perkecil(1);
setRoad(kiri[0],kanan[0]);
}
}
Compilation message (stderr)
icc.cpp: In function 'int tanya(std::vector<int>, std::vector<int>)':
icc.cpp:12:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<a.size();i++)
~^~~~~~~~~
icc.cpp:14:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<b.size();i++)
~^~~~~~~~~
icc.cpp: In function 'void print(std::vector<int>)':
icc.cpp:21:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<arr.size();i++)
~^~~~~~~~~~~
icc.cpp: In function 'void perkecil(int)':
icc.cpp:42:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=now.size()/2;i<now.size();i++)
~^~~~~~~~~~~
# | 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... |