結果
問題 | No.8 N言っちゃダメゲーム |
ユーザー |
![]() |
提出日時 | 2015-12-13 02:50:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 40 ms / 5,000 ms |
コード長 | 795 bytes |
コンパイル時間 | 852 ms |
コンパイル使用メモリ | 89,508 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-15 11:00:41 |
合計ジャッジ時間 | 1,798 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#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; }