QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#828391#4283. Power of XORInvincibleWA 1ms3996kbC++232.0kb2024-12-23 16:26:142024-12-23 16:26:15

Judging History

This is the latest submission verdict.

  • [2024-12-23 16:26:15]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3996kb
  • [2024-12-23 16:26:14]
  • Submitted

answer

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <ctime>
#include <random>
#include <cassert>
#include <numeric>
#include <cmath>
#include <bitset>
#include <ext/pb_ds/assoc_container.hpp>
#define pii pair<int, int>
#define fi first
#define se second
#define MP make_pair
#define ep emplace
#define eb emplace_back
#define int long long
#define rep(i, j, k) for (int i = (j); i <= (k); i++)
#define per(i, j, k) for (int i = (j); i >= (k); i--)
typedef double db;
typedef long double ldb;
typedef long long ll;
//typedef __int128 lll;
typedef unsigned long long ull;
typedef unsigned int ui;
using namespace std;
using namespace __gnu_pbds;
bool Mbe;

//char buf[1<<20],*p1,*p2;
//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf,1,1<<20,stdin), p1 == p2) ? 0 : *p1++)
int read() {
	int s = 0, f = 1;
	char c = getchar();
	while (c < '0' || c > '9') f ^= (c == '-'), c = getchar();
	while (c >= '0' && c <= '9') s = s * 10 + c - '0', c = getchar();
	return f ? s : -s;
}
template<typename T>void chkmax(T&x,const T&y){if(x<y)x=y;}
template<typename T>void chkmin(T&x,const T&y){if(x>y)x=y;}

const int mod=1e9+7;
int fpow(int x,int k){
	int res=1;
	for(;k;k>>=1){
		if(k&1)res=res*x%mod;
		x=x*x%mod;
	}
	return res;
}
int n,k,a[45],val[1<<24],pw[45],b[45],ans;
int w1[45];
bool insert(int x){
	per(i,43,0){
		if(x>>i&1){
			if(!w1[i])return w1[i]=x,1;
			x^=w1[i];
		}
	}
	return 0;
}

bool Med;
signed main() {
	fprintf(stderr,"%.3lfMb\n",(&Mbe-&Med)/1024./1024.);
	n=read(),k=read();
	int cnt=0;
	rep(i,0,n)pw[i]=fpow(i,k);
	rep(i,0,n-1){
		if(insert(a[i]=read())){
			b[cnt++]=i;
		}
	}
	if(cnt<=24){
		rep(S,1,(1<<cnt)-1){
			val[S]=val[S^(S&-S)]^a[b[__lg(S&-S)]];
			ans=(ans+pw[__builtin_popcount(val[S])])%mod;
		}
		ans=ans*fpow(2,n-cnt)%mod;
	}else{
		
	}
	printf("%lld\n",ans);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3716kb

input:

3 2
1 2 3

output:

12

result:

ok 1 number(s): "12"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

2 1000000000
1 2

output:

140625003

result:

ok 1 number(s): "140625003"

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3996kb

input:

3 4
21 31 15

output:

195

result:

wrong answer 1st numbers differ - expected: '1076', found: '195'