結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー tailstails
提出日時 2016-10-14 23:26:26
言語 Perl
(5.40.0)
結果
WA  
実行時間 -
コード長 476 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 6,016 KB
実行使用メモリ 39,936 KB
最終ジャッジ日時 2024-11-22 06:06:47
合計ジャッジ時間 30,178 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 46
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::n" used only once: possible typo at Main.pl line 1.
Main.pl syntax OK

ソースコード

diff #

($n,$k)=glob<>;
for(<>){
	($s,$p,$u)=glob<>;
	push@{$a[$s]{$u}//=[]},$p*2e5+$i;
	++$i;
}
for(reverse@a){
	for$u(keys%$_){
		@{$_->{$u}}=sort{$b-$a}@{$_->{$u}};
	}
	
	while(1){
		$w=0;
		for$u(keys%$_){
			if($v{$u}){
				--$v{$u};
				$w=1 if @{$_->{$u}};
			}else{
				if(@{$_->{$u}}){
					push@b,pop@{$_->{$u}};
				}else{
					++$v{$u};
				}
			}
		}
		redo if !@b && $w;
		last if !@b;
		@b=sort{$b-$a}@b;
		while(@b){
			print pop(@b)%2e5,$/;
			exit if !--$k;
		}
	}
}
0