結果

問題 No.774 tatyamと素数大富豪
コンテスト
ユーザー 👑 tails
提出日時 2018-12-22 00:45:26
言語 Perl
(5.42.1)
コンパイル:
perl -cw _filename_
実行:
perl -X _filename_
結果
WA  
実行時間 -
コード長 306 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 117 ms
コンパイル使用メモリ 6,528 KB
実行使用メモリ 112,896 KB
最終ジャッジ日時 2026-04-12 14:15:44
合計ジャッジ時間 7,049 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 9 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #
raw source code

$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