結果

問題 No.1635 Let’s Sort Integers!!
ユーザー publflpublfl
提出日時 2021-07-30 22:37:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 31,504 KB
実行使用メモリ 7,012 KB
最終ジャッジ日時 2023-10-14 06:14:05
合計ジャッジ時間 17,092 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,352 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 AC 1 ms
4,348 KB
testcase_31 AC 1 ms
4,352 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 1 ms
4,348 KB
testcase_34 AC 1 ms
4,348 KB
testcase_35 AC 1 ms
4,348 KB
testcase_36 AC 1 ms
4,352 KB
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 2 ms
4,348 KB
testcase_39 AC 1 ms
4,348 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 1 ms
4,348 KB
testcase_48 AC 1 ms
4,352 KB
testcase_49 AC 1 ms
4,348 KB
testcase_50 AC 1 ms
4,348 KB
testcase_51 AC 1 ms
4,348 KB
testcase_52 AC 2 ms
4,348 KB
testcase_53 AC 1 ms
4,352 KB
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 AC 1 ms
4,348 KB
testcase_60 AC 89 ms
6,892 KB
testcase_61 AC 90 ms
6,912 KB
testcase_62 AC 88 ms
6,884 KB
testcase_63 AC 89 ms
6,820 KB
testcase_64 AC 91 ms
6,900 KB
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 AC 5 ms
6,888 KB
testcase_69 AC 2 ms
4,352 KB
testcase_70 AC 89 ms
6,932 KB
testcase_71 AC 89 ms
6,840 KB
testcase_72 AC 89 ms
6,904 KB
testcase_73 AC 89 ms
6,916 KB
testcase_74 AC 90 ms
6,916 KB
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 AC 6 ms
6,820 KB
testcase_79 AC 2 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int a;
long long int b;
int ans[1000010];
void func(int k, int type, int L, int R)
{
	if(k>a) return;
	if(type==1)
	{
		if(R-L+1 + R-L <= b)
		{
			b -= (R-L+1);
			ans[k] = R;
			func(k+1,2,L,R-1);
		}
		else
		{
			b--;
			ans[k] = L;
			func(k+1,1,L+1,R);
		}
	}
	else
	{
		if(R-L+1 + R-L <= b)
		{
			b -= (R-L+1);
			ans[k] = L;
			func(k+1,1,L+1,R);
		}
		else
		{
			b--;
			ans[k] = R;
			func(k+1,2,L,R-1);
		}
	}
}

int main()
{
	scanf("%d%lld",&a,&b);
	if(b<a-1)
	{
		printf("-1");
		return 0;
	}
	ans[1] = 1;
	func(2,1,2,a);
	if(b>0) printf("-1");
	else for(int i=1;i<=a;i++) printf("%d ",ans[i]);
}
0