結果
| 問題 |
No.8 N言っちゃダメゲーム
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2015-01-08 01:56:42 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 917 bytes |
| コンパイル時間 | 933 ms |
| コンパイル使用メモリ | 73,828 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-13 02:58:43 |
| 合計ジャッジ時間 | 1,222 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <cmath>
#include "assert.h"
#include <ctime>
#include <stdexcept>
using namespace std;
int N,K;
vector<int> memo;
int grundy(int x){
if(memo.at(x)>=0){
return memo.at(x);
}
//cerr << "grundy " << x << endl;
int ret = 0;
for(int i=1; i<=K; i++){
if(x+i >= N) break;
if(grundy(x+i) == 0){
ret = 1;
break;
}
}
memo.at(x) = ret;
return ret;
}
void solve(){
cin >> N >> K;
/*
memo = vector<int>(120000+1, -1);
int ans = grundy(0);
for(int i=0; i<=N; i++){
cerr << i << " " << memo[i] << endl;
}
cout << (ans!=0? "Win":"Lose") << endl;
*/
bool ans = (N-1)%(K+1) == 0 ? false : true;
cout << (ans? "Win":"Lose") << endl;
}
int main(){
int T;
cin >> T;
for(int i=0; i<T; i++){
solve();
}
return 0;
}
koyumeishi