Submission #425043

# Submission time Handle Problem Language Result Execution time Memory
425043 2021-06-12T12:41:49 Z doowey Xoractive (IZhO19_xoractive) C++14
100 / 100
128 ms 456 KB
#include "interactive.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair

const int N = 101;
const int B = 7;
vector<int> h1[B];
vector<int> h2[B];

vector<int> xor_sums(vector<int> ff){
    if(ff.empty()) return {};
    vector<int> nw = get_pairwise_xor(ff);
    vector<int> ret;
    int las = -1;
    for(auto x : nw){
        if(x != 0){
            if(x != las){
                ret.push_back(x);
                las = x;
            }
            else{
                las = -1;
            }
        }
    }
    return ret;
}

map<int, int> cnt;

vector<int> guess(int n) {
	int base = ask(1);
    for(int lg = 0; lg < B; lg ++ ){
        vector<int> que;
        for(int i = 2; i <= n; i ++ ){
            if((i & (1 << lg))){
                que.push_back(i);
            }
        }
        h1[lg] = xor_sums(que);
        que.push_back(1);
        h2[lg] = xor_sums(que);
    }
    int maxi;
    vector<int> outp = {base};
    for(int iq = 2 ; iq <= n; iq ++ ){
        map<int, int> cand;
        for(int lg = 0 ;lg < B; lg ++ ){
            cnt.clear();
            for(auto x : h2[lg]){
                cnt[x] ++ ;
            }
            for(auto x : h1[lg]){
                cnt[x] -- ;
            }
            vector<int> has;
            for(auto x : cnt){
                if(x.se == 1)
                    has.push_back(((x.fi)^base));
            }
            if((iq & (1 << lg))){
                for(auto x : has){
                    cand[x] ++ ;
                }
            }
            else{
                for(auto x : has){
                    cand[x] = -(int)1e9;
                }
            }
        }
        maxi = 0;
        for(auto x : cand){
            if(x.se > maxi){
                maxi = x.se;
            }
        }
        for(auto x : cand){
            if(x.se == maxi) {
                outp.push_back(x.fi);
                break;
            }
        }
    }
	return outp;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 102 ms 424 KB Output is correct
2 Correct 98 ms 424 KB Output is correct
3 Correct 32 ms 328 KB Output is correct
4 Correct 102 ms 424 KB Output is correct
5 Correct 119 ms 424 KB Output is correct
6 Correct 100 ms 424 KB Output is correct
7 Correct 33 ms 392 KB Output is correct
8 Correct 95 ms 448 KB Output is correct
9 Correct 101 ms 328 KB Output is correct
10 Correct 92 ms 428 KB Output is correct
11 Correct 33 ms 388 KB Output is correct
12 Correct 92 ms 420 KB Output is correct
13 Correct 95 ms 420 KB Output is correct
14 Correct 114 ms 448 KB Output is correct
15 Correct 33 ms 328 KB Output is correct
16 Correct 108 ms 328 KB Output is correct
17 Correct 103 ms 448 KB Output is correct
18 Correct 94 ms 424 KB Output is correct
19 Correct 31 ms 328 KB Output is correct
20 Correct 102 ms 432 KB Output is correct
21 Correct 105 ms 428 KB Output is correct
22 Correct 100 ms 432 KB Output is correct
23 Correct 34 ms 328 KB Output is correct
24 Correct 106 ms 328 KB Output is correct
25 Correct 117 ms 424 KB Output is correct
26 Correct 97 ms 328 KB Output is correct
27 Correct 34 ms 328 KB Output is correct
28 Correct 98 ms 424 KB Output is correct
29 Correct 103 ms 328 KB Output is correct
30 Correct 95 ms 424 KB Output is correct
31 Correct 35 ms 388 KB Output is correct
32 Correct 98 ms 328 KB Output is correct
33 Correct 113 ms 328 KB Output is correct
34 Correct 101 ms 428 KB Output is correct
35 Correct 34 ms 380 KB Output is correct
36 Correct 100 ms 428 KB Output is correct
37 Correct 99 ms 328 KB Output is correct
38 Correct 128 ms 424 KB Output is correct
39 Correct 34 ms 328 KB Output is correct
40 Correct 100 ms 424 KB Output is correct
41 Correct 95 ms 328 KB Output is correct
42 Correct 103 ms 424 KB Output is correct
43 Correct 32 ms 328 KB Output is correct
44 Correct 95 ms 328 KB Output is correct
45 Correct 105 ms 436 KB Output is correct
46 Correct 95 ms 328 KB Output is correct
47 Correct 31 ms 376 KB Output is correct
48 Correct 94 ms 328 KB Output is correct
49 Correct 98 ms 428 KB Output is correct
50 Correct 110 ms 328 KB Output is correct
51 Correct 32 ms 328 KB Output is correct
52 Correct 93 ms 328 KB Output is correct
53 Correct 97 ms 328 KB Output is correct
54 Correct 102 ms 328 KB Output is correct
55 Correct 31 ms 328 KB Output is correct
56 Correct 105 ms 448 KB Output is correct
57 Correct 107 ms 328 KB Output is correct
58 Correct 94 ms 448 KB Output is correct
59 Correct 35 ms 328 KB Output is correct
60 Correct 99 ms 328 KB Output is correct
61 Correct 96 ms 436 KB Output is correct
62 Correct 105 ms 440 KB Output is correct
63 Correct 31 ms 328 KB Output is correct
64 Correct 92 ms 328 KB Output is correct
65 Correct 106 ms 328 KB Output is correct
66 Correct 105 ms 436 KB Output is correct
67 Correct 33 ms 376 KB Output is correct
68 Correct 94 ms 328 KB Output is correct
69 Correct 100 ms 428 KB Output is correct
70 Correct 100 ms 424 KB Output is correct
71 Correct 33 ms 328 KB Output is correct
72 Correct 96 ms 432 KB Output is correct
73 Correct 102 ms 432 KB Output is correct
74 Correct 96 ms 328 KB Output is correct
75 Correct 34 ms 328 KB Output is correct
76 Correct 103 ms 436 KB Output is correct
77 Correct 95 ms 436 KB Output is correct
78 Correct 100 ms 424 KB Output is correct
79 Correct 31 ms 328 KB Output is correct
80 Correct 97 ms 328 KB Output is correct
81 Correct 101 ms 328 KB Output is correct
82 Correct 97 ms 424 KB Output is correct
83 Correct 31 ms 372 KB Output is correct
84 Correct 101 ms 328 KB Output is correct
85 Correct 101 ms 420 KB Output is correct
86 Correct 103 ms 328 KB Output is correct
87 Correct 38 ms 372 KB Output is correct
88 Correct 101 ms 328 KB Output is correct
89 Correct 120 ms 428 KB Output is correct
90 Correct 93 ms 328 KB Output is correct
91 Correct 33 ms 328 KB Output is correct
92 Correct 102 ms 328 KB Output is correct
93 Correct 108 ms 420 KB Output is correct
94 Correct 97 ms 328 KB Output is correct
95 Correct 31 ms 388 KB Output is correct
96 Correct 96 ms 424 KB Output is correct
97 Correct 97 ms 328 KB Output is correct
98 Correct 94 ms 328 KB Output is correct
99 Correct 33 ms 456 KB Output is correct
100 Correct 103 ms 328 KB Output is correct