제출 #728039

#제출 시각아이디문제언어결과실행 시간메모리
728039bitaro1337Xoractive (IZhO19_xoractive)C++14
컴파일 에러
0 ms0 KiB
#include "interactive.h" using namespace std; vector<int> guess(int n) { vector<int> ans(n, 0); ans[0] = get(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; }

컴파일 시 표준 에러 (stderr) 메시지

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:6:14: error: 'get' was not declared in this scope
    6 |     ans[0] = get(1);
      |              ^~~
Xoractive.cpp:7:5: error: 'map' was not declared in this scope
    7 |     map<int, int> pos;
      |     ^~~
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:9: error: expected primary-expression before 'int'
    7 |     map<int, int> pos;
      |         ^~~
Xoractive.cpp:10:13: error: 'j' was not declared in this scope
   10 |         for(j = 1; j < n; ++j) {
      |             ^
Xoractive.cpp:18:13: error: expected primary-expression before 'int'
   18 |         map<int, int> cnt;
      |             ^~~
Xoractive.cpp:19:32: error: 'cnt' was not declared in this scope; did you mean 'int'?
   19 |         for(auto x: A) if(x) ++cnt[x];
      |                                ^~~
      |                                int
Xoractive.cpp:20:32: error: 'cnt' was not declared in this scope; did you mean 'int'?
   20 |         for(auto x: B) if(x) --cnt[x];
      |                                ^~~
      |                                int
Xoractive.cpp:21:21: error: 'cnt' was not declared in this scope; did you mean 'int'?
   21 |         for(auto x: cnt) {
      |                     ^~~
      |                     int
Xoractive.cpp:23:17: error: 'pos' was not declared in this scope
   23 |                 pos[x.first ^ ans[0]] += (1 << i);
      |                 ^~~
Xoractive.cpp:27:17: error: 'pos' was not declared in this scope
   27 |     for(auto x: pos) ans[x.second] = x.first;
      |                 ^~~