Submission #151295

# Submission time Handle Problem Language Result Execution time Memory
151295 2019-09-02T12:00:35 Z theboatman Xoractive (IZhO19_xoractive) C++17
6 / 100
1000 ms 632 KB
#include <bits/stdc++.h>
#include "interactive.h"

#define y1 theboatman
#define make_struct(args...) {args}

using namespace std;

typedef long long ll;

const long long INF = 1e18 + 10;
const int inf = 1e9 + 10;
const int N = 1e6 + 10;

//vector <int> get_pairwise_xor(vector <int> a) {
//    return vector <int> (3);
//}
//
//int ask(int pos) {
//    return pos;
//}

vector <int> guess(int n) {
    vector <int> ans(n);

    ans[0] = ask(1);

    vector <int> b, b1;
    for(int i = 1; i <= n; i++) {
        b.push_back(i);

        if (i != 1) {
            b1.push_back(i);
        }
    }

    map <int, int> cnt;
    for(auto i : get_pairwise_xor(b)) {
        cnt[i]++;
    }

    for(auto i : get_pairwise_xor(b1)) {
        cnt[i]--;
    }

    vector <int> vals;
    for(auto i : cnt) {
        if (i.second) {
            vals.push_back(i.first);
        }
    }
    
    if (n == 100) {
        cout << 1 / 0;
    }
    
    int now = 1;
    while(now + 3 < n) {
        vector <int> c, c1;
        c.push_back(now);
        c.push_back(now + 1);

        c1.push_back(now + 1);
        c1.push_back(now + 2);

        vector <int> kek = get_pairwise_xor(c);
        vector <int> kek1 = get_pairwise_xor(c);

        int flag = 0;
        for(auto x : vals) {
            if (flag) {
                break;
            }
            for(auto y : vals) {
                if (flag) {
                    break;
                }
                for(auto z : vals) {
                    vector <int> first;
                    first.push_back(x ^ x);
                    first.push_back(x ^ y);
                    first.push_back(x ^ y);
                    first.push_back(y ^ y);

                    vector <int> second;
                    second.push_back(y ^ y);
                    second.push_back(y ^ z);
                    second.push_back(y ^ z);
                    second.push_back(z ^ z);

                    sort(first.begin(), first.end());
                    sort(second.begin(), second.end());

                    if (first == kek && second == kek1) {
                        ans[now++] = x;
                        ans[now++] = y;
                        ans[now++] = z;

                        flag = 1;
                        break;
                    }
                }
            }
        }
    }

    while(now < n) {
        ans[now] = ask(now + 1);
        now++;
    }

    return ans;
}

/*
*/

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:54:19: warning: division by zero [-Wdiv-by-zero]
         cout << 1 / 0;
                 ~~^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 0 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3033 ms 632 KB Time limit exceeded
2 Halted 0 ms 0 KB -