Submission #60293557


Source Code Expand

#include<bits/stdc++.h>
#include"atcoder/all"
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll inf=1ll<<61;
typedef modint1000000007 mi;

ll a[22];

int main(){
	ll n,d;cin>>n>>d;
	rep(i,n)cin>>a[i];
	ll ans=0;

	rep(i,1<<n){
		ll s=0;
		rep(j,n){
			if(i&(1<<j))s|=a[j];
		}
		int popcount=0;
		rep(j,d){
			if(s&(1ll<<j))popcount++;
		}
		if(__builtin_popcount(i)&1)ans-=(1ll<<(d-popcount));
		else ans+=(1ll<<(d-popcount));
	}
	cout<<ans<<endl;
}

Submission Info

Submission Time
Task 080 - Let's Share Bit(★6)
User Rho17
Language C++ 20 (gcc 12.2)
Score 6
Code Size 654 Byte
Status AC
Exec Time 87 ms
Memory 3692 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 6 / 6
Status
AC × 3
AC × 17
Set Name Test Cases
Sample 00_sample_0.txt, 00_sample_1.txt, 00_sample_2.txt
All 00_sample_0.txt, 00_sample_1.txt, 00_sample_2.txt, 01_random_0.txt, 01_random_1.txt, 01_random_2.txt, 01_random_3.txt, 01_random_4.txt, 01_random_5.txt, 01_random_6.txt, 01_random_7.txt, 01_random_8.txt, 01_random_9.txt, 02_maxima_0.txt, 02_maxima_1.txt, 02_maxima_2.txt, 02_maxima_3.txt
Case Name Status Exec Time Memory
00_sample_0.txt AC 1 ms 3532 KiB
00_sample_1.txt AC 1 ms 3480 KiB
00_sample_2.txt AC 87 ms 3496 KiB
01_random_0.txt AC 1 ms 3688 KiB
01_random_1.txt AC 1 ms 3528 KiB
01_random_2.txt AC 18 ms 3396 KiB
01_random_3.txt AC 1 ms 3464 KiB
01_random_4.txt AC 9 ms 3496 KiB
01_random_5.txt AC 1 ms 3600 KiB
01_random_6.txt AC 1 ms 3524 KiB
01_random_7.txt AC 1 ms 3528 KiB
01_random_8.txt AC 1 ms 3480 KiB
01_random_9.txt AC 8 ms 3488 KiB
02_maxima_0.txt AC 87 ms 3504 KiB
02_maxima_1.txt AC 87 ms 3692 KiB
02_maxima_2.txt AC 1 ms 3480 KiB
02_maxima_3.txt AC 73 ms 3600 KiB