結果
問題 | No.8 N言っちゃダメゲーム |
ユーザー |
![]() |
提出日時 | 2024-10-01 22:46:26 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 834 bytes |
コンパイル時間 | 3,055 ms |
コンパイル使用メモリ | 247,480 KB |
実行使用メモリ | 13,860 KB |
最終ジャッジ日時 | 2024-10-01 22:46:36 |
合計ジャッジ時間 | 9,593 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 TLE * 1 -- * 7 |
ソースコード
#include <bits/stdc++.h>#define rep(i, n) for(long long i = 0; i < n; i++)#define ALL(v) (v).begin(), (v).end()using namespace std;using lint = long long;int dp[120010];int main() {int p;cin >> p;while (p--) {int n, k;cin >> n >> k;for (int i = 0; i < n; i++) {dp[i] = -1;}auto f = [&](auto f, int x) -> int {if (dp[x] != -1) {return dp[x];}int res = 0;for (int i = 1; i <= k; i++) {if (i + x >= n) {break;}if (f(f, i + x) == 0) {res = 1;}}dp[x] = res;return res;};cout << (f(f, 0) ? "Win" : "Lose") << endl;}}