Submission #182079

# Submission time Handle Problem Language Result Execution time Memory
182079 2020-01-09T11:40:02 Z stefdasca Xoractive (IZhO19_xoractive) C++14
0 / 100
6 ms 376 KB
#include "interactive.h"
#include<bits/stdc++.h>
using namespace std;

int n, sol[102];
vector<int> guess(int n)
{
    sol[1] = ask(1);
    map<int, int> ind;
    for(int i = 0; i <= 6; ++i)
    {
        vector<int> vec;
        for(int j = 2; j <= n; ++j)
            if(j & (1<<i))
                vec.push_back(j);
        if(vec.empty())
            continue;
        vector<int> vv = vec;
        vv.push_back(1);
        vv = get_pairwise_xor(vv);
        vec = get_pairwise_xor(vec);
        map<int, int> frq;
        for(int j = 0; j < vv.size(); ++j)
            if(vv[j] != 0)
                frq[vv[j]]++;
        for(int j = 0; j < vec.size(); ++j)
            if(vv[j] != 0)
                frq[vv[j]]--;
        for(int j = 0; j < vv.size(); ++j)
            if(frq[vv[j]] != 0)
                ind[(vv[j] ^ sol[1])] |= (1<<i);
    }
    for(auto poz : ind)
        sol[poz.second] = poz.first;
    vector<int> ans;
    for(int i = 1; i <= n; ++i)
        ans.push_back(sol[i]);
    return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:23:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0; j < vv.size(); ++j)
                        ~~^~~~~~~~~~~
Xoractive.cpp:26:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0; j < vec.size(); ++j)
                        ~~^~~~~~~~~~~~
Xoractive.cpp:29:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0; j < vv.size(); ++j)
                        ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output is not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 376 KB Output is not correct
2 Halted 0 ms 0 KB -