답안 #268649

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
268649 2020-08-16T16:09:57 Z aZvezda Xoractive (IZhO19_xoractive) C++14
0 / 100
1 ms 384 KB
#include <iostream>
#include <bits/stdc++.h>

#include "interactive.h"
using namespace std;

map<int, int> mp;

/*abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1234567890*/

vector<int> guess(int n) {
	int zer = ask(1);
	vector<int> ret(n);
	for(int bit = 0; bit < 7; bit ++) {
		vector<int> curr;
		for(int i = 0; i < n; i ++) if(i & (1 << bit)) {
			curr.push_back(i);
		}
		vector<int> ans1, ans2, ans3;
		ans1 = get_pairwise_xor(curr);
		curr.push_back(1);
		ans2 = get_pairwise_xor(curr);
		int cnt = 0;
		for(auto it : ans2) {
			if(cnt >= ans1.size() || ans1[cnt] != it) {
				ans3.push_back(it ^ zer);
			} else {
				cnt ++;
			}
		}
		for(auto it : ans3) {
			mp[it] |= (1 << bit);
		}
	}
	for(auto it : mp) {
		ret[it.first] = it.second;
	}
	return ret;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:27:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |    if(cnt >= ans1.size() || ans1[cnt] != it) {
      |       ~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Not unique
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Not unique
2 Halted 0 ms 0 KB -