結果

問題 No.2165 Let's Play Nim!
ユーザー tailstails
提出日時 2022-12-16 02:06:43
言語 cLay
(20240104-1)
結果
TLE  
実行時間 -
コード長 792 bytes
コンパイル時間 3,006 ms
コンパイル使用メモリ 174,220 KB
実行使用メモリ 40,112 KB
平均クエリ数 0.08
最終ジャッジ日時 2024-04-27 05:20:50
合計ジャッジ時間 7,037 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
25,196 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
evil_2_big_1.txt -- -
evil_2_big_2.txt -- -
evil_2_big_3.txt -- -
evil_big_1.txt -- -
evil_big_2.txt -- -
evil_big_3.txt -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

//interactive
struct S{
	unsigned a;
	int j[18];
};

S s[80000];
int dv[18][80000];
int dn[18];

void add(ll i){
	rep(z,1,18){
		if(s[i].a&1<<z-1){
			dv[z][dn[z]]=i;
			s[i].j[z]=dn[z];
			dn[z]+=1;
		}
	}
}

void del(ll i){
	rep(z,1,18){
		if(s[i].a&1<<z-1){
			dn[z]-=1;
			dv[z][s[i].j[z]]=dv[z][dn[z]];
		}
	}
}

{
	ll@n;
	unsigned x=0;
	rep(i,n){
		unsigned@a;
		x^=a;
		s[i].a=a;
		add(i);
	}
	if(x==0){
		wt(0);
		goto opp_turn;
	}
	wt(1);

	my_turn:;
	{
		ll z=32-__builtin_clz(x);
		ll i=dv[z][dn[z]-1];
		del(i);
		unsigned b=x^s[i].a;
		wt(i+1,s[i].a-b)
		s[i].a=b;
		add(i);
	}
	{
		ll@a;
		if(a<0){
			exit(0);
		}
	}

	opp_turn:;
	{
		ll@--i;
		unsigned@k;
		del(i);
		x=s[i].a;
		s[i].a-=k;
		x^=s[i].a;
		add(i);
	}
	{
		ll@a;
		if(a<0){
			exit(0);
		}
	}

	goto my_turn;
}
0