답안 #707371

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
707371 2023-03-08T23:33:39 Z beaconmc Xoractive (IZhO19_xoractive) C++14
0 / 100
7 ms 464 KB
#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);
	while (sus.size() != 0){
		FOR(i,0,sus2.size()) if (sus2[i] == sus[sus.size()-1]){sus.pop_back(); sus2[i] = -1;break;}
	}
	vector<int> temp;
	for (auto i : sus2){
		if (i != -1) 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]);
	}
	for (auto&i : imp){
		for (auto&j : i){
			everything.insert(j);

		}

	}


	imp[0].push_back(one);



	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 'std::vector<int> getnum(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++)
......
   35 |   FOR(i,0,sus2.size()) if (sus2[i] == sus[sus.size()-1]){sus.pop_back(); sus2[i] = -1;break;}
      |       ~~~~~~~~~~~~~~~              
Xoractive.cpp:35:3: note: in expansion of macro 'FOR'
   35 |   FOR(i,0,sus2.size()) if (sus2[i] == sus[sus.size()-1]){sus.pop_back(); sus2[i] = -1;break;}
      |   ^~~
Xoractive.cpp: In function 'int intersect(std::vector<std::vector<int> >)':
Xoractive.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -