Skip to content

Commit

Permalink
small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
danielzsh committed Dec 24, 2023
1 parent bb610da commit e01350d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/update_usaco.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
paths:
- '.github/workflows/update_usaco.yml'
- 'usaco_util.ts'
- 'run.sh'
- 'create_pr.sh'

Expand Down
12 changes: 6 additions & 6 deletions usaco_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ async function addProblem(id: number) {
(async () => {
const MAX_GAP = 20;
const LAST_ID = Math.max(...Object.keys(problems).map(Number));
let id = LAST_ID + 1;
while (!await addProblem(id++)) {
if (id - LAST_ID > MAX_GAP) {
console.log('No more problems to add!');
process.exit(0);
let last_added = LAST_ID;
let id = last_added + 1;
while (id - last_added < MAX_GAP) {
if (await addProblem(id++)) {
last_added = id - 1;
}
}
while (await addProblem(id++));
if (last_added == LAST_ID) process.exit(0);
report += '```';
writeFileSync(
'problems.json',
Expand Down

0 comments on commit e01350d

Please sign in to comment.