Submission #180876

# Submission time Handle Problem Language Result Execution time Memory
180876 2020-01-09T05:55:25 Z dimash241 Xoractive (IZhO19_xoractive) C++17
0 / 100
2 ms 524 KB
#include <bits/stdc++.h>
#include "interactive.h"

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
vector<int> a;
 
set<int> getMn(set<int> ind) {
    set<int> ans;
    if (ind.empty())
        return ans;
    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);
    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 & (1 << j))].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 & (1 << j))].find(*it) == mn[j][(i & (1 << j))].end())
                    cur.erase(*it);
            }
        }
        a[i] = *cur.begin();
    }
    vector < int > ans;
    for (int i = 1; i <= n; i++)
        ans.pb(a[i]);
    return ans;
}


// B...a

Compilation message

Xoractive.cpp: In function 'std::set<int> getMn(std::set<int>)':
Xoractive.cpp:64:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < px1.size(); i++)
                     ~~^~~~~~~~~~~~
Xoractive.cpp:66:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < px2.size(); i++)
                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 524 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -