제출 #387159

#제출 시각아이디문제언어결과실행 시간메모리
387159kevinxiehkXoractive (IZhO19_xoractive)C++17
컴파일 에러
0 ms0 KiB
#include "interactive.h" #include "bits/stdc++.h" using namespace std; vector<int> guess(int n) { vector<int> ans(n); ans[0] = ask(1); vector<int> hm[7]; vector<int> hv[7]; set<int> tot; for(int i = 0; i <= 6; i++) { if(n < (1 << i)) break; for(int j = 2; j <= n; j++) { if(j & (1 << i)) hm[i].push_back(j); } vector<int> have = get_pairwise_xor(hm[i]); hm[i].push_back(1); vector<int> have2 = get_pairwise_xor(hm[i]); int add = 1; for(int j = 0; j < have.size(); j++) { while(have[j] != have2[j + add]){ hv[i].push_back(have2[j + add] ^ ans[0]); tot.insert(have2[j + add] ^ ans[0]); add += 2; } } assert(have2[i].size() == hm[i].size() - 1); } for(auto x: tot) { int id = 0; for(int i = 0; i <= 6; i++) { if(n < (1 << i)) break; for(auto y: hv[i]) { if(x == y) { id += (1 << i); } } } ans[id - 1] = x; } return ans; }

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

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:20:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   for(int j = 0; j < have.size(); j++) {
      |                  ~~^~~~~~~~~~~~~
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from Xoractive.cpp:2:
Xoractive.cpp:27:19: error: request for member 'size' in 'have2.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   27 |   assert(have2[i].size() == hm[i].size() - 1);
      |                   ^~~~