結果

問題 No.361 門松ゲーム2
ユーザー HaarHaar
提出日時 2016-04-18 00:31:08
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 875 bytes
コンパイル時間 760 ms
コンパイル使用メモリ 61,540 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 03:02:13
合計ジャッジ時間 1,446 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 WA -
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 WA -
testcase_14 AC 11 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 4 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 8 ms
6,940 KB
testcase_22 AC 18 ms
6,940 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 5 ms
6,944 KB
testcase_26 WA -
testcase_27 AC 6 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main() {
	int l, d;
	vector< int > memo(500,-1);
	vector< int > table(500,0);
	
	cin >> l >> d;
	
	for(int i=0;i<5;++i){
		memo[i] = 0;
	}
	
	for(int i=5;i<l;++i){
		
		for(int j=0;j<500;++j)table[j] = 0;
		
		for(int x=1;x<=(i+1)/2;++x){
			for(int y=x+1;y<=(i+1-x)/2;++y){
				int z = i + 1 - x - y;
				if(z - x <= d && x!=y && y!=z && x!=z){
					if(x<=5 && y<=5 && z<=5)table[0] = 1;
					else if(x<=5 && y<=5)table[memo[z-1]] = 1;
					else if(x<=5){
						table[memo[y-1]] = 1;
						table[memo[z-1]] = 1;
					}else{
						table[memo[x-1]] = 1;
						table[memo[y-1]] = 1;
						table[memo[z-1]] = 1;
					}
				}
			}
		}
		for(int j=0;j<500;++j){
			if(table[j]!=1){
				memo[i] = j;
				break;
			}
		}
	}
	if(memo[l-1]){
		cout << "kado" << endl;
	}else{
		cout << "matsu" << endl;
	}
	
	return 0;
}
0