답안 #841544

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
841544 2023-09-01T16:19:01 Z Elvin_Fritl Xoractive (IZhO19_xoractive) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

     #include "interactive.h"


vector<int> guess(int n)
{

	int eded = ask(1);
	map<int,int>mm;
	for(int mask=6;mask>=0;mask--)
    {
        vector<int>v;
        for(int i=2;i<=n;i++)
        {
            if(i&(1<<mask)){
                v.push_back(i);
            }
        }
        if(v.size() == 0)
        {
            continue;
        }
        vector<int> fi = get_pairwise_xor(v);
        v.push_back(1);
        vector<int> se = get_pairwise_xor(v);
        map<int,int> m;
        for(int i:fi)
        {
            m[i]--;
        }
        for(int i:se)
        {
            m[i]++;
        }
        for(int i=0;i<se.size();i++){
            if(m[se[i]] > 0){
                mm[(se[i]^eded)] |= (1<<mask);
            }
        }
	}
	int anss[n + 1];
    for(pair<int, int>p : mm){
        anss[p.second] = p.first;
    }
    anss[1] = x;
    vector<int> ans;
    for (int i=1;i<=n;i++){
        ans.push_back(anss[i]);
    }
    return ans;

}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         for(int i=0;i<se.size();i++){
      |                     ~^~~~~~~~~~
Xoractive.cpp:47:15: error: 'x' was not declared in this scope
   47 |     anss[1] = x;
      |               ^