結果

問題 No.2285 Make A Unit Square
ユーザー jianglyjiangly
提出日時 2023-04-28 21:44:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 766 bytes
コンパイル時間 2,268 ms
コンパイル使用メモリ 205,288 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 23:23:40
合計ジャッジ時間 3,156 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using i64 = long long;

int sg[200];

void solve() {
    int a, b;
    std::cin >> a >> b;
    
    if (a > 100) {
        a -= (a - 100) / 34 * 34;
    }
    if (b > 100) {
        b -= (b - 100) / 34 * 34;
    }
    
    if (sg[a] ^ sg[b]) {
        std::cout << "First\n";
    } else {
        std::cout << "Second\n";
    }
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    for (int i = 2; i < 200; i++) {
        std::set<int> s;
        for (int j = 2; j + 2 <= i; j++) {
            s.insert(sg[j] ^ sg[i - j]);
        }
        while (s.count(sg[i])) {
            sg[i]++;
        }
    }
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}
0