Submission #344560

#TimeUsernameProblemLanguageResultExecution timeMemory
344560SeDunionXoractive (IZhO19_xoractive)C++17
Compilation error
0 ms0 KiB
#include "interactive.h" using namespace std; vector<int> guess(int n) { vector <int> ans(n); ans[0] = ask(1); map<int,int> d; for (int i = 0 ; (1 << i) <= n ; ++ i) { vector<int> p; for (int j = 2 ; j <= n ; ++ j) { if (j >> i & 1) { p.push_back(j); } } auto p1 = get_pairwise_xor(p); p.push_back(1); auto p2 = get_pairwise_xor(p); map<int,int> mp; for (int i : p1) mp[i]++; for (int i : p2) mp[i]--; for (auto [i, j] : mp) if (j != 0) { d[i] |= (1 << i); } } for (auto [i, j] : d) { ans[j - 1] = i; } return ans; }

Compilation message (stderr)

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:7:2: error: 'map' was not declared in this scope
    7 |  map<int,int> d;
      |  ^~~
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:7:6: error: expected primary-expression before 'int'
    7 |  map<int,int> d;
      |      ^~~
Xoractive.cpp:18:7: error: expected primary-expression before 'int'
   18 |   map<int,int> mp;
      |       ^~~
Xoractive.cpp:19:20: error: 'mp' was not declared in this scope; did you mean 'p'?
   19 |   for (int i : p1) mp[i]++;
      |                    ^~
      |                    p
Xoractive.cpp:20:20: error: 'mp' was not declared in this scope; did you mean 'p'?
   20 |   for (int i : p2) mp[i]--;
      |                    ^~
      |                    p
Xoractive.cpp:21:22: error: 'mp' was not declared in this scope; did you mean 'p'?
   21 |   for (auto [i, j] : mp) if (j != 0) {
      |                      ^~
      |                      p
Xoractive.cpp:22:4: error: 'd' was not declared in this scope
   22 |    d[i] |= (1 << i);
      |    ^
Xoractive.cpp:25:21: error: 'd' was not declared in this scope
   25 |  for (auto [i, j] : d) {
      |                     ^