Submission #728040

# Submission time Handle Problem Language Result Execution time Memory
728040 2023-04-21T21:02:40 Z bitaro1337 Xoractive (IZhO19_xoractive) C++14
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
#include "interactive.h"
using namespace std;

vector<int> guess(int n) {
    vector<int> ans(n, 0);
    ans[0] = ask(1);
    map<int, int> pos;
    for(int i = 0; i < 7; ++i) {
        vector<int> v;
        for(j = 1; j < n; ++j) {
            if(j >> i & 1) {
                v.push_back(j + 1);
            }
        }
        vector<int> A = get_pairwise_xor(v);
        v.push_back(1);
        vector<int> B = get_pairwise_xor(v);
        map<int, int> cnt;
        for(auto x: A) if(x) ++cnt[x];
        for(auto x: B) if(x) --cnt[x];
        for(auto x: cnt) {
            if(x.second) {
                pos[x.first ^ ans[0]] += (1 << i); 
            }
        }
    }
    for(auto x: pos) ans[x.second] = x.first;
    return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:11:13: error: 'j' was not declared in this scope
   11 |         for(j = 1; j < n; ++j) {
      |             ^