Submission #56271

# Submission time Handle Problem Language Result Execution time Memory
56271 2018-07-11T00:06:28 Z Yehezkiel ICC (CEOI16_icc) C++11
0 / 100
3 ms 540 KB
#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=1;i<=a.size();i++)
		arr1[i]=a[i];
	for(int i=1;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

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=1;i<=a.size();i++)
              ~^~~~~~~~~~
icc.cpp:14:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;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
1 Incorrect 2 ms 376 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 540 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 540 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 540 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 540 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -