#include "interactive.h"
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <chrono>
#include <ctime>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <limits>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <functional>
#include <random>
#include <cassert>
using namespace std;
typedef long long ll;
typedef long double ld;
#define ff first
#define ss second
ll ttt;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll N = 3007;
ll n, m, k;
vector<int>sub(vector<int>a, vector<int>b) {
map<int, int>m;
for (int i : a)m[i]++;
for (int j : b)m[j]--;
vector<int>ans;
for (pair<int, int>p : m) {
for (int i = 0; i < p.second; i++)ans.push_back(p.first);
}
return ans;
}
vector<int> guess(int nn) {
n = nn;
map<int, int>m;
vector<int>nums;
int x = ask(1);
for (int i = 6; i >= 0; i--) {
vector<int>askk;
for (int j = 2; j <= n; j++) {
if (j & (1 << i))askk.push_back(j);
}
if (askk.size() == 0)continue;
vector<int>first = get_pairwise_xor(askk);
askk.push_back(1);
vector<int>second = get_pairwise_xor(askk);
second = sub(second, first);
for (int j = 0; j < second.size(); j++) {
second[j] ^= x;
m[second[j]] |= (1 << i);
}
}
int anss[101];
for (pair<int, int>p : m) {
anss[p.second] = p.first;
}
anss[1] = x;
vector<int> ans;
for (int i = 1; i <= n; i++) {
ans.push_back(anss[i]);
}
return ans;
}
Compilation message
Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:62:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
62 | for (int j = 0; j < second.size(); j++) {
| ~~^~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
592 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |