結果

問題 No.8 N言っちゃダメゲーム
ユーザー mannshi222mannshi222
提出日時 2022-04-24 13:54:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 899 bytes
コンパイル時間 727 ms
コンパイル使用メモリ 74,836 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-08 07:02:22
合計ジャッジ時間 1,844 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <stdbool.h>
#include <vector>

using namespace std;
#define MAX 120000*2

vector<bool> wl(MAX, true);


void makewl(int n, int k )
{

	for( int i = 2; i <= n; i++ ) {
		if( i <= k+1 ) {
			wl[i] = true;
			continue;
		}
		bool f = false;
		for( int j = 1; j <= k; j++ ) {
			if( wl[ i - j ] == false ) {
				f = true;
				break;
			}
		}
		if( f ) {
			wl[i] = true;
		}
		else {
			wl[i] = false;
		}
	}
}

void makewl2(int n, int k )
{

	int i = 2;
	while( i <= n ) {
		if( i <= k+1 ) {
			wl[i++] = true;
			continue;
		}
		wl[i] = false;
		for( int j = 1; j <= k; j++ ) {
			wl[i+j] = true;
		}
		i+=k+1;
	}
}

bool check( int N,int K ) 
{
	return true;
}
int main()
{
	int P, N, K;
	cin >> P;

	for( int i = 0; i < P; i++ ) {
		cin >> N >> K;
		makewl2( N, K );
		if( wl[N]) {
			cout << "Win" << endl;
		}
		else {
			cout << "Lose" << endl;
		}
	}
		
	return 0;
}
0