답안 #154990

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
154990 2019-09-25T19:28:47 Z Pankin Xoractive (IZhO19_xoractive) C++14
94 / 100
14 ms 632 KB
#include <bits/stdc++.h>
#include "interactive.h"

#define mp make_pair
#define ll long long
#define ld long double
#define pb push_back
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fs first
#define sc second
#define getfiles ifstream cin("input.txt"); ofstream cout("output.txt");
#define endl '\n'
#define con continue
#define pii pair<ll, ll>
#define all(x) x.begin(), x.end()

using namespace std;

vector<int> a;

set<int> getMn(set<int> ind) {
    vector<int> pos;
    for (auto i = ind.begin(); i != ind.end(); i++)
        pos.pb(*i);
    pos.pb(1);
    vector<int> px1 = get_pairwise_xor(pos);
    pos.pop_back();
    vector<int> px2 = get_pairwise_xor(pos);
    set<int> ans;
    multiset<int> temp;
    for (int i = 0; i < px1.size(); i++)
        temp.insert(px1[i]);
    for (int i = 0; i < px2.size(); i++)
        temp.erase(temp.find(px2[i]));
    for (auto i = temp.begin(); i != temp.end(); i++)
        ans.insert(*i ^ a[1]);
    ans.erase(a[1]);
    return ans;
}

vector<int> guess(int n) {
    a.resize(n + 1);
	set<int> all;
    a[1] = ask(1);
    vector< vector< set<int> > > mn(7, vector< set<int> >(2)), ind(7, vector< set<int> >(2));
    for (int i = 2; i <= n; i++) {
        for (int j = 6; j >= 0; j--) {
            ind[j][(i>>j)%2].insert(i);
        }
    }
    for (int j = 6; j >= 0; j--) {
        mn[j][1] = getMn(ind[j][1]);
        for (auto i = mn[j][1].begin(); i != mn[j][1].end(); i++)
            all.insert(*i);
    }

    for (int j = 6; j >= 0; j--) {
        mn[j][0] = all;
        for (auto i = mn[j][1].begin(); i != mn[j][1].end(); i++)
            mn[j][0].erase(*i);
    }

    for (int i = 2; i <= n; i++) {
        set<int> cur = all;
        for (int j = 6; j >= 0; j--) {
            for (auto it = all.begin(); it != all.end(); it++) {
                if (mn[j][(i>>j)%2].find(*it) == mn[j][(i>>j)%2].end())
                    cur.erase(*it);
            }
        }
        a[i] = *cur.begin();
    }
    vector<int> ans;
    for (int i = 1; i <= n; i++)
        ans.pb(a[i]);
    return ans;
}

Compilation message

Xoractive.cpp: In function 'std::set<int> getMn(std::set<int>)':
Xoractive.cpp:31:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < px1.size(); i++)
                     ~~^~~~~~~~~~~~
