답안 #336556

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
336556 2020-12-15T16:36:04 Z amunduzbaev Xoractive (IZhO19_xoractive) C++14
컴파일 오류
0 ms 0 KB
#include "interactive.h"
#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ll long long 
#define ld long double 
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define prc(n) fixed << setprecision(n)
#define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi acos(-1);
const int inf = 1e9+7;
const int N = 105;
 
vector<int> guess(int n){
	int fir = ask(1);
	vector<set<int>>a(10);
	for(int i=0;i<8;i++){
		vector<int>tmp;
		vector<int>ans, ans1;
		for(int j=2;j<=n;j++) if((1 << i) & j){
			tmp.pb(j);
		}
		if(tmp.empty()) continue;
		ans = get_pairwise_xor(tmp);
		tmp.pb(1);
		ans1 = get_pairwise_xor(tmp);
		multiset<int>ss;
		
		for(int j=0; j<sz(ans1); j++) ss.insert(ans1[j]);
		for(int j=0; j<sz(ans); j++) ss.erase(ss.find(ans[j]));
		for(auto x = ss.begin(); x != ss.end(); x++){
			int xx = *x;
			xx ^= fir;
			a[i].insert(xx);
		}
	}
	vector<int>ans(n);
	ans[0] = fir;
	for(int i=1;i<n;i++){
		int j = 0, l = 0;
		while(sz(a[j]) == 0 && j < 10) j++;
		if(j == 10) break;
		int cur = *a[j].begin();
		int in = 0;
		for(l = 0;l<7;l++){
			if(a[l].find(cur) != a[l].end()){
				a[l].erase(cur);
				in += (1<<l);
			}
		}
		ans[in -1] = cur;
	}
	 //for(int i=0;i<n;i++) cout<<ans[i]<<" ";
	//cout<<endl;
	return ans;
}
/*

20
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

*/

Compilation message

/tmp/ccLIDQlb.o: In function `query()':
grader.cpp:(.text+0x30): multiple definition of `query()'
/tmp/cc2NTUMp.o:Xoractive.cpp:(.text+0xb0): first defined here
/tmp/ccLIDQlb.o: In function `ask(int)':
grader.cpp:(.text+0x60): multiple definition of `ask(int)'
/tmp/cc2NTUMp.o:Xoractive.cpp:(.text+0xe0): first defined here
/tmp/ccLIDQlb.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc2NTUMp.o:Xoractive.cpp:(.text.startup+0x0): first defined here
/tmp/ccLIDQlb.o: In function `get_pairwise_xor(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0xc0): multiple definition of `get_pairwise_xor(std::vector<int, std::allocator<int> >)'
/tmp/cc2NTUMp.o:Xoractive.cpp:(.text+0x140): first defined here
collect2: error: ld returned 1 exit status