結果
| 問題 |
No.2285 Make A Unit Square
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-29 11:31:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,170 bytes |
| コンパイル時間 | 2,470 ms |
| コンパイル使用メモリ | 215,720 KB |
| 最終ジャッジ日時 | 2025-02-12 15:57:06 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 3 |
ソースコード
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
return (ull)rng() % B;
}
inline double time() {
return static_cast<long double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}
int memo[120];
int grundy(int x) {
if (x >= 100) {
return grundy(x - x/34*34);
}
else {
if (memo[x] != -1) return memo[x];
set<int> mex;
for (int i = 2; i <= x - 2; ++i) {
mex.insert(grundy(i) ^ grundy(x-i));
}
int g = 0;
while (mex.find(g) != mex.end()) g++;
memo[x] = g;
return g;
}
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
for (int i = 0; i < 120; ++i) {
memo[i] = -1;
}
int q; cin >> q;
while (q--) {
int a,b; cin >> a >> b;
if (grundy(a) ^ grundy(b)) {
cout << "First" << "\n";
}
else {
cout << "Second" << "\n";
}
}
}