結果

問題 No.8 N言っちゃダメゲーム
ユーザー n_knuun_knuu
提出日時 2015-09-25 01:49:41
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 803 bytes
コンパイル時間 1,355 ms
コンパイル使用メモリ 144,236 KB
実行使用メモリ 8,084 KB
最終ジャッジ日時 2023-09-26 14:57:53
合計ジャッジ時間 7,751 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int dp[120010];
int N, K;

int dpdp(int n) {
  if (n >= N) return 1;
  if (dp[n] != -1) return dp[n];

  int ret = 0;
  for (int i = K; i >= 1; i--) {
    if (!dpdp(n+i)) ret = 1;
  }
  return dp[n] = ret;
}

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int P;
  cin >> P;
  REP(i, P) {
    cin >> N >> K;
    memset(dp, -1, sizeof(dp));
    cout << (dpdp(0) ? "Win" : "Lose") << endl;
  }  
  return 0;
}
0