-sub generate{
- my ($path, $lang) = @_;
- $path =~ s,/st\.html$,,;
- my $template = $templates{$lang};
- my $htc = HTML::Template::Compiled->new(scalarref => \$template);
- IO::File->new(">$path/meta.yml")->close unless -f "$path/meta.yml";
- flock my $metafh = IO::File->new("<$path/meta.yml"), LOCK_SH;
- my $meta = LoadFile "$path/meta.yml";
- my @problems = sort grep { /^\w+$/ } map { s,.*/,,r } <$path/../pb/*>;
- my %scores;
- for (1 .. $meta->{last}) {
- my $meta = LoadFile "$path/$_/meta.yml";
- if ($meta->{result_text} =~ m/^(\d+)/) {
- $scores{$meta->{user}}{$meta->{problem}} = $1;
- } else {
- $scores{$meta->{user}}{$meta->{problem}} = $meta->{result} ? 0 : 100;
+ local $Gruntmaster::Data::contest;
+ if ($ct) {
+ $start = contest_start ($ct);
+ $totaltime = contest_end ($ct) - $start;
+ $Gruntmaster::Data::contest = $ct;