Submission #757355
Source Code Expand
use strict; use warnings; sub floor5 { my $n = shift; return int($n/5)*5; } sub ceil5 { my $n = shift; return int(($n+4)/5)*5; } sub to_time { my $t = shift; $t = sprintf "%04d", $t; $t = sprintf "%02d00", $1+1 if $t =~ /(\d{2})60/; return $t; } sub to_range { my ($start, $end) = @_; return +{ start => to_time(floor5($start)), end => to_time(ceil5($end)), } } my $ranges = []; my $n_data = <STDIN>; for my $record (sort <STDIN>) { my ($start, $end) = map(int, split /-/, $record); push @$ranges, to_range($start, $end); } my $merged_ranges = []; for my $range (@$ranges) { if (@$merged_ranges < 1) { push @$merged_ranges, $range; next; } if ($range->{start} > $merged_ranges->[$#$merged_ranges]{end}) { push @$merged_ranges, $range; next; } if ($range->{end} > $merged_ranges->[$#$merged_ranges]{end}) { $merged_ranges->[$#$merged_ranges]{end} = $range->{end}; next; } } for my $range (@$merged_ranges) { print "$range->{start}-$range->{end}\n"; }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | kusabashira |
Language | Perl (5.14.2) |
Score | 100 |
Code Size | 1161 Byte |
Status | AC |
Exec Time | 531 ms |
Memory | 15420 KB |
Compile Error
./Main.pl syntax OK
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
all | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, cho_cho_chokudai.txt, chokudai_ga_cho.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 38 ms | 1700 KB |
00_sample_02.txt | AC | 36 ms | 1692 KB |
00_sample_03.txt | AC | 40 ms | 1768 KB |
cho_cho_chokudai.txt | AC | 531 ms | 15372 KB |
chokudai_ga_cho.txt | AC | 435 ms | 15328 KB |
test_01.txt | AC | 48 ms | 1696 KB |
test_02.txt | AC | 38 ms | 1828 KB |
test_03.txt | AC | 43 ms | 1760 KB |
test_04.txt | AC | 41 ms | 1764 KB |
test_05.txt | AC | 46 ms | 1748 KB |
test_06.txt | AC | 41 ms | 1824 KB |
test_07.txt | AC | 41 ms | 1700 KB |
test_08.txt | AC | 40 ms | 1768 KB |
test_09.txt | AC | 46 ms | 1884 KB |
test_10.txt | AC | 45 ms | 1892 KB |
test_11.txt | AC | 45 ms | 1948 KB |
test_12.txt | AC | 47 ms | 1888 KB |
test_13.txt | AC | 41 ms | 1760 KB |
test_14.txt | AC | 46 ms | 1956 KB |
test_15.txt | AC | 47 ms | 1892 KB |
test_16.txt | AC | 40 ms | 1828 KB |
test_17.txt | AC | 43 ms | 1964 KB |
test_18.txt | AC | 40 ms | 1768 KB |
test_19.txt | AC | 43 ms | 1952 KB |
test_20.txt | AC | 45 ms | 1892 KB |
test_21.txt | AC | 452 ms | 15416 KB |
test_22.txt | AC | 441 ms | 15356 KB |
test_23.txt | AC | 448 ms | 15348 KB |
test_24.txt | AC | 440 ms | 15352 KB |
test_25.txt | AC | 445 ms | 15356 KB |
test_26.txt | AC | 442 ms | 15348 KB |
test_27.txt | AC | 415 ms | 15352 KB |
test_28.txt | AC | 445 ms | 15420 KB |
test_29.txt | AC | 38 ms | 1700 KB |
test_30.txt | AC | 37 ms | 1700 KB |
test_31.txt | AC | 95 ms | 3728 KB |
test_32.txt | AC | 36 ms | 1640 KB |
test_33.txt | AC | 296 ms | 10764 KB |
test_34.txt | AC | 38 ms | 1700 KB |
test_35.txt | AC | 41 ms | 1820 KB |
test_36.txt | AC | 437 ms | 15408 KB |
test_37.txt | AC | 436 ms | 15360 KB |
test_38.txt | AC | 434 ms | 15352 KB |
test_39.txt | AC | 444 ms | 15340 KB |
test_40.txt | AC | 449 ms | 15420 KB |
test_41.txt | AC | 416 ms | 15328 KB |
test_42.txt | AC | 433 ms | 15348 KB |
test_43.txt | AC | 406 ms | 15408 KB |