結果

問題 No.774 tatyamと素数大富豪
ユーザー tails
提出日時 2018-12-22 00:45:26
言語 Perl
(5.40.0)
結果
TLE  
実行時間 -
コード長 306 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 112,692 KB
最終ジャッジ日時 2024-09-25 09:48:56
合計ジャッジ時間 9,994 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 8 WA * 5 TLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Unquoted string "t" may clash with future reserved word at Main.pl line 2.
Unquoted string "t" may clash with future reserved word at Main.pl line 8.
Unquoted string "p" may clash with future reserved word at Main.pl line 21.
Name "main::h" used only once: possible typo at Main.pl line 6.
Main.pl syntax OK

ソースコード

diff #

$n=<>;@a=glob<>;
open(t,">/tmp/t");

sub f{
	my($x,$u)=@_;
	if(!$h{$x}++){
		if(!$u){
			print t $x,$/;
		}else{
			for$i(0..$n-1){
				if($u&1<<$i){
					my$y=$a[$i];
					f($x.$y,$u^1<<$i);
				}
			}
		}
	}
}
f('',(1<<$n)-1);

open(p,"sort -nr /tmp/t|factor|");
($r)=(grep(!/\d /,<p>),-1);
print $r+0;

0