結果

問題 No.2285 Make A Unit Square
ユーザー みここみここ
提出日時 2023-02-13 06:49:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 764 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 68,324 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-23 09:24:28
合計ジャッジ時間 1,680 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;

const int NAZO = 34;

bool b[2005];
int g[2005];

int grundy(int d)
{
    if (b[d])
    {
        return g[d];
    }
    b[d] = true;
    bool x[2005]{0};
    for (int i = 2; i < d - 1; i++)
    {
        x[grundy(i) ^ grundy(d - i)] = true;
    }
    for (int i = 0; i <= d; i++)
    {
        if (!x[i])
        {
            return g[d] = i;
        }
    }
    return -1;
}

void solve()
{
    int t;
    cin >> t;
    while(t--)
    {
        int a, b;
        cin >> a >> b;
        if(grundy((a - 500) % NAZO + 500) ^ grundy((b - 500) % NAZO + 500))
        {
            cout << "First" << endl;
        }
        else
        {
            cout << "Second" << endl;
        }
    }
}

int main()
{
    solve();
}
0