Submission #351100

# Submission time Handle Problem Language Result Execution time Memory
351100 2021-01-19T12:24:36 Z kshitij_sodani Xoractive (IZhO19_xoractive) C++14
100 / 100
7 ms 512 KB
//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first 
#define b second
#define endl '\n'
#define cc get_pairwise_xor 


#include "interactive.h"
using namespace std;
int it[101];

vector<int> proc(vector<int> aa,vector<int> bb){
	int ind=0;
	int ind2=0;
	vector<int> mm;

	while(ind<aa.size() or ind2<bb.size()){
		if(ind2==bb.size()){
			mm.pb(aa[ind]);
			ind++;
		}
		else{
			if(aa[ind]==bb[ind2]){
				ind++;
				ind2++;
				continue;
			}
			mm.pb(aa[ind]);
			ind++;
		}
	}
	return mm;
}
/*vector<int> cur[101];
void solve(vector<pair<int,int>> pp){
	if(pp.size()==0){
		return ;
	}
	vector<int> ss;
	for(auto j:pp){
		for(int k=j.a;k<=(j.a+j.b)/2;k++){
			ss.pb(k);
		}
	}
	vector<int> ee=cc(ss);
	ss.pb(1);
	vector<int> ff=cc(ss);
	vector<int> fin=proc(ff,ee);
	map<int,int> xx;
	for(auto j:fin){
		if(j!=0){
			xx[j^it[0]]++;
		}
	}
	vector<pair<int,int>> ne;
	for(auto j:pp){
		vector<int> a1;
		vector<int> a2;
		for(auto k:cur[j.a]){
			if(xx.find(k)!=xx.end()){
				a1.pb(k);
			}
			else{
				a2.pb(k);
			}
		}
		cur[j.a]=a1;
		cur[((j.a+j.b)/2)+1]=a2;
		int mid=(j.a+j.b)/2;
		if(mid>j.a){
			ne.pb({j.a,mid});
		}
		if(mid+1<j.b){
			ne.pb({mid+1,j.b});
		}
	}
	solve(ne);
}*/
map<int,int> ac[101];
vector<int> guess(int n) {
	it[0]=ask(1);
	vector<int> ss;
		for(int k=2;k<=n;k++){
			ss.pb(k);
		}
	set<int> cot;
	for(int i=0;i<7;i++){
		vector<int> ss;
		for(int k=2;k<=n;k++){
			if(k&(1<<i)){
				ss.pb(k);
				//cout<<k<<",";
			}
		}
		//cout<<endl;

			map<int,int> xx;
		if(ss.size()>0){

		
		vector<int> ee=cc(ss);
		ss.pb(1);
		vector<int> ff=cc(ss);
		vector<int> fin=proc(ff,ee);
	
		for(auto j:fin){
			if(j!=0){
				xx[j^it[0]]++;
				cot.insert(j^it[0]);
			}
		}
	}
		ac[i]=xx;
	}

	for(int i=2;i<=n;i++){
		for(auto j:cot){
			int st=1;
			for(int k=0;k<7;k++){
				if((i&(1<<k)) and ac[k].find(j)!=ac[k].end()){

				}
				else if((i&(1<<k))==0 and ac[k].find(j)==ac[k].end()){

				}
				else{
					st=0;
				}
			}
			if(st==1){
				it[i]=j;
			}
		}
	}
	/*vector<int> ee=cc(ss);
	ss.pb(1);
	vector<int> ff=cc(ss);
	vector<int> fin=proc(ff,ee);
	map<int,int> xx;
	for(auto j:fin){
		if(j!=0){
			xx[j^it[0]]++;
		}
	}
	for(auto j:xx){
		cur[2].pb(j.a);
	}


	solve({{2,n}});*/
	vector<int> ans;
	ans.pb(it[0]);
	for(int i=2;i<=n;i++){
		ans.pb(it[i]);
	}







	return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> proc(std::vector<int>, std::vector<int>)':
Xoractive.cpp:22:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  while(ind<aa.size() or ind2<bb.size()){
      |        ~~~^~~~~~~~~~
Xoractive.cpp:22:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  while(ind<aa.size() or ind2<bb.size()){
      |                         ~~~~^~~~~~~~~~
Xoractive.cpp:23:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   if(ind2==bb.size()){
      |      ~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 364 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 5 ms 364 KB Output is correct
4 Correct 4 ms 512 KB Output is correct
5 Correct 5 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 5 ms 364 KB Output is correct
8 Correct 4 ms 364 KB Output is correct
9 Correct 4 ms 364 KB Output is correct
10 Correct 4 ms 364 KB Output is correct
11 Correct 5 ms 364 KB Output is correct
12 Correct 5 ms 364 KB Output is correct
13 Correct 4 ms 364 KB Output is correct
14 Correct 4 ms 364 KB Output is correct
15 Correct 5 ms 364 KB Output is correct
16 Correct 5 ms 364 KB Output is correct
17 Correct 5 ms 364 KB Output is correct
18 Correct 5 ms 364 KB Output is correct
19 Correct 4 ms 364 KB Output is correct
20 Correct 5 ms 364 KB Output is correct
21 Correct 5 ms 512 KB Output is correct
22 Correct 4 ms 364 KB Output is correct
23 Correct 5 ms 364 KB Output is correct
24 Correct 5 ms 364 KB Output is correct
25 Correct 4 ms 364 KB Output is correct
26 Correct 4 ms 364 KB Output is correct
27 Correct 4 ms 364 KB Output is correct
28 Correct 4 ms 364 KB Output is correct
29 Correct 4 ms 364 KB Output is correct
30 Correct 4 ms 364 KB Output is correct
31 Correct 4 ms 364 KB Output is correct
32 Correct 4 ms 364 KB Output is correct
33 Correct 4 ms 364 KB Output is correct
34 Correct 5 ms 364 KB Output is correct
35 Correct 5 ms 364 KB Output is correct
36 Correct 4 ms 364 KB Output is correct
37 Correct 5 ms 364 KB Output is correct
38 Correct 5 ms 512 KB Output is correct
39 Correct 4 ms 364 KB Output is correct
40 Correct 4 ms 512 KB Output is correct
41 Correct 6 ms 364 KB Output is correct
42 Correct 6 ms 364 KB Output is correct
43 Correct 6 ms 364 KB Output is correct
44 Correct 4 ms 364 KB Output is correct
45 Correct 5 ms 364 KB Output is correct
46 Correct 4 ms 364 KB Output is correct
47 Correct 4 ms 364 KB Output is correct
48 Correct 5 ms 364 KB Output is correct
49 Correct 4 ms 364 KB Output is correct
50 Correct 5 ms 364 KB Output is correct
51 Correct 4 ms 364 KB Output is correct
52 Correct 4 ms 364 KB Output is correct
53 Correct 4 ms 364 KB Output is correct
54 Correct 5 ms 364 KB Output is correct
55 Correct 4 ms 364 KB Output is correct
56 Correct 4 ms 364 KB Output is correct
57 Correct 4 ms 364 KB Output is correct
58 Correct 4 ms 364 KB Output is correct
59 Correct 7 ms 512 KB Output is correct
60 Correct 4 ms 364 KB Output is correct
61 Correct 4 ms 364 KB Output is correct
62 Correct 5 ms 364 KB Output is correct
63 Correct 4 ms 364 KB Output is correct
64 Correct 4 ms 364 KB Output is correct
65 Correct 5 ms 364 KB Output is correct
66 Correct 4 ms 364 KB Output is correct
67 Correct 4 ms 364 KB Output is correct
68 Correct 4 ms 364 KB Output is correct
69 Correct 4 ms 364 KB Output is correct
70 Correct 4 ms 364 KB Output is correct
71 Correct 5 ms 364 KB Output is correct
72 Correct 4 ms 364 KB Output is correct
73 Correct 4 ms 364 KB Output is correct
74 Correct 4 ms 364 KB Output is correct
75 Correct 5 ms 364 KB Output is correct
76 Correct 5 ms 364 KB Output is correct
77 Correct 5 ms 364 KB Output is correct
78 Correct 4 ms 452 KB Output is correct
79 Correct 5 ms 364 KB Output is correct
80 Correct 5 ms 508 KB Output is correct
81 Correct 4 ms 364 KB Output is correct
82 Correct 4 ms 364 KB Output is correct
83 Correct 4 ms 512 KB Output is correct
84 Correct 5 ms 384 KB Output is correct
85 Correct 4 ms 364 KB Output is correct
86 Correct 6 ms 364 KB Output is correct
87 Correct 4 ms 364 KB Output is correct
88 Correct 4 ms 364 KB Output is correct
89 Correct 4 ms 364 KB Output is correct
90 Correct 4 ms 364 KB Output is correct
91 Correct 4 ms 364 KB Output is correct
92 Correct 4 ms 364 KB Output is correct
93 Correct 4 ms 364 KB Output is correct
94 Correct 4 ms 364 KB Output is correct
95 Correct 4 ms 364 KB Output is correct
96 Correct 4 ms 364 KB Output is correct
97 Correct 4 ms 364 KB Output is correct
98 Correct 4 ms 364 KB Output is correct
99 Correct 4 ms 364 KB Output is correct
100 Correct 5 ms 384 KB Output is correct