結果
問題 | No.726 Tree Game |
ユーザー |
![]() |
提出日時 | 2021-02-12 15:26:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,293 bytes |
コンパイル時間 | 5,254 ms |
コンパイル使用メモリ | 198,932 KB |
最終ジャッジ日時 | 2025-01-18 17:49:44 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 WA * 2 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define FOR(i,a,b) for(int i=(a);i<(b);++i)#define REP(i,n) FOR(i,0,n)#define ALL(v) begin(v),end(v)template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }using ll = long long;using pii = pair<int, int>;constexpr ll INF = 1ll<<30;constexpr ll longINF = 1ll<<60;constexpr ll MOD = 1000000007;constexpr bool debug = false;//---------------------------------//int main() {int Y, X;cin >> Y >> X;auto is_prime = [](int i) {if (i <= 1) return false;for (int j = 2; j * j <= i; ++j) if (i % j == 0) return false;return true;};auto nex_prime = [&](int i) {++i;while (!is_prime(i)) ++i;return i;};const int ey = nex_prime(Y), ex = nex_prime(X);map<pii, bool> dp;auto dfs = [&](auto self, int y, int x) -> bool {const pii cur = {y, x};if (y == ey || x == ex) return false;if (dp.count(cur)) return dp[cur];if (self(self, y + 1, x) || self(self, y, x + 1)) return dp[cur] = false;return dp[cur] = true;};if (dfs(dfs, Y + 1, X) || dfs(dfs, Y, X + 1)) puts("First");else puts("Second");}