結果

問題 No.873 バイナリ、ヤバいなり!w
ユーザー tailstails
提出日時 2019-09-02 19:03:55
言語 Perl
(5.38.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 569 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 5,332 KB
実行使用メモリ 18,768 KB
最終ジャッジ日時 2023-09-06 12:00:45
合計ジャッジ時間 2,593 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 26 ms
9,724 KB
testcase_02 AC 144 ms
18,248 KB
testcase_03 AC 62 ms
16,552 KB
testcase_04 AC 2 ms
4,608 KB
testcase_05 AC 2 ms
4,464 KB
testcase_06 AC 3 ms
4,604 KB
testcase_07 AC 3 ms
4,604 KB
testcase_08 AC 20 ms
9,160 KB
testcase_09 AC 2 ms
4,524 KB
testcase_10 AC 2 ms
4,524 KB
testcase_11 AC 3 ms
4,684 KB
testcase_12 AC 17 ms
6,428 KB
testcase_13 AC 3 ms
4,568 KB
testcase_14 AC 3 ms
4,604 KB
testcase_15 AC 3 ms
4,576 KB
testcase_16 AC 3 ms
4,568 KB
testcase_17 AC 3 ms
4,576 KB
testcase_18 AC 3 ms
4,456 KB
testcase_19 AC 3 ms
4,640 KB
testcase_20 AC 2 ms
4,464 KB
testcase_21 AC 2 ms
4,580 KB
testcase_22 AC 3 ms
4,632 KB
testcase_23 AC 3 ms
4,596 KB
testcase_24 AC 3 ms
4,588 KB
testcase_25 AC 2 ms
4,580 KB
testcase_26 AC 3 ms
4,528 KB
testcase_27 AC 3 ms
4,480 KB
testcase_28 AC 3 ms
4,572 KB
testcase_29 AC 2 ms
4,684 KB
testcase_30 AC 3 ms
4,616 KB
testcase_31 AC 3 ms
4,616 KB
testcase_32 AC 5 ms
5,732 KB
testcase_33 AC 4 ms
4,824 KB
testcase_34 AC 28 ms
7,952 KB
testcase_35 AC 124 ms
18,732 KB
testcase_36 AC 66 ms
13,456 KB
testcase_37 AC 119 ms
18,768 KB
testcase_38 AC 117 ms
18,572 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::y" used only once: possible typo at Main.pl line 25.
Main.pl syntax OK

ソースコード

diff #

# almost beta-ishoku of
# https://yukicoder.me/submissions/374293 by nadare

$N=<>;
@DP = (999)x($N+1);
$DP[0] = 0;

$r=int sqrt$N;
for$i(0..$N-$r*$r){
	for$j(1..sqrt$N-$i){
		$f=$j*$j;
		$DP[$i+$f]=$DP[$i]+$j if $DP[$i+$f]>$DP[$i]+$j;
	}
}
for(0,1){
	$DP[$N]=$DP[$N-$r*$r]+$r if $DP[$N]>$DP[$N-$r*$r]+$r;
	--$r;
}

$x = $N;
$j=1;
while($x){
	$f=$j*$j;
	if($DP[$x] == $DP[$x-$f] + $j){
		$y=$j;
		if($j%2){
			print"01"x($j/2),0;
		}else{
			push@E,$j;
		}
		$x -= $f;
	}else{
		++$j;
	}
}

while($e=pop@E){
	print"01"x($e/2);
	if($e=shift@E){
		print"10"x($e/2);
	}
}
0