- insert_problem $id => name => $name, level => $level, statement => $statement, author => $author, owner => $owner;
- set_problem_meta $id => \%meta;
- PUBLISH genpage => $contest ? "ct/$contest/pb/index.html" : 'pb/index.html';
- PUBLISH genpage => $contest ? "ct/$contest/pb/$id.html" : "pb/$id.html";
+ my %options = (
+ id => $id,
+ name => $name,
+ level => $level,
+ statement => $statement,
+ author => $author,
+ writer => $writer,
+ owner => $owner,
+ generator => $generator,
+ runner => $runner,
+ judge => $judge,
+ testcnt => $testcnt,
+ );
+ $options{private} = $private if $private;
+ $options{timeout} = $timeout if $timeout;
+ $options{olimit} = $olimit if $olimit;
+ $options{tests} = encode_json \@tests if @tests;
+ $options{gensource} = $gensource if $gensource;
+ $options{genformat} = $genformat if $genformat;
+ $options{versource} = $versource if $versource;
+ $options{verformat} = $verformat if $verformat;
+ $db->problems->create (\%options);
+
+ $db->contest_problems->create({problem => $id, contest => $contest}) if $contest;