Submission #8967


Source Code Expand

my $n = <STDIN>;
chomp $n;
my $command = <STDIN>;
chomp $command;

if (length($command) == 1) {
    print "1\n";
    exit;
}

my @as = (r2($command, 0, 0), r2($command, 1, 0), r2($command, 0, 1), r2($command, 1, 1));
print +(sort @as)[0], "\n";

sub r2($$$) {
    return length r(r($_[0],$_[1]),$_[2]);
}
sub r() {
    my $s = shift;
    my $i = shift;
    my %d;
    for (my $i = 0; $i < length($s) - 1; $i++) {
        my $sc = substr $s, $i, 2;
        $d{$sc}++;
    }
    my @ks = sort {$d{$b} <=> $d{$a}} grep {$_ !~ /_/} keys %d;
    if (@ks == 0) { return $s; }
    if (!$ks[$i]) { $i = 0 }
    $s =~ s/$ks[$i]/_/g;
    return $s;
}

Submission Info

Submission Time
Task C - コマンド入力
User whitebell
Language Perl (5.14.2)
Score 0
Code Size 671 Byte
Status WA
Exec Time 29 ms
Memory 1140 KB

Compile Error

main::r2() called too early to check prototype at ./Main.pl line 11.
main::r2() called too early to check prototype at ./Main.pl line 11.
main::r2() called too early to check prototype at ./Main.pl line 11.
main::r2() called too early to check prototype at ./Main.pl line 11.
./Main.pl syntax OK

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 40
WA × 5
Set Name Test Cases
All 00_retmax.txt, 00_retmin.txt, 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 02_twothree_00.txt, 02_twothree_01.txt, 02_twothree_02.txt, 02_twothree_03.txt, 02_twothree_04.txt, 02_twothree_05.txt, 02_twothree_06.txt, 02_twothree_07.txt, 02_twothree_08.txt, 02_twothree_09.txt, 02_twothree_10.txt, 02_twothree_11.txt, 02_twothree_12.txt, 02_twothree_13.txt, 02_twothree_14.txt, 02_twothree_15.txt, 02_twothree_16.txt, 02_twothree_17.txt, 02_twothree_18.txt, 02_twothree_19.txt
Case Name Status Exec Time Memory
00_retmax.txt AC 27 ms 1036 KB
00_retmin.txt AC 22 ms 1032 KB
00_sample_00.txt AC 23 ms 1008 KB
00_sample_01.txt AC 24 ms 1040 KB
00_sample_02.txt AC 24 ms 920 KB
01_rnd_00.txt AC 28 ms 1020 KB
01_rnd_01.txt AC 28 ms 912 KB
01_rnd_02.txt AC 28 ms 1020 KB
01_rnd_03.txt WA 27 ms 1032 KB
01_rnd_04.txt AC 28 ms 1024 KB
01_rnd_05.txt AC 28 ms 1012 KB
01_rnd_06.txt AC 28 ms 1036 KB
01_rnd_07.txt AC 27 ms 1036 KB
01_rnd_08.txt AC 28 ms 1020 KB
01_rnd_09.txt WA 28 ms 996 KB
01_rnd_10.txt WA 26 ms 1044 KB
01_rnd_11.txt AC 28 ms 1020 KB
01_rnd_12.txt AC 27 ms 1032 KB
01_rnd_13.txt AC 28 ms 916 KB
01_rnd_14.txt AC 28 ms 1072 KB
01_rnd_15.txt AC 27 ms 916 KB
01_rnd_16.txt WA 28 ms 1016 KB
01_rnd_17.txt WA 28 ms 1016 KB
01_rnd_18.txt AC 29 ms 1020 KB
01_rnd_19.txt AC 27 ms 1036 KB
02_twothree_00.txt AC 28 ms 908 KB
02_twothree_01.txt AC 28 ms 1072 KB
02_twothree_02.txt AC 28 ms 1036 KB
02_twothree_03.txt AC 27 ms 1016 KB
02_twothree_04.txt AC 28 ms 1020 KB
02_twothree_05.txt AC 28 ms 920 KB
02_twothree_06.txt AC 28 ms 1016 KB
02_twothree_07.txt AC 28 ms 1036 KB
02_twothree_08.txt AC 28 ms 1020 KB
02_twothree_09.txt AC 27 ms 1016 KB
02_twothree_10.txt AC 26 ms 1140 KB
02_twothree_11.txt AC 27 ms 1012 KB
02_twothree_12.txt AC 28 ms 1016 KB
02_twothree_13.txt AC 28 ms 916 KB
02_twothree_14.txt AC 28 ms 1036 KB
02_twothree_15.txt AC 27 ms 944 KB
02_twothree_16.txt AC 27 ms 920 KB
02_twothree_17.txt AC 28 ms 896 KB
02_twothree_18.txt AC 28 ms 1020 KB
02_twothree_19.txt AC 28 ms 1020 KB