This table was generated with the following script:
1 #!/usr/bin/perl
2 use v5.14;
3 use warnings;
4
5 use Encode qw/encode/;
6 use HTTP::Tiny;
7 use JSON::PP qw/decode_json/;
8
9 my %scores;
10 my %user_to_name;
11
12 my @contests = qw/mc2015r1 mc2015r2/;
13 my $ht = HTTP::Tiny->new;
14
15 for my $ct (@contests) {
16 my $st = decode_json $ht->get("https://mindcoding.ro/st/$ct?format=json")->{content};
17 my @st = @{$st->{st}};
18 for (@st) {
19 $scores{$_->{user}}{$ct} = $_->{score};
20 $scores{$_->{user}}{total} += $_->{score};
21 $user_to_name{$_->{user}} = $_->{user_name} // $_->{user};
22 }
23 }
24
25 print <<'';
26 <table class="table table-bordered table-striped">
27 <thead>
28 <tr><th>No.<th>User<th>Round 1<th>Round 2<th>Total
29 <tbody>
30
31 my $nr = 1;
32 for my $user (sort {$scores{$b}{total} <=> $scores{$a}{total} or $a cmp $b} keys %scores) {
33 my $cts = join '<td>', map { $scores{$user}{$_} // '-' } @contests;
34 say encode 'UTF-8', qq,<tr><td>$nr<td><a href="/us/$user">$user_to_name{$user}</a><td>$cts<td>$scores{$user}{total},;
35 $nr++;
36 }
37
38 say '</table>';