Submission #229470

# Submission time Handle Problem Language Result Execution time Memory
229470 2020-05-04T14:59:37 Z _7_7_ Xoractive (IZhO19_xoractive) C++14
100 / 100
12 ms 640 KB
#include "interactive.h"
#include <bits/stdc++.h>                                           
 
//#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 111;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;




int G[10];
set < int > Q[10];
multiset < int > q;
unordered_map < int, int > was, d;

int Ask (int x) {
	if (was.count(x))
		return was[x];
	return was[x] = ask(x);
}



vi guess(int n) {
	int p = 1;				
	while (p*2 <= n)
		p *= 2;
	--p;

	vi res;
	res.resize(n);	
	res[0] = ask(1);
	
	for (int i = 0; i <= 6; ++i) {
		if ((1 << i) > n)
			break;

		vi cur, cur1;
		for (int j = 2; j <= n; ++j)
			if (j & (1 << i)) {
				cur.pb(j);
				cur1.pb(j);
			}

		cur.pb(1);
		
		q.clear();				
		cur = get_pairwise_xor(cur);
		cur1 = get_pairwise_xor(cur1);
				

		for (auto j : cur)
			q.insert(j);

		for (auto j : cur1)
			q.erase(q.find(j));

		q.erase(0);

		for (auto j : q)
			Q[i].insert(j ^ res[0]);
	}

	
	set < int > QQ;
	for (int i = 0; i < 7; ++i)
		for (auto j : Q[i])
			QQ.insert(j);

	for (auto i : QQ) {
		int jj = 0;
		for (int j = 0; j < 7; ++j) 
			if (Q[j].count(i))
				jj |= (1 << j);
		 
		res[jj - 1] = i;
	}

	
	return res;		
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 512 KB Output is correct
2 Correct 9 ms 512 KB Output is correct
3 Correct 8 ms 512 KB Output is correct
4 Correct 9 ms 512 KB Output is correct
5 Correct 9 ms 512 KB Output is correct
6 Correct 9 ms 512 KB Output is correct
7 Correct 8 ms 512 KB Output is correct
8 Correct 9 ms 512 KB Output is correct
9 Correct 9 ms 512 KB Output is correct
10 Correct 9 ms 512 KB Output is correct
11 Correct 9 ms 512 KB Output is correct
12 Correct 9 ms 416 KB Output is correct
13 Correct 9 ms 512 KB Output is correct
14 Correct 9 ms 512 KB Output is correct
15 Correct 11 ms 512 KB Output is correct
16 Correct 9 ms 512 KB Output is correct
17 Correct 9 ms 512 KB Output is correct
18 Correct 9 ms 512 KB Output is correct
19 Correct 8 ms 512 KB Output is correct
20 Correct 9 ms 512 KB Output is correct
21 Correct 9 ms 512 KB Output is correct
22 Correct 9 ms 512 KB Output is correct
23 Correct 9 ms 512 KB Output is correct
24 Correct 9 ms 512 KB Output is correct
25 Correct 8 ms 512 KB Output is correct
26 Correct 9 ms 512 KB Output is correct
27 Correct 9 ms 512 KB Output is correct
28 Correct 9 ms 512 KB Output is correct
29 Correct 10 ms 512 KB Output is correct
30 Correct 9 ms 512 KB Output is correct
31 Correct 9 ms 512 KB Output is correct
32 Correct 9 ms 512 KB Output is correct
33 Correct 9 ms 512 KB Output is correct
34 Correct 9 ms 512 KB Output is correct
35 Correct 9 ms 512 KB Output is correct
36 Correct 9 ms 512 KB Output is correct
37 Correct 10 ms 512 KB Output is correct
38 Correct 9 ms 512 KB Output is correct
39 Correct 9 ms 512 KB Output is correct
40 Correct 9 ms 512 KB Output is correct
41 Correct 9 ms 512 KB Output is correct
42 Correct 10 ms 512 KB Output is correct
43 Correct 10 ms 512 KB Output is correct
44 Correct 10 ms 512 KB Output is correct
45 Correct 10 ms 512 KB Output is correct
46 Correct 9 ms 512 KB Output is correct
47 Correct 9 ms 512 KB Output is correct
48 Correct 9 ms 512 KB Output is correct
49 Correct 10 ms 512 KB Output is correct
50 Correct 9 ms 512 KB Output is correct
51 Correct 9 ms 512 KB Output is correct
52 Correct 10 ms 512 KB Output is correct
53 Correct 9 ms 512 KB Output is correct
54 Correct 9 ms 512 KB Output is correct
55 Correct 8 ms 512 KB Output is correct
56 Correct 11 ms 512 KB Output is correct
57 Correct 9 ms 512 KB Output is correct
58 Correct 9 ms 512 KB Output is correct
59 Correct 9 ms 512 KB Output is correct
60 Correct 9 ms 512 KB Output is correct
61 Correct 10 ms 512 KB Output is correct
62 Correct 10 ms 512 KB Output is correct
63 Correct 9 ms 512 KB Output is correct
64 Correct 8 ms 512 KB Output is correct
65 Correct 9 ms 512 KB Output is correct
66 Correct 10 ms 512 KB Output is correct
67 Correct 11 ms 512 KB Output is correct
68 Correct 10 ms 416 KB Output is correct
69 Correct 9 ms 512 KB Output is correct
70 Correct 10 ms 512 KB Output is correct
71 Correct 10 ms 544 KB Output is correct
72 Correct 10 ms 488 KB Output is correct
73 Correct 11 ms 512 KB Output is correct
74 Correct 9 ms 512 KB Output is correct
75 Correct 9 ms 512 KB Output is correct
76 Correct 9 ms 512 KB Output is correct
77 Correct 11 ms 512 KB Output is correct
78 Correct 9 ms 512 KB Output is correct
79 Correct 9 ms 512 KB Output is correct
80 Correct 11 ms 432 KB Output is correct
81 Correct 12 ms 512 KB Output is correct
82 Correct 9 ms 512 KB Output is correct
83 Correct 12 ms 432 KB Output is correct
84 Correct 10 ms 512 KB Output is correct
85 Correct 10 ms 512 KB Output is correct
86 Correct 11 ms 512 KB Output is correct
87 Correct 10 ms 512 KB Output is correct
88 Correct 9 ms 512 KB Output is correct
89 Correct 9 ms 512 KB Output is correct
90 Correct 9 ms 512 KB Output is correct
91 Correct 9 ms 524 KB Output is correct
92 Correct 9 ms 512 KB Output is correct
93 Correct 11 ms 640 KB Output is correct
94 Correct 9 ms 512 KB Output is correct
95 Correct 8 ms 512 KB Output is correct
96 Correct 8 ms 512 KB Output is correct
97 Correct 9 ms 512 KB Output is correct
98 Correct 9 ms 512 KB Output is correct
99 Correct 8 ms 512 KB Output is correct
100 Correct 11 ms 512 KB Output is correct