답안 #681588

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
681588 2023-01-13T12:12:58 Z Karuk Xoractive (IZhO19_xoractive) C++14
0 / 100
7 ms 336 KB
#include "interactive.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>sub(vector<int>a,vector<int>b) {
    map<int,int>m;
    for(int i:a)m[i]++;
    for(int j:b)m[j]--;
    vector<int>ans;
    for(pair<int,int>p:m) {
        for(int i=0;i<p.second;i++)ans.push_back(p.first);
    }
    return ans;
}
vector<int> guess(int n) {
    map<int,int>m;
    vector<int>nums;
    int x;
    x=ask(1);
    for(int i=6;i>=0;i--) {
        vector<int>askk;
        for(int j=2;j<=n;j++) {
            if(j&(1<<i))askk.push_back(j);
        }
        if(askk.size()==0)continue;
        vector<int>first=get_pairwise_xor(askk);
        askk.push_back(1);
        vector<int>second=get_pairwise_xor(askk);
        second=sub(second,first);
        for(int j=0;j<second.size();j++) {
            second[j]^=x;
            m[x]|=(1<<i);
        }
    }
    int anss[n+1];
    for(pair<int,int>p:m) {
        anss[p.second]=p.first;
    }
    anss[1]=x;
    vector<int>ans(n);
    for(int i=0;i<n;i++)ans[i]=anss[i+1];
    return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:29:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for(int j=0;j<second.size();j++) {
      |                     ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Output is not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 336 KB Output is not correct
2 Halted 0 ms 0 KB -