Xoractive.cpp:33:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < px2.size(); i++)
                     ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Not correct size
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 504 KB Output is correct
2 Correct 11 ms 504 KB Output is correct
3 Correct 12 ms 504 KB Output is correct
4 Correct 12 ms 504 KB Output is correct
5 Correct 12 ms 508 KB Output is correct
6 Correct 12 ms 632 KB Output is correct
7 Correct 11 ms 592 KB Output is correct
8 Correct 11 ms 380 KB Output is correct
9 Correct 12 ms 504 KB Output is correct
10 Correct 11 ms 508 KB Output is correct
11 Correct 11 ms 504 KB Output is correct
12 Correct 11 ms 380 KB Output is correct
13 Correct 11 ms 504 KB Output is correct
14 Correct 12 ms 504 KB Output is correct
15 Correct 11 ms 504 KB Output is correct
16 Correct 13 ms 504 KB Output is correct
17 Correct 11 ms 504 KB Output is correct
18 Correct 11 ms 508 KB Output is correct
19 Correct 11 ms 504 KB Output is correct
20 Correct 11 ms 504 KB Output is correct
21 Correct 12 ms 504 KB Output is correct
22 Correct 12 ms 508 KB Output is correct
23 Correct 11 ms 504 KB Output is correct
24 Correct 12 ms 504 KB Output is correct
25 Correct 11 ms 432 KB Output is correct
26 Correct 11 ms 440 KB Output is correct
27 Correct 12 ms 632 KB Output is correct
28 Correct 11 ms 504 KB Output is correct
29 Correct 11 ms 504 KB Output is correct
30 Correct 11 ms 504 KB Output is correct
31 Correct 11 ms 504 KB Output is correct
32 Correct 11 ms 504 KB Output is correct
33 Correct 12 ms 504 KB Output is correct
34 Correct 11 ms 504 KB Output is correct
35 Correct 11 ms 504 KB Output is correct
36 Correct 12 ms 500 KB Output is correct
37 Correct 11 ms 504 KB Output is correct
38 Correct 11 ms 436 KB Output is correct
39 Correct 12 ms 424 KB Output is correct
40 Correct 11 ms 504 KB Output is correct
41 Correct 11 ms 436 KB Output is correct
42 Correct 11 ms 436 KB Output is correct
43 Correct 11 ms 436 KB Output is correct
44 Correct 11 ms 504 KB Output is correct
45 Correct 12 ms 504 KB Output is correct
46 Correct 11 ms 504 KB Output is correct
47 Correct 11 ms 436 KB Output is correct
48 Correct 11 ms 504 KB Output is correct
49 Correct 11 ms 504 KB Output is correct
50 Correct 11 ms 504 KB Output is correct
51 Correct 11 ms 504 KB Output is correct
52 Correct 11 ms 440 KB Output is correct
53 Correct 11 ms 504 KB Output is correct
54 Correct 12 ms 504 KB Output is correct
55 Correct 10 ms 504 KB Output is correct
56 Correct 12 ms 504 KB Output is correct
57 Correct 12 ms 504 KB Output is correct
58 Correct 11 ms 524 KB Output is correct
59 Correct 12 ms 524 KB Output is correct
60 Correct 11 ms 504 KB Output is correct
61 Correct 11 ms 380 KB Output is correct
62 Correct 12 ms 504 KB Output is correct
63 Correct 11 ms 504 KB Output is correct
64 Correct 11 ms 376 KB Output is correct
65 Correct 12 ms 504 KB Output is correct
66 Correct 11 ms 632 KB Output is correct
67 Correct 11 ms 504 KB Output is correct
68 Correct 11 ms 504 KB Output is correct
69 Correct 11 ms 504 KB Output is correct
70 Correct 11 ms 436 KB Output is correct
71 Correct 11 ms 504 KB Output is correct
72 Correct 11 ms 504 KB Output is correct
73 Correct 11 ms 504 KB Output is correct
74 Correct 11 ms 440 KB Output is correct
75 Correct 11 ms 504 KB Output is correct
76 Correct 12 ms 504 KB Output is correct
77 Correct 11 ms 376 KB Output is correct
78 Correct 11 ms 504 KB Output is correct
79 Correct 11 ms 504 KB Output is correct
80 Correct 12 ms 508 KB Output is correct
81 Correct 11 ms 504 KB Output is correct
82 Correct 11 ms 504 KB Output is correct
83 Correct 11 ms 504 KB Output is correct
84 Correct 12 ms 424 KB Output is correct
85 Correct 11 ms 504 KB Output is correct
86 Correct 12 ms 504 KB Output is correct
87 Correct 14 ms 632 KB Output is correct
88 Correct 12 ms 504 KB Output is correct
89 Correct 12 ms 504 KB Output is correct
90 Correct 11 ms 504 KB Output is correct
91 Correct 12 ms 504 KB Output is correct
92 Correct 12 ms 504 KB Output is correct
93 Correct 12 ms 504 KB Output is correct
94 Correct 11 ms 424 KB Output is correct
95 Correct 11 ms 632 KB Output is correct
96 Correct 11 ms 504 KB Output is correct
97 Correct 11 ms 436 KB Output is correct
98 Correct 11 ms 436 KB Output is correct
99 Correct 12 ms 504 KB Output is correct
100 Correct 12 ms 504 KB Output is correct