Skip to content

Commit

Permalink
Support parsing time/memory limits in LightOJ contest parser
Browse files Browse the repository at this point in the history
  • Loading branch information
jmerle committed Oct 14, 2024
1 parent acdaa57 commit c31e673
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/parsers/problem/LightOJProblemParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ export class LightOJProblemParser extends Parser {

task.setName(elem.querySelector('.title').textContent.trim());

const limitsStr = elem.querySelector('.limit-section, p.subtitle').textContent.trim();

if (limitsStr) {
task.setTimeLimit(parseFloat(/([0-9.]+) second/.exec(limitsStr)[1]) * 1000);
task.setMemoryLimit(parseInt(/(\d+) MB/.exec(limitsStr)[1], 10));
}
const limitElems = elem.querySelectorAll('.tooltip-trigger > span');
task.setTimeLimit(parseFloat(/([0-9.]+)/.exec(limitElems[0].textContent)[1]) * 1000);
task.setMemoryLimit(parseInt(/(\d+)/.exec(limitElems[1].textContent)[1], 10));

const blocks = elem.querySelectorAll('.sample-dataset-section .dataset-container');
for (let i = 0; i < blocks.length - 1; i += 2) {
Expand Down

0 comments on commit c31e673

Please sign in to comment.