結果

問題 No.548 国士無双
ユーザー motimoti
提出日時 2018-05-20 17:27:36
言語 Perl
(5.38.2)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 6,016 KB
実行使用メモリ 5,948 KB
最終ジャッジ日時 2023-10-17 17:27:04
合計ジャッジ時間 1,519 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,948 KB
testcase_01 AC 6 ms
5,948 KB
testcase_02 AC 6 ms
5,948 KB
testcase_03 AC 6 ms
5,948 KB
testcase_04 AC 6 ms
5,944 KB
testcase_05 AC 6 ms
5,948 KB
testcase_06 AC 6 ms
5,948 KB
testcase_07 AC 7 ms
5,948 KB
testcase_08 AC 6 ms
5,948 KB
testcase_09 AC 6 ms
5,948 KB
testcase_10 AC 6 ms
5,948 KB
testcase_11 AC 7 ms
5,948 KB
testcase_12 AC 6 ms
5,948 KB
testcase_13 AC 6 ms
5,944 KB
testcase_14 AC 6 ms
5,948 KB
testcase_15 AC 6 ms
5,948 KB
testcase_16 AC 6 ms
5,948 KB
testcase_17 AC 6 ms
5,948 KB
testcase_18 AC 7 ms
5,948 KB
testcase_19 AC 7 ms
5,948 KB
testcase_20 AC 6 ms
5,948 KB
testcase_21 AC 6 ms
5,944 KB
testcase_22 AC 7 ms
5,944 KB
testcase_23 AC 6 ms
5,948 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/env perl

use strict;
use warnings;

my $target = "abcdefghijklm";
my %h;
my $count2 = 0;
my $twoer;
my $s = <>; chomp$s;
for my $c (split//, $s) {
  $h{$c}++;
  if ($h{$c} >= 2) {
    if ($count2 == 1) {
      print "Impossible\n";
      exit;
    }
    $count2 = 1;
    $twoer = $c;
  }
  if ($target !~ /$c/) {
    print "Impossible\n";
    exit;
  }
}

if ($twoer) {
  for my $tch (split//, $target) {
    if (!exists$h{$tch}) {
      print "$tch\n";
      exit;
    }
  }
}
print join("\n", split//,$target)
0