답안 #328451

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
328451 2020-11-16T16:12:45 Z ryansee Xoractive (IZhO19_xoractive) C++14
100 / 100
3 ms 384 KB
#include "interactive.h"

#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=int; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

long long LLINF = 1e18;
int INF = 1e9+1e6;
#define MAXN (200006)

vector<int> guess(int n) {
	vector<int> ans(n+1);
	ans[1]=ask(1);
	vector<vector<ll>> v;
	auto fix=[&](vector<ll> x,vector<ll> y){
		vector<ll> z;
		reverse(all(x)), reverse(all(y));
		while(x.size()) {
			if(y.empty()) { z.eb(x.back()); x.pop_back(); continue; }
			if(x.back()==y.back()) x.pop_back(), y.pop_back();
			else z.eb(x.back()), x.pop_back();
		}
		return z;
	};
	FOR(i,0,6) {
		vector<ll> one, tmp;
		FOR(j,2,n) if(1<<i&j) {
			one.eb(j);
		}
		
		if(one.size()) {
			tmp=get_pairwise_xor(one);
			one.eb(1);
			one=get_pairwise_xor(one);
			one=fix(one, tmp);
			one.resize(unique(all(one))-one.begin());
			if(one[0]==0) one.erase(one.begin());
			for(auto&i:one) i^=ans[1];
		}
		
		v.eb(one);
	}
	FOR(j,2,n) {
		vector<ll> c;
		FOR(i,0,6) if(1<<i&j) {
			vector<ll> d=v[i];
			if(c.empty()) c=d;
			else {
				vector<ll> b;
				for(auto i:c) if(find(all(d),i)==d.end()) b.eb(i);
				for(auto i:b) c.erase(find(all(c), i));
			}
		}
		FOR(i,0,6) if(!(1<<i&j)) {
			vector<ll> d=v[i];
			vector<ll> b;
			for(auto i:c) if(find(all(d),i)!=d.end()) b.eb(i);
			for(auto i:b) c.erase(find(all(c),i));
		}
		assert(c.size()==1), ans[j]=c[0];
	}
	ans.erase(ans.begin());
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 364 KB Output is correct
9 Correct 3 ms 364 KB Output is correct
10 Correct 3 ms 364 KB Output is correct
11 Correct 2 ms 364 KB Output is correct
12 Correct 3 ms 364 KB Output is correct
13 Correct 3 ms 364 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 3 ms 364 KB Output is correct
17 Correct 3 ms 364 KB Output is correct
18 Correct 3 ms 364 KB Output is correct
19 Correct 2 ms 364 KB Output is correct
20 Correct 3 ms 364 KB Output is correct
21 Correct 3 ms 364 KB Output is correct
22 Correct 3 ms 364 KB Output is correct
23 Correct 3 ms 364 KB Output is correct
24 Correct 3 ms 364 KB Output is correct
25 Correct 3 ms 364 KB Output is correct
26 Correct 3 ms 364 KB Output is correct
27 Correct 3 ms 364 KB Output is correct
28 Correct 3 ms 364 KB Output is correct
29 Correct 3 ms 364 KB Output is correct
30 Correct 3 ms 364 KB Output is correct
31 Correct 3 ms 364 KB Output is correct
32 Correct 3 ms 364 KB Output is correct
33 Correct 3 ms 364 KB Output is correct
34 Correct 3 ms 364 KB Output is correct
35 Correct 3 ms 364 KB Output is correct
36 Correct 3 ms 364 KB Output is correct
37 Correct 3 ms 364 KB Output is correct
38 Correct 3 ms 364 KB Output is correct
39 Correct 2 ms 364 KB Output is correct
40 Correct 3 ms 364 KB Output is correct
41 Correct 3 ms 364 KB Output is correct
42 Correct 3 ms 364 KB Output is correct
43 Correct 2 ms 364 KB Output is correct
44 Correct 3 ms 364 KB Output is correct
45 Correct 3 ms 364 KB Output is correct
46 Correct 3 ms 364 KB Output is correct
47 Correct 2 ms 364 KB Output is correct
48 Correct 3 ms 364 KB Output is correct
49 Correct 3 ms 364 KB Output is correct
50 Correct 3 ms 364 KB Output is correct
51 Correct 2 ms 364 KB Output is correct
52 Correct 3 ms 364 KB Output is correct
53 Correct 3 ms 364 KB Output is correct
54 Correct 3 ms 364 KB Output is correct
55 Correct 2 ms 364 KB Output is correct
56 Correct 3 ms 364 KB Output is correct
57 Correct 3 ms 364 KB Output is correct
58 Correct 3 ms 364 KB Output is correct
59 Correct 3 ms 364 KB Output is correct
60 Correct 3 ms 364 KB Output is correct
61 Correct 3 ms 364 KB Output is correct
62 Correct 3 ms 364 KB Output is correct
63 Correct 2 ms 364 KB Output is correct
64 Correct 3 ms 364 KB Output is correct
65 Correct 3 ms 364 KB Output is correct
66 Correct 3 ms 364 KB Output is correct
67 Correct 3 ms 364 KB Output is correct
68 Correct 3 ms 364 KB Output is correct
69 Correct 3 ms 364 KB Output is correct
70 Correct 3 ms 364 KB Output is correct
71 Correct 3 ms 364 KB Output is correct
72 Correct 3 ms 364 KB Output is correct
73 Correct 3 ms 364 KB Output is correct
74 Correct 3 ms 364 KB Output is correct
75 Correct 3 ms 364 KB Output is correct
76 Correct 3 ms 364 KB Output is correct
77 Correct 3 ms 364 KB Output is correct
78 Correct 3 ms 364 KB Output is correct
79 Correct 2 ms 364 KB Output is correct
80 Correct 3 ms 364 KB Output is correct
81 Correct 3 ms 364 KB Output is correct
82 Correct 3 ms 364 KB Output is correct
83 Correct 2 ms 364 KB Output is correct
84 Correct 3 ms 364 KB Output is correct
85 Correct 3 ms 364 KB Output is correct
86 Correct 3 ms 364 KB Output is correct
87 Correct 3 ms 364 KB Output is correct
88 Correct 3 ms 364 KB Output is correct
89 Correct 3 ms 364 KB Output is correct
90 Correct 3 ms 364 KB Output is correct
91 Correct 3 ms 364 KB Output is correct
92 Correct 3 ms 364 KB Output is correct
93 Correct 3 ms 364 KB Output is correct
94 Correct 3 ms 364 KB Output is correct
95 Correct 2 ms 364 KB Output is correct
96 Correct 3 ms 364 KB Output is correct
97 Correct 3 ms 364 KB Output is correct
98 Correct 3 ms 364 KB Output is correct
99 Correct 2 ms 364 KB Output is correct
100 Correct 3 ms 364 KB Output is correct