結果

問題 No.1770 N言っちゃダメゲーム (6)
ユーザー SuiseisekiSuiseiseki
提出日時 2021-12-03 16:24:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 913 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 32,040 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-19 08:17:24
合計ジャッジ時間 12,837 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,772 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 RE -
testcase_18 AC 1 ms
4,384 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,384 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
const int Maxn=500;
int n,k;
int f[Maxn+5][Maxn+5];
bool vis[Maxn+5];
int main(){
	scanf("%d%d",&n,&k);
	/*if(k&1){
		if(k%4==1){
			if((n-1)%(k+2)==0){
				puts("0");
			}
			else{
				printf("%d\n",n-((n-1)/(k+2)*(k+2)+1));
			}
		}
		else{
			if((n-1)%(k+1)==0){
				puts("0");
			}
			else{
				printf("%d\n",n-((n-1)/(k+1)*(k+1)+1));
			}
		}
	}
	else{
		if((n-1)%(k+1)==0){
			puts("0");
		}
		else{
			// int val_1=n-
		}
	}*/
	for(int i=0;i<=k;i++){
		f[0][i]=1;
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<=k;j++){
			for(int t=1;t<=i&&t<=k;t++){
				if(t==j){
					continue;
				}
				vis[f[i-t][t]]=1;
			}
			while(vis[f[i][j]]){
				f[i][j]++;
			}
			for(int t=1;t<=i&&t<=k;t++){
				if(t==j){
					continue;
				}
				vis[f[i-t][t]]=0;
			}
		}
	}
	if(f[n][0]==0){
		puts("0");
	}
	else{
		for(int i=1;i<=k;i++){
			if(f[n-i][i]==0){
				printf("%d\n",i);
			}
		}
	}
	return 0;
}
0