답안 #174651

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
174651 2020-01-06T14:57:45 Z mosiashvililuka Xoractive (IZhO19_xoractive) C++14
6 / 100
8 ms 1912 KB
#include<bits/stdc++.h>
#include "interactive.h"
using namespace std;
int a,b,c,d,e,i,j,kl,n,l,r,ll,rr;
vector <int> pas,qw;
vector <pair <int, int> > qu[109];
multiset <int> s[109][109];
multiset <int> zx,xc,zzx;
pair <int, int> msh[109][109];
map <int, int> mp;
vector <int> mk(int q, int w){
	vector <int> mim;
	for(int h=q; h<=w; h++) mim.push_back(h);
	return mim;
}
multiset <int> geet(vector <int> q){
	q=get_pairwise_xor(q);
	multiset <int> mim;
	for(int h=0; h<q.size(); h++) mim.insert(h);
	return mim;
}
void mkqu(int q, int w, int rr, pair <int, int> pp){
	if(kl<rr) kl=rr;
	if(w-q+1!=n-1){
		msh[q][w]=pp;
	}
	if(q==w) return;
	qu[rr].push_back(make_pair(q,(q+w)/2));
	mkqu(q,(q+w)/2,rr+1,make_pair(q,w));
	mkqu((q+w)/2+1,w,rr+1,make_pair(q,w));
}
vector <int> guess(int nzxc){
	n=nzxc;
	for(i=1; i<=n+1; i++) pas.push_back(0);
	if(n<=15){
		for(i=1; i<=n; i++){
			pas[i]=ask(i);
		}
		pas.erase(pas.begin());
		return pas;
	}
	pas[1]=ask(1);
	mkqu(2,n,1,make_pair(0,0));
	zx=geet(mk(1,n));
	xc=geet(mk(2,n));
	for(multiset <int>::iterator it=xc.begin(); it!=xc.end(); it++){
		zx.erase(zx.lower_bound((*it)));
	}
	mp.clear();
	for(multiset <int>::iterator it=zx.begin(); it!=zx.end(); it++){
		if((*it)==0) continue;
		mp[(*it)]++;
		if(mp[(*it)]%2==1){
			s[2][n].insert(((*it)^pas[1]));
		}
	}
	for(i=2; i<=kl; i++){
		qw.clear();
		for(j=0; j<qu[i].size(); j++){
			l=qu[i][j].first;r=qu[i][j].second;
			for(int h=l; h<=r; h++) qw.push_back(h);
		}
		zzx=geet(get_pairwise_xor(qw));
		for(j=0; j<qu[i].size(); j++){
			l=qu[i][j].first;r=qu[i][j].second;
			ll=msh[l][r].first;rr=msh[l][r].second;
			zx.clear();
			for(set <int>::iterator it=s[ll][rr].begin(); it!=s[ll][rr].end(); it++){
				multiset <int>::iterator t;
				t=zzx.lower_bound((*it));
				if(t==zzx.end()||(*t)!=(*it)){
					s[r+1][rr].insert((*it));
				}else{
					zx.insert((*it));
				}
			}
			s[l][r]=zx;
			if(l+1==r){
				pas[l]=ask(l);
				zx.erase(zx.lower_bound(pas[l]));
				pas[r]=(*zx.begin());
			}
		}
	}
	pas.erase(pas.begin());
	return pas;
}

Compilation message

Xoractive.cpp: In function 'std::multiset<int> geet(std::vector<int>)':
Xoractive.cpp:19:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int h=0; h<q.size(); h++) mim.insert(h);
               ~^~~~~~~~~
Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:59:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(j=0; j<qu[i].size(); j++){
            ~^~~~~~~~~~~~~
Xoractive.cpp:64:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(j=0; j<qu[i].size(); j++){
            ~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 2 ms 760 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1912 KB Not correct size
2 Halted 0 ms 0 KB -