Submission #618686

# Submission time Handle Problem Language Result Execution time Memory
618686 2022-08-02T06:39:48 Z maximath_1 Xoractive (IZhO19_xoractive) C++11
6 / 100
1 ms 256 KB
#include "interactive.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> guess(int n) {
	vector<int> ans(n);
	for(int i = 0; i < n; i ++)
		ans[i] = ask(i + 1);
	vector<int> a2 = ans;
	sort(a2.begin(), a2.end());
	a2.erase(unique(a2.begin(), a2.end()), a2.end());
	assert(a2.size() == n);
	return ans;
	ans[0] = ask(1);
	map<int, int> li;
	for(int lg = 0; lg <= 6; lg ++){
		vector<int> v;
		for(int j = 2; j <= n; j ++){
			if(j & (1 << lg)) v.push_back(j);
		}
		if(v.empty()) continue;
		vector<int> gtv = get_pairwise_xor(v);
		v.push_back(1);
		vector<int> gtvp = get_pairwise_xor(v);
		map<int, int> mp;
		for(int i : gtv) if(i) mp[i] --;
		for(int i : gtvp) if(i) mp[i] ++;
		for(auto i : mp){
			int cr = (i.first ^ ans[0]);
			li[cr] |= (1 << lg);
		}
	}

	for(auto i : li){
		ans[i.second - 1] = i.first;
	}
	return ans;
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from Xoractive.cpp:2:
Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:12:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |  assert(a2.size() == n);
      |         ~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -