Submission #226207

# Submission time Handle Problem Language Result Execution time Memory
226207 2020-04-22T21:49:38 Z zoooma13 Xoractive (IZhO19_xoractive) C++14
0 / 100
8 ms 512 KB
#include "bits/stdc++.h"
#include "interactive.h"
using namespace std;

vector<int> guess(int n){
	vector <int> ans(n); ans[0] = ask(1);
    map <int ,int> pos;

    int lg2 = 31-__builtin_clz(n);
    for(int b=0; b<=lg2; b++){
        vector <int> ids{1};
        for(int i=2; i<=n; i++)
            if(i&(1<<b))
                ids.push_back(i);

        auto vv = get_pairwise_xor(ids);
        multiset <int> vals = multiset<int>{vv.begin() ,vv.end()};
        ids.erase(ids.begin());
        for(int r : get_pairwise_xor(ids))
            vals.erase(vals.find(r));
        for(int r : vals)
            pos[r^ans[0]] |= (1<<b);
    }

    for(auto&p : pos)
        ans[p.second-1] = p.first;
	return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:25:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for(auto&p : pos)
     ^~~
Xoractive.cpp:27:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  return ans;
  ^~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 512 KB Output is not correct
2 Halted 0 ms 0 KB -