Submission #161934

#TimeUsernameProblemLanguageResultExecution timeMemory
161934Alexa2001Xoractive (IZhO19_xoractive)C++17
100 / 100
17 ms400 KiB
#include "interactive.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> guess(int n)
{
	vector<int> ans(n), q, ans1, ans2;
    map<int, int> mp;

    int last = ask(n);
    ans[n-1] = last;
    int i, j;

    for(i=0; i<7; ++i)
    {
        q.clear();
        for(j=1; j<n; ++j)
            if(j & (1<<i)) q.push_back(j);

        if(q.size())
            ans1 = get_pairwise_xor(q);
                else ans1.clear();

        q.push_back(n);

        ans2 = get_pairwise_xor(q);

        map<int,int> now;

        for(auto it : ans1) --now[it];
        for(auto it : ans2) ++now[it];

        for(auto it : now)
            if(it.first && it.second)
                mp[it.first ^ last] |= (1<<i);
    }

    for(auto it : mp)
        ans[it.second - 1] = it.first;

	return ans;
}

Compilation message (stderr)

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:39:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for(auto it : mp)
     ^~~
Xoractive.cpp:42:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  return ans;
  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...