Submission #1822731
Source Code Expand
Copy
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <iostream> #include <sstream> #include <functional> #include <map> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <deque> #include <set> #include <list> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i)) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(X,Y) ((X)>(Y)?X=(Y),true:false) #define chmax(X,Y) ((X)<(Y)?X=(Y),true:false) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;} #define N 100010 ll dp[2][N]; int main(){ ll n, k; cin>>n>>k; vector<int> a(n); rep(i, n) cin>>a[i]; sort(all(a)); dp[0][0] = 1; ll s = 0; rep(i, n){ memcpy(dp[!(i%2)], dp[i%2], sizeof(ll)*(s+1)); rep(j, s+1){ if(dp[i%2][j]){ dp[!(i%2)][a[i]^j] += dp[i%2][j]; s = max(s, a[i]^j); } } s += a[i]; rep(j, s+1) dp[!(i%2)][j] %= mod; } //rep(i, 2) rep(j, 10) cout<<dp[i][j]<<" "; cout<<endl; cout<<dp[(n)%2][k]<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Limited Xor Subset |
User | Lepton |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1644 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:55:22: error: no matching function for call to ‘max(ll&, __gnu_cxx::__alloc_traits<std::allocator<int> >::value_type)’ s = max(s, a[i]^j); ^ In file included from /usr/include/c++/5/algorithm:61:0, from ./Main.cpp:1: /usr/include/c++/5/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/5/bits/stl_algobase.h:219:5: note: template argument deduction/substitution failed: ./Main.cpp:55:22: note: deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}’) s = max(s, a[i]^j); ^ In file included from /usr/include/c++/5/algorithm:61:0, from ./Main.cpp:1: /usr/include/c++/5/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr c...