提出 #48251071


ソースコード 拡げる

// LUOGU_RID: 138568749
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;

#define rep(i,l,r) for(int i(l);i<=(r);++i)
#define per(i,r,l) for(int i(r);i>=(l);--i)
#define eb emplace_back
#define File(filename) freopen(filename ".in","r",stdin),freopen(filename ".out","w",stdout)

#ifdef EXODUS
	#define Debug(...) fprintf(stderr,__VA_ARGS__)
#else
	#define Debug(...) 0
#endif

//=========================================================================================================
// Something about IO

template<typename T>
void read(T &x){
	x=0;T flg=1;
	char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')flg=-1;ch=getchar();}
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	x*=flg;
}
template<typename T,typename... Args>
void read(T &x,Args &...args){read(x),read(args...);}

//=========================================================================================================
// Define the global variables here.

bool membg=0;

constexpr int N=1e3+7;
int n;
ll k,a[N];

ll f[47][N];
int g[47][N];

bool memed=0;

//=========================================================================================================
// Code here.


void solve(){
	auto shift=[&](int i){return 1ll<<i;};
	auto test=[&](ll x,int i){return (x>>i)&1;};
	read(n,k);
	for(int i=1;i<=n;i++)read(a[i]);
	g[0][0]=1;
	for(int i=0;i<40;i++){
		for(int j=0;j<=1000;j++){
			if(!f[i][j]&&!g[i][j])continue;
			auto upd=[&](int v){
				f[i+1][v/2]^=f[i][j],g[i+1][v/2]^=g[i][j];
				if(g[i][j]&&(v&1))f[i+1][v/2]^=shift(i);
			};
			if(test(k,i))
				for(int x=1;x<=n;x++)
					upd(j+a[x]);
			else
				upd(j);
		}
	}
	ll ans=0;
	for(int j=0;j<=1000;j++){
		ans^=f[40][j];
		if(g[40][j])ans^=shift(40)*j;
	}
	printf("%lld\n",ans);
	return;
}


//=========================================================================================================

int main(){
	Debug("%.3lfMB\n",fabs(&memed-&membg)/1024.0/1024.0);
	int timbg=clock();
	int T=1;
	while(T--)solve();
	int timed=clock();
	Debug("%.3lfs\n",1.0*(timed-timbg)/CLOCKS_PER_SEC);
	fflush(stdout);
	return 0;
}

提出情報

提出日時
問題 D - Xor Sum 5
ユーザ EXODUS
言語 C++ 17 (gcc 12.2)
得点 700
コード長 2262 Byte
結果 AC
実行時間 52 ms
メモリ 4340 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:18:28: warning: statement has no effect [-Wunused-value]
   18 |         #define Debug(...) 0
      |                            ^
Main.cpp:86:9: note: in expansion of macro ‘Debug’
   86 |         Debug("%.3lfMB\n",fabs(&memed-&membg)/1024.0/1024.0);
      |         ^~~~~
Main.cpp:18:28: warning: statement has no effect [-Wunused-value]
   18 |         #define Debug(...) 0
      |                            ^
Main.cpp:91:9: note: in expansion of macro ‘Debug’
   91 |         Debug("%.3lfs\n",1.0*(timed-timbg)/CLOCKS_PER_SEC);
      |         ^~~~~
Main.cpp:87:13: warning: unused variable ‘timbg’ [-Wunused-variable]
   87 |         int timbg=clock();
      |             ^~~~~
Main.cpp:90:13: warning: unused variable ‘timed’ [-Wunused-variable]
   90 |         int timed=clock();
      |             ^~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 700 / 700
結果
AC × 3
AC × 30
セット名 テストケース
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_rand_01.txt, 01_rand_02.txt, 01_rand_03.txt, 01_rand_04.txt, 01_rand_05.txt, 01_rand_06.txt, 01_rand_07.txt, 01_rand_08.txt, 01_rand_09.txt, 01_rand_10.txt, 01_rand_11.txt, 01_rand_12.txt, 01_rand_13.txt, 01_rand_14.txt, 01_rand_15.txt, 02_maxi_01.txt, 02_maxi_02.txt, 02_maxi_03.txt, 02_maxi_04.txt, 02_maxi_05.txt, 02_maxi_06.txt, 02_maxi_07.txt, 02_maxi_08.txt, 02_maxi_09.txt, 03_test_01.txt, 03_test_02.txt, 03_test_03.txt
ケース名 結果 実行時間 メモリ
00_sample_01.txt AC 1 ms 4172 KiB
00_sample_02.txt AC 1 ms 3628 KiB
00_sample_03.txt AC 1 ms 4136 KiB
01_rand_01.txt AC 14 ms 4172 KiB
01_rand_02.txt AC 11 ms 4288 KiB
01_rand_03.txt AC 15 ms 4292 KiB
01_rand_04.txt AC 7 ms 4152 KiB
01_rand_05.txt AC 8 ms 4208 KiB
01_rand_06.txt AC 6 ms 4140 KiB
01_rand_07.txt AC 6 ms 4092 KiB
01_rand_08.txt AC 9 ms 4304 KiB
01_rand_09.txt AC 7 ms 4196 KiB
01_rand_10.txt AC 11 ms 4316 KiB
01_rand_11.txt AC 17 ms 4180 KiB
01_rand_12.txt AC 20 ms 4272 KiB
01_rand_13.txt AC 15 ms 4200 KiB
01_rand_14.txt AC 11 ms 4280 KiB
01_rand_15.txt AC 7 ms 4212 KiB
02_maxi_01.txt AC 51 ms 4340 KiB
02_maxi_02.txt AC 52 ms 4208 KiB
02_maxi_03.txt AC 50 ms 4252 KiB
02_maxi_04.txt AC 6 ms 4108 KiB
02_maxi_05.txt AC 7 ms 4268 KiB
02_maxi_06.txt AC 52 ms 4180 KiB
02_maxi_07.txt AC 51 ms 4304 KiB
02_maxi_08.txt AC 7 ms 4116 KiB
02_maxi_09.txt AC 7 ms 4172 KiB
03_test_01.txt AC 1 ms 4236 KiB
03_test_02.txt AC 1 ms 3956 KiB
03_test_03.txt AC 1 ms 4032 KiB