#include "interactive.h"
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef int ll;
using namespace std;
//using namespace __gnu_pbds;
#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
//#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
int one = -1;
vector<int> getxor(vector<int> lis){
vector<int> ans = get_pairwise_xor(lis);
vector<int> realans;
FOR(i,0,ans.size()){
if (i%2==0) continue;
if (ans[i] == 0) continue;
realans.push_back(ans[i]);
}
return realans;
}
vector<int> getnum(vector<int> lis){
vector<int> sus = getxor(lis);
lis.push_back(1);
vector<int> sus2 = getxor(lis);
set<int> SUS, SUS2;
for (auto&i : sus) SUS.insert(i);
for (auto&i : sus2) SUS2.insert(i);
vector<int> temp;
for (auto&i : SUS2) if (SUS.count(i) == 0) temp.push_back(i^one);
return temp;
}
int intersect(vector<vector<int>> idk){
for (auto&i : idk[0]){
bool flag = false;
for (auto&j : idk){
if (!count(j.begin(),j.end(),i)) flag = true;
}
if (!flag) return i;
}
}
vector<int> imp[8];
vector<int> guess(int n) {
set<ll> everything;
one = ask(1);
FOR(i,2,n+1){
FOR(j,0,7){
if (i & (1<<j)) imp[j].push_back(i);
}
}
FOR(i,0,7){
if (imp[i].size()) imp[i] = getnum(imp[i]);
}
imp[0].push_back(one);
for (auto&i : imp){
for (auto&j : i){
everything.insert(j);
}
}
vector<int> ans;
FOR(i,1,n+1){
vector<vector<int>> temp;
FOR(j,0,7){
if (i & (1<<j)) temp.push_back(imp[j]);
else{
vector<int> temp2;
set<ll> idk;
for (auto&k : imp[j]) idk.insert(k);
for (auto&k : everything) if (idk.count(k) == 0) temp2.push_back(k);
temp.push_back(temp2);
}
}
ans.push_back(intersect(temp));
}
return ans;
}
Compilation message
Xoractive.cpp: In function 'std::vector<int> getxor(std::vector<int>)':
Xoractive.cpp:11:35: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
11 | #define FOR(i, x, y) for(ll i=x; i<y; i++)
......
21 | FOR(i,0,ans.size()){
| ~~~~~~~~~~~~~~
Xoractive.cpp:21:2: note: in expansion of macro 'FOR'
21 | FOR(i,0,ans.size()){
| ^~~
Xoractive.cpp: In function 'int intersect(std::vector<std::vector<int> >)':
Xoractive.cpp:52:1: warning: control reaches end of non-void function [-Wreturn-type]
52 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
288 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
336 KB |
Output is correct |
2 |
Correct |
6 ms |
336 KB |
Output is correct |
3 |
Runtime error |
2 ms |
464 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |