結果

問題 No.8 N言っちゃダメゲーム
ユーザー togari_takamototogari_takamoto
提出日時 2015-12-13 02:50:57
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 795 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 88,616 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-13 14:13:13
合計ジャッジ時間 1,372 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <iomanip>
#include <numeric>
#include <memory>
#include <limits.h>
#include <set>
#include <cassert>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0; i<(n); ++i)
#define TEN(x) ((ll)1e##x)
#define ALL(v) (v).begin(), (v).end()

int main() {
	ll p;
	cin >> p;
	REP(i, p) {
		ll n, k;
		cin >> n >> k;

		vector<bool> win(n + 1);
		win[n] = true;
		win[n - 1] = false;
		ll count_false = 1;
		for (ll j = n - 2; j >= 0; --j) {
			win[j] = count_false != 0;
			if (!win[j]) count_false++;
			if (j + k <= n && !win[j + k]) count_false--;
		}

		cout << (win[0] ? "Win" : "Lose") << endl;
	}
	return 0;
}
0