Submission #898321

# Submission time Handle Problem Language Result Execution time Memory
898321 2024-01-04T13:46:02 Z otarius Xoractive (IZhO19_xoractive) C++17
Compilation error
0 ms 0 KB
#include "interactive.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cstring>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

void __print(int x) { cerr << x; }

void __print(long x) { cerr << x; }

void __print(long long x) { cerr << x; }

void __print(unsigned x) { cerr << x; }

void __print(unsigned long x) { cerr << x; }

void __print(unsigned long long x) { cerr << x; }

void __print(float x) { cerr << x; }

void __print(double x) { cerr << x; }

void __print(long double x) { cerr << x; }

void __print(char x) { cerr << '\'' << x << '\''; }

void __print(const char *x) { cerr << '\"' << x << '\"'; }

void __print(const string &x) { cerr << '\"' << x << '\"'; }

void __print(bool x) { cerr << (x ? "true" : "false"); }

template<typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}

template<typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i: x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}

void _print() { cerr << "]\n"; }

template<typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define ff first
#define sc second
#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define pii pair <int, int>
#define ull unsigned long long

// #define int long long
// #define int unsigned long long

const ll inf = 1e9 + 7;
const ll weirdMod = 998244353;

vector<int> opr(vector<int> cur) {
    map<int, int> cnt; cur.pb(1);
    vector<int> x = get_pairwise_xor(cur);
    cur.pop_back();
    vector<int> y = get_pairwise_xor(cur);
    for (int v : x) cnt[v]++;
    for (int v : y) {
        cnt[v]--;
        if (cnt[v] == 0)
            cnt.erase(v);
    } cnt.erase(0);
    vector<int> ans;
    for (auto v : cnt)
        ans.pb(v.ff);
    return ans;
}
int[] guess(int n) {
    int val = ask(1);
    vector<int> vec[10];
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < 7; j++) {
            if ((i >> j) % 2 == 1) vec[j].pb(i);
        }
    } map<int, int> mp;
    for (int i = 0; i < 7; i++) {
        vector<int> cur = opr(vec[i]);
        for (int v : cur) mp[v] += (1 << i);
    } int ans[n];
    for (auto v : mp)
        ans[v.sc] = (val ^ v.ff);
    return ans;
}

Compilation message

Xoractive.cpp:101:4: error: structured binding declaration cannot have type 'int'
  101 | int[] guess(int n) {
      |    ^~
Xoractive.cpp:101:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
Xoractive.cpp:101:4: error: empty structured binding declaration
Xoractive.cpp:101:7: error: expected initializer before 'guess'
  101 | int[] guess(int n) {
      |       ^~~~~