結果

問題 No.2165 Let's Play Nim!
ユーザー 👑 deuteridayodeuteridayo
提出日時 2022-12-16 22:21:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,463 bytes
コンパイル時間 4,500 ms
コンパイル使用メモリ 268,620 KB
実行使用メモリ 40,876 KB
平均クエリ数 0.10
最終ジャッジ日時 2024-04-27 21:39:21
合計ジャッジ時間 8,174 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
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 #


#include "bits/stdc++.h"
#include "atcoder/all"
 
using namespace std;using namespace atcoder;
using lint=long long;using ll=lint;
lint mod=998244353;
lint inf64=1LL<<61;int inf32=1<<30;
//define endl "\n"
#define repp(i, m, n) for (int i = (int)m; i < (int)(n); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vec vector
#define al(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define str string
#define ins insert
lint gcd(lint a, lint b){if(a<b)return gcd(b,a);if(a%b==0)return b;return gcd(b, a%b);}
using S=lint;
S op(S l, S r){
	return max(l,r);
}
S e(){
	return 0;
};
int pt(int i,int j){
	return 1000*i+j;
}
void me(dsu &d, int ui,int uj, int vi,int vj){
	d.merge(pt(ui,uj),pt(vi,vj));
}
vec<vec<pair<int,int>>>p;
int h,w,k;
void f(vec<pair<int,int>>&tmp){
	p.pb(tmp);
	repp(i,tmp[tmp.size()-1].se+1,h){
		repp(j,i+1,h){
			tmp.pb(mp(i,j));
			f(tmp);
			tmp.pop_back();
		}
	}
}

int main(){
	lint n;
	cin>>n;
	lint a[n];
	lint x=0;
	rep(i,n){
		cin>>a[i];
		x^=a[i];
	}
	bool turn;
	if(x==0){
		turn=false;
		cout<<0<<endl;
	}else{
		turn=true;
		cout<<1<<endl;
	}
	while(true){
		if(!turn){
			turn=true;
			lint i,k,r;
			cin>>i>>k>>r;
			i--;
			a[i]-=k;
			x^=k;
			if(r==0)continue;
			else return 0;
		}else{
			turn=false;
			rep(i,n){
				if(a[i]>=x){
					cout<<i+1<<" "<<x<<endl;
				}
				a[i]-=x;
				x=0;
				int r;
				cin>>r;
				if(r==-1)return 0;
			}
		}
	}
}
0