이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include"interactive.h"
using namespace std;
#define all(x) x.begin(), x.end()
using ll = long long;
vector<int> guess(int n) {
map<int, int> mp;
int c0 = ask(1);
mp[c0] = 1;
for (int h = 0; h < 7; ++h) {
vector<int> qq;
for (int i = 2; i <= n; ++i) {
if (i >> h & 1) qq.push_back(i);
}
if (qq.empty()) continue;
map<int, int> mp1, mp2;
{
vector<int> vals = get_pairwise_xor(qq);
for (auto i: vals) mp1[i]++;
for (int i = 0; i < qq.size(); ++i) mp1[0]--;
for (auto &[x, y]: mp1) y /= 2;
}
qq.push_back(1);
{
vector<int> vals = get_pairwise_xor(qq);
for (auto i: vals) mp2[i]++;
for (int i = 0; i < qq.size(); ++i) mp2[0]--;
for (auto &[x, y]: mp2) y /= 2;
}
for (auto [x, y]: mp1) mp2[x] -= y;
for (auto [x, y]: mp2) {
if (y) {
mp[x ^ c0] |= 1 << h;
}
}
}
vector<int> ans(n);
for (auto [x, y]: mp) ans[y - 1] = x;
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:22:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | for (int i = 0; i < qq.size(); ++i) mp1[0]--;
| ~~^~~~~~~~~~~
Xoractive.cpp:29:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
29 | for (int i = 0; i < qq.size(); ++i) mp2[0]--;
| ~~^~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |