結果

問題 No.2285 Make A Unit Square
ユーザー 👑 emthrmemthrm
提出日時 2023-04-28 21:44:02
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,667 bytes
コンパイル時間 2,884 ms
コンパイル使用メモリ 246,756 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-28 23:23:28
合計ジャッジ時間 3,503 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constexpr int MOD = 998244353;
// constexpr int MOD = 1000000007;
constexpr int DY4[]{1, 0, -1, 0}, DX4[]{0, -1, 0, 1};
constexpr int DY8[]{1, 1, 0, -1, -1, -1, 0, 1};
constexpr int DX8[]{0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U>
inline bool chmax(T& a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U>
inline bool chmin(T& a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  // https://oeis.org/A002187
  const vector<int> grundy{8, 1, 1, 2, 0, 3, 1, 1, 0, 3, 3, 2, 2, 4, 4, 5, 5, 9, 3, 3, 0, 1, 1, 3, 0, 2, 1, 1, 0, 4, 5, 3, 7, 4};
  const auto f = [&](const int n) -> int {
    if (n == 0 || n == 14 || n == 34) return 0;
    if (n == 16 || n == 17 || n == 31 || n == 51) return 2;
    return grundy[n % grundy.size()];
  };

  int t; cin >> t;
  while (t--) {
    int a, b; cin >> a >> b;
    cout << ((f(a - 2) ^ f(b - 2)) == 0 ? "Second\n" : "Frist\n");
  }
  return 0;

  // vector<int> grundy(n, 0);
  // FOR(l, 1, n) {
  //   set<int> s{grundy[max(l - 2, 0)]};
  //   FOR(i, 1, l - 1) s.emplace(grundy[i - 1] ^ grundy[l - i - 2]);
  //   while (s.contains(grundy[l])) ++grundy[l];
  // }
  // REP(l, n) cout << grundy[l] << " \n"[l + 1 == n];
}
0