Submission #342103

# Submission time Handle Problem Language Result Execution time Memory
342103 2021-01-01T11:36:48 Z spike1236 Xoractive (IZhO19_xoractive) C++14
Compilation error
0 ms 0 KB
#include <interactive.h>
using namespace std;

#define veci vector <int>
#define pb push_back
#define f first
#define s second


veci guess(int n) {
    veci ans(n);
    ans[0] = ask(1);
    map <int, int> idx;
    for(int bit = 0; bit < __lg(n); ++bit) {
        veci cur;
        for(int i = 2; i <= n; ++i) if((i >> bit) & 1) cur.pb(i);
        if(cur.empty()) continue;
        veci with1 = cur;
        with1.pb(1);
        with1 = get_pairwise_xor(with1);
        cur = get_pairwise_xor(cur);
        multiset <int> st;
        for(auto it : with1) st.insert(it);
        for(auto it : cur) st.erase(st.find(it));
        for(auto it : st) idx[it ^ ans[0]] |= (1 << bit);
    }
    for(auto it : idx) ans[it.s - 1] = it.f;
    for(int i = 0; i < n; ++i) if(!ans[i]) ans[i] = ask(i + 1);
    return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:13:5: error: 'map' was not declared in this scope
   13 |     map <int, int> idx;
      |     ^~~
Xoractive.cpp:2:1: note: 'std::map' is defined in header '<map>'; did you forget to '#include <map>'?
    1 | #include <interactive.h>
  +++ |+#include <map>
    2 | using namespace std;
Xoractive.cpp:13:10: error: expected primary-expression before 'int'
   13 |     map <int, int> idx;
      |          ^~~
Xoractive.cpp:22:9: error: 'multiset' was not declared in this scope
   22 |         multiset <int> st;
      |         ^~~~~~~~
Xoractive.cpp:2:1: note: 'std::multiset' is defined in header '<set>'; did you forget to '#include <set>'?
    1 | #include <interactive.h>
  +++ |+#include <set>
    2 | using namespace std;
Xoractive.cpp:22:19: error: expected primary-expression before 'int'
   22 |         multiset <int> st;
      |                   ^~~
Xoractive.cpp:23:30: error: 'st' was not declared in this scope; did you mean 'it'?
   23 |         for(auto it : with1) st.insert(it);
      |                              ^~
      |                              it
Xoractive.cpp:24:28: error: 'st' was not declared in this scope; did you mean 'it'?
   24 |         for(auto it : cur) st.erase(st.find(it));
      |                            ^~
      |                            it
Xoractive.cpp:25:23: error: 'st' was not declared in this scope; did you mean 'it'?
   25 |         for(auto it : st) idx[it ^ ans[0]] |= (1 << bit);
      |                       ^~
      |                       it
Xoractive.cpp:25:27: error: 'idx' was not declared in this scope
   25 |         for(auto it : st) idx[it ^ ans[0]] |= (1 << bit);
      |                           ^~~
Xoractive.cpp:27:19: error: 'idx' was not declared in this scope
   27 |     for(auto it : idx) ans[it.s - 1] = it.f;
      |                   ^~~