結果

問題 No.474 色塗り2
ユーザー 👑 kmjpkmjp
提出日時 2016-12-24 00:27:32
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,157 bytes
コンパイル時間 1,307 ms
コンパイル使用メモリ 159,316 KB
実行使用メモリ 20,480 KB
最終ジャッジ日時 2024-05-08 12:57:54
合計ジャッジ時間 2,048 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
19,328 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 37 ms
19,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------



int T;
ll num2[2020202];
int A[101010],B[101010],C[101010];

int combi(int N_, int C_) {
	return num2[N_]==num2[C_]+num2[N_-C_];
}
int hcomb(int P_,int Q_) { return (P_==0&&Q_==0)?1:combi(P_+Q_-1,Q_);}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	FOR(i,2020000) {
		j=i;
		while(j) num2[i]+=j/2, j/=2;
	}
	
	cin>>T;
	FOR(i,T) {
		cin>>A[i]>>B[i]>>C[i];
		if(C[i]%2==0) {
			_P("0\n");
			continue;
		}
		
		if(hcomb(C[i],B[i])==0) {
			_P("0\n");
			continue;
		}
		_P("%d\n",hcomb(C[i],A[i]));
		
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}
0