Submission #168406

# Submission time Handle Problem Language Result Execution time Memory
168406 2019-12-13T03:16:22 Z Nordway Xoractive (IZhO19_xoractive) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include"grader.h
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define up_b upper_bound
#define low_b lower_bound
#define nl '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

const int N=2e5+11;
const int M=1e6+11;
const int inf=1e9;
const ll INF=1e18;
const ll mod=1e9+7;
const double EPS=1e-9;

multiset<int>query(vector<int>v){
  multiset<int>res;
  vector<int>v2=get_pairwise_xor(v);
  for(int i=0;i<sz(v2);i++){
    res.insert(v2[i]);
  }
  return res;
}

multiset<int>num[7];

vector<int>guess(int n){
  vector<int>res;
  res.pb(ask(1));
  multiset<int>S;
  for(int i=0;i<7;i++){
    vector<int>v;
    for(int j=2;j<=n;j++){
      if(((j>>i)&1)==0)continue;
      v.pb(j);
    }
    multiset<int>m1=query(v);
    v.pb(1);
    multiset<int>m2=query(v);
    m2.erase(m2.find(0));
    for(int val:m1)m2.erase(val);
    for(int val:m2){
      num[i].insert(val);
      S.insert(val);
    }
  }
  for(int i=2;i<=n;i++){
    multiset<int>s=S;
    for(int j=0;j<7;j++){
      if(((i>>j)&1)==0)continue;
      multiset<int>m;
      for(int val:num[j]){
        auto it=s.find(val);
        if(it==s.end())continue;
        m.insert(it);
      }
      s=m;
    }
    for(int j=0;j<7;j++){
      if(((i>>j)&1)==1)continue;
      for(int val:num[j]){
        auto it=s.find(val);
        if(it==s.end())continue;
        s.erase(it);
      }
    }
    res.pb(*s.begin());
  }
  return res;
}

Compilation message

Xoractive.cpp:2:9: warning: missing terminating " character
 #include"grader.h
         ^
Xoractive.cpp:2:9: error: #include expects "FILENAME" or <FILENAME>
 #include"grader.h
         ^~~~~~~~~
Xoractive.cpp: In function 'std::multiset<int> query(std::vector<int>)':
Xoractive.cpp:31:17: error: 'get_pairwise_xor' was not declared in this scope
   vector<int>v2=get_pairwise_xor(v);
                 ^~~~~~~~~~~~~~~~
Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:42:10: error: 'ask' was not declared in this scope
   res.pb(ask(1));
          ^~~
Xoractive.cpp:68:20: error: no matching function for call to 'std::multiset<int>::insert(std::_Rb_tree_const_iterator<int>&)'
         m.insert(it);
                    ^
In file included from /usr/include/c++/7/set:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87,
                 from Xoractive.cpp:1:
/usr/include/c++/7/bits/stl_multiset.h:492:7: note: candidate: std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]
       insert(const value_type& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:492:7: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'const value_type& {aka const int&}'
/usr/include/c++/7/bits/stl_multiset.h:497:7: note: candidate: std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::value_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]
       insert(value_type&& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:497:7: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'std::multiset<int>::value_type&& {aka int&&}'
/usr/include/c++/7/bits/stl_multiset.h:522:7: note: candidate: std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]
       insert(const_iterator __position, const value_type& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:522:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/7/bits/stl_multiset.h:527:7: note: candidate: std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(std::multiset<_Key, _Compare, _Alloc>::const_iterator, std::multiset<_Key, _Compare, _Alloc>::value_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<int>; std::multiset<_Key, _Compare, _Alloc>::value_type = int]
       insert(const_iterator __position, value_type&& __x)
       ^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:527:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/7/bits/stl_multiset.h:541:2: note: candidate: template<class _InputIterator> void std::multiset<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]
  insert(_InputIterator __first, _InputIterator __last)
  ^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:541:2: note:   template argument deduction/substitution failed:
Xoractive.cpp:68:20: note:   candidate expects 2 arguments, 1 provided
         m.insert(it);
                    ^
In file included from /usr/include/c++/7/set:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87,
                 from Xoractive.cpp:1:
/usr/include/c++/7/bits/stl_multiset.h:553:7: note: candidate: void std::multiset<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]
       insert(initializer_list<value_type> __l)
       ^~~~~~
/usr/include/c++/7/bits/stl_multiset.h:553:7: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'std::initializer_list<int>'