/*
IN THE NAME OF GOD
*/
#include <bits/stdc++.h>
#include "interactive.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef long double ld;
#define F first
#define S second
#define Mp make_pair
#define pb push_back
#define pf push_front
#define size(x) ((ll)x.size())
#define all(x) (x).begin(),(x).end()
#define kill(x) cout << x << '\n', exit(0);
#define fuck(x) cout << "(" << #x << " , " << x << ")" << endl
#define endl '\n'
vector<int> guess(int n) {
vector<int> ans;
if(n <= 15) {
for(int i=1; i<=n; i++) ans.pb(ask(i));
return ans;
}
ans.pb(ask(1));
for(int i=0; i<n-1; i++) ans.pb(0);
vector<int> vec[n+1];
map<int, int> mp[10], mp2[10];
set<int> st;
for(int b=0; b<7; b++) {
for(int i=2; i<=n; i++) {
if((i&(1<<b)) > 0) {
vec[b].pb(i);
}
}
vector<int> tmp[2];
for(auto it : vec[b]) {
tmp[0].pb(it); tmp[1].pb(it);
}
tmp[1].pb(1);
tmp[0] = get_pairwise_xor(tmp[0]);
tmp[1] = get_pairwise_xor(tmp[1]);
for(auto it : tmp[1]) {
mp[b][it] ++;
}
for(auto it : tmp[0]) {
mp[b][it] --;
}
mp[b][0]--;
for(auto it : mp[b]) {
if(it.S == 2) {
mp2[b][it.F^ans[0]] ++;
st.insert(it.F^ans[0]);
}
}
}
for(auto it : st) {
int x = 0;
for(int b=0; b<7; b++) {
if(mp2[b][it] == 1) {
x += (1<<b);
}
}
ans[x - 1] = it;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
600 KB |
Output is correct |
2 |
Correct |
3 ms |
600 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
600 KB |
Output is correct |
5 |
Correct |
3 ms |
600 KB |
Output is correct |
6 |
Correct |
3 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
344 KB |
Output is correct |
8 |
Correct |
3 ms |
600 KB |
Output is correct |
9 |
Correct |
3 ms |
600 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
2 ms |
344 KB |
Output is correct |
12 |
Correct |
3 ms |
600 KB |
Output is correct |
13 |
Correct |
3 ms |
600 KB |
Output is correct |
14 |
Correct |
3 ms |
600 KB |
Output is correct |
15 |
Correct |
2 ms |
344 KB |
Output is correct |
16 |
Correct |
3 ms |
600 KB |
Output is correct |
17 |
Correct |
3 ms |
600 KB |
Output is correct |
18 |
Correct |
3 ms |
600 KB |
Output is correct |
19 |
Correct |
2 ms |
344 KB |
Output is correct |
20 |
Correct |
3 ms |
600 KB |
Output is correct |
21 |
Correct |
3 ms |
600 KB |
Output is correct |
22 |
Correct |
4 ms |
600 KB |
Output is correct |
23 |
Correct |
2 ms |
344 KB |
Output is correct |
24 |
Correct |
3 ms |
772 KB |
Output is correct |
25 |
Correct |
3 ms |
600 KB |
Output is correct |
26 |
Correct |
3 ms |
600 KB |
Output is correct |
27 |
Correct |
2 ms |
344 KB |
Output is correct |
28 |
Correct |
3 ms |
600 KB |
Output is correct |
29 |
Correct |
3 ms |
600 KB |
Output is correct |
30 |
Correct |
3 ms |
600 KB |
Output is correct |
31 |
Correct |
2 ms |
344 KB |
Output is correct |
32 |
Correct |
3 ms |
600 KB |
Output is correct |
33 |
Correct |
3 ms |
784 KB |
Output is correct |
34 |
Correct |
3 ms |
600 KB |
Output is correct |
35 |
Correct |
2 ms |
344 KB |
Output is correct |
36 |
Correct |
4 ms |
600 KB |
Output is correct |
37 |
Correct |
4 ms |
600 KB |
Output is correct |
38 |
Correct |
3 ms |
776 KB |
Output is correct |
39 |
Correct |
2 ms |
344 KB |
Output is correct |
40 |
Correct |
3 ms |
600 KB |
Output is correct |
41 |
Correct |
3 ms |
588 KB |
Output is correct |
42 |
Correct |
3 ms |
600 KB |
Output is correct |
43 |
Correct |
2 ms |
344 KB |
Output is correct |
44 |
Correct |
3 ms |
600 KB |
Output is correct |
45 |
Correct |
3 ms |
600 KB |
Output is correct |
46 |
Correct |
3 ms |
600 KB |
Output is correct |
47 |
Correct |
2 ms |
344 KB |
Output is correct |
48 |
Correct |
3 ms |
600 KB |
Output is correct |
49 |
Correct |
3 ms |
600 KB |
Output is correct |
50 |
Correct |
3 ms |
600 KB |
Output is correct |
51 |
Correct |
2 ms |
596 KB |
Output is correct |
52 |
Correct |
3 ms |
600 KB |
Output is correct |
53 |
Correct |
3 ms |
600 KB |
Output is correct |
54 |
Correct |
3 ms |
600 KB |
Output is correct |
55 |
Correct |
2 ms |
344 KB |
Output is correct |
56 |
Correct |
3 ms |
600 KB |
Output is correct |
57 |
Correct |
4 ms |
600 KB |
Output is correct |
58 |
Correct |
3 ms |
788 KB |
Output is correct |
59 |
Correct |
2 ms |
344 KB |
Output is correct |
60 |
Correct |
3 ms |
600 KB |
Output is correct |
61 |
Correct |
3 ms |
600 KB |
Output is correct |
62 |
Correct |
3 ms |
600 KB |
Output is correct |
63 |
Correct |
2 ms |
520 KB |
Output is correct |
64 |
Correct |
3 ms |
600 KB |
Output is correct |
65 |
Correct |
3 ms |
600 KB |
Output is correct |
66 |
Correct |
3 ms |
600 KB |
Output is correct |
67 |
Correct |
2 ms |
344 KB |
Output is correct |
68 |
Correct |
3 ms |
600 KB |
Output is correct |
69 |
Correct |
3 ms |
600 KB |
Output is correct |
70 |
Correct |
3 ms |
600 KB |
Output is correct |
71 |
Correct |
2 ms |
344 KB |
Output is correct |
72 |
Correct |
3 ms |
600 KB |
Output is correct |
73 |
Correct |
3 ms |
600 KB |
Output is correct |
74 |
Correct |
3 ms |
600 KB |
Output is correct |
75 |
Correct |
2 ms |
344 KB |
Output is correct |
76 |
Correct |
3 ms |
600 KB |
Output is correct |
77 |
Correct |
3 ms |
600 KB |
Output is correct |
78 |
Correct |
3 ms |
600 KB |
Output is correct |
79 |
Correct |
2 ms |
344 KB |
Output is correct |
80 |
Correct |
3 ms |
600 KB |
Output is correct |
81 |
Correct |
3 ms |
600 KB |
Output is correct |
82 |
Correct |
3 ms |
600 KB |
Output is correct |
83 |
Correct |
2 ms |
344 KB |
Output is correct |
84 |
Correct |
3 ms |
688 KB |
Output is correct |
85 |
Correct |
3 ms |
600 KB |
Output is correct |
86 |
Correct |
3 ms |
600 KB |
Output is correct |
87 |
Correct |
2 ms |
344 KB |
Output is correct |
88 |
Correct |
3 ms |
600 KB |
Output is correct |
89 |
Correct |
3 ms |
600 KB |
Output is correct |
90 |
Correct |
3 ms |
768 KB |
Output is correct |
91 |
Correct |
2 ms |
344 KB |
Output is correct |
92 |
Correct |
3 ms |
756 KB |
Output is correct |
93 |
Correct |
3 ms |
852 KB |
Output is correct |
94 |
Correct |
3 ms |
600 KB |
Output is correct |
95 |
Correct |
2 ms |
344 KB |
Output is correct |
96 |
Correct |
3 ms |
600 KB |
Output is correct |
97 |
Correct |
3 ms |
664 KB |
Output is correct |
98 |
Correct |
3 ms |
600 KB |
Output is correct |
99 |
Correct |
2 ms |
344 KB |
Output is correct |
100 |
Correct |
3 ms |
600 KB |
Output is correct |