Submission #485173

# Submission time Handle Problem Language Result Execution time Memory
485173 2021-11-06T12:40:45 Z MilosMilutinovic Xoractive (IZhO19_xoractive) C++14
0 / 100
3 ms 712 KB
#include "interactive.h"
#include <bits/stdc++.h>
#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define ll long long
using namespace std;

map<int, int> mp;

vector<int> guess(int n){
	int x = ask(1);
	ff(i,0,5){
		vector<int> niz;
		ff(j,1,n){
			if((j-1)&(1<<i))niz.push_back(j);
		}
		auto q1 = get_pairwise_xor(niz);
		niz.push_back(1);
		auto q2 = get_pairwise_xor(niz);
		int sz = q1.size();
		int j = 0;
		ff(i,0,q2.size()-1){
			while(j < sz && q1[j] < q2[i])j++;
			if(j < sz && q1[j] == q2[i]){
				mp[q2[i]] |= (1 << i);
			}
		}
	}
	vector<int> ans(n);
	ans[0] = x;
	for(auto x:mp)ans[x.second - 1] = x.first;
	return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:3:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    3 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
Xoractive.cpp:12:2: note: in expansion of macro 'ff'
   12 |  ff(i,0,5){
      |  ^~
Xoractive.cpp:3:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    3 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
Xoractive.cpp:14:3: note: in expansion of macro 'ff'
   14 |   ff(j,1,n){
      |   ^~
Xoractive.cpp:3:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    3 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
Xoractive.cpp:22:3: note: in expansion of macro 'ff'
   22 |   ff(i,0,q2.size()-1){
      |   ^~
Xoractive.cpp:3:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                                      ~~~~^~~~~~
Xoractive.cpp:22:3: note: in expansion of macro 'ff'
   22 |   ff(i,0,q2.size()-1){
      |   ^~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 200 KB Not correct size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 712 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -