結果

問題 No.2285 Make A Unit Square
ユーザー shobonvipshobonvip
提出日時 2023-04-28 22:13:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 686 bytes
コンパイル時間 4,411 ms
コンパイル使用メモリ 266,688 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 23:44:55
合計ジャッジ時間 5,559 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 191 ms
5,376 KB
testcase_03 AC 215 ms
5,376 KB
testcase_04 AC 160 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;

typedef modint998244353 mint;
typedef long long ll;

void solve(vector<int> &dp){
	int a, b; cin >> a >> b;
	
	int x = 0;
	if (a <= 100) x ^= dp[a];
	else x ^= dp[a % 34 + 68];
	if (b <= 100) x ^= dp[b];
	else x ^= dp[b % 34 + 68];

	if (x > 0) cout << "First\n";
	else cout << "Second\n";
}

int main(){
	int mx = 150;
	vector<int> dp(mx+1);
	for (int i=4; i<mx+1; i++){
		set<int> r;
		for (int j=2; j<=i-2; j++){
			r.insert(dp[j] ^ dp[i-j]);
		}
		int piv = 0;
		while(r.find(piv) != r.end()) piv++;
		dp[i] = piv;
		//cout << dp[i] << endl;
	}

	int t; cin >> t;
	while(t--) solve(dp);
}
0