Submission #550495

# Submission time Handle Problem Language Result Execution time Memory
550495 2022-04-18T09:53:42 Z Killer2501 Xoractive (IZhO19_xoractive) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define pll pair<int, pii>
#define pii pair<int, int>
#define fi first
#define se second
using namespace std;
const int N = 2e5+5;
const int M = 350;
const int mod = 1e9+7;
const ll base = 75;
const ll inf = 1e12;
int n, t, tong;
int k, m, a[N], b[N];
ll ans, dp[N], d[N];
vector<int> adj[N], gr[N];
vector<pii> g[N];
vector<int> guess(int n)
{
    vector<int> res;
    map<int, int> mp;
    res.size(n);
    res[n-1] = ask(n);
    for(int j = 0; j < 8; j ++)
    {
        vector<int> l, r, vi;
        for(int i = 1; i < n; i ++)
            if(i >> j & 1)vi.pb(i);
        l = get_pairwise_xor(vi);
        vi.pb(n);
        r = get_pairwise_xor(vi);
        for(int il =(int) l.size()-1, ir = r.size()-1; il >= 0;)
        {
            if(l[li] == r[ri])
            {
                l.pop_back();
                swap(r[ri], r.back());
                r.pop_back();
                --li;
                --ri;
            }
            else --ri;
        }
        for(int x: l)mp[x^res[n-1]] |= (1<<j);
    }
    for(pii x: mp)res[x.se-1] = x.fi;
    return res;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:25:15: error: no matching function for call to 'std::vector<int>::size(int&)'
   25 |     res.size(n);
      |               ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from Xoractive.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:918:7: note: candidate: 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
  918 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/include/c++/10/bits/stl_vector.h:918:7: note:   candidate expects 0 arguments, 1 provided
Xoractive.cpp:26:16: error: 'ask' was not declared in this scope
   26 |     res[n-1] = ask(n);
      |                ^~~
Xoractive.cpp:32:13: error: 'get_pairwise_xor' was not declared in this scope
   32 |         l = get_pairwise_xor(vi);
      |             ^~~~~~~~~~~~~~~~
Xoractive.cpp:37:18: error: 'li' was not declared in this scope; did you mean 'il'?
   37 |             if(l[li] == r[ri])
      |                  ^~
      |                  il
Xoractive.cpp:37:27: error: 'ri' was not declared in this scope; did you mean 'ir'?
   37 |             if(l[li] == r[ri])
      |                           ^~
      |                           ir
Xoractive.cpp:35:39: warning: unused variable 'ir' [-Wunused-variable]
   35 |         for(int il =(int) l.size()-1, ir = r.size()-1; il >= 0;)
      |                                       ^~