結果
| 問題 |
No.2285 Make A Unit Square
|
| コンテスト | |
| ユーザー |
emthrm
|
| 提出日時 | 2023-04-28 21:44:36 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,667 bytes |
| コンパイル時間 | 3,087 ms |
| コンパイル使用メモリ | 245,796 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 20:43:55 |
| 合計ジャッジ時間 | 3,155 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 4 |
ソースコード
#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" : "First\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];
}
emthrm