judge: java用户两倍时限

This commit is contained in:
undefined committed 2021-04-30 12:13:16 +08:00
1 parent 3664df4202
commit c65fddfb76
4 files changed
+15 -1

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "2.5.15",
"version": "2.5.16",
"main": "package.json",
"author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git",
+1
View File
@@ -98,6 +98,7 @@ langs:
code_file: Main.java
target: Main.class
execute: /usr/bin/java Main
time_limit_rate: 2
py:
type: compiler
compile: /usr/bin/python -c "import py_compile; py_compile.compile('${dir}/foo.py', '${dir}/${name}', doraise=True)"
+6
View File
@@ -1,5 +1,6 @@
import Queue from 'p-queue';
import path from 'path';
import yaml from 'js-yaml';
import fs from 'fs-extra';
import { argv } from 'yargs';
import * as STATUS from '../status';
@@ -102,6 +103,7 @@ function judgeCase(c, sid) {
function judgeSubtask(subtask, sid) {
return async (ctx) => {
subtask.time *= ctx.time_limit_rate;
subtask.type = subtask.type || 'min';
const ctxSubtask = {
subtask,
@@ -132,6 +134,10 @@ export const judge = async (ctx) => {
ctx.code = tpl[0] + ctx.code + tpl[1];
} else throw new CompileError('Language not supported by provided templates');
}
const LANGS = yaml.load(getConfig('langs'));
if (!LANGS[ctx.lang]) throw new SystemError('Unsupported language {0}.', [ctx.lang]);
const info = LANGS[ctx.lang];
ctx.time_limit_rate = info.time_limit_rate || 1;
ctx.next({ status: STATUS.STATUS_COMPILING });
[ctx.execute, ctx.checker] = await Promise.all([
(async () => {
@@ -1,6 +1,7 @@
import Queue from 'p-queue';
import fs from 'fs-extra';
import { argv } from 'yargs';
import yaml from 'js-yaml';
import * as STATUS from '../status';
import { parse } from '../testlib';
import { findFileSync, parseFilename } from '../utils';
@@ -8,6 +9,7 @@ import { run } from '../sandbox';
import compile from '../compile';
import signals from '../signals';
import { getConfig } from '../config';
import { SystemError } from '../error';
const testlibSrc = findFileSync('@hydrooj/hydrojudge/vendor/testlib/testlib.h');
const Score = {
@@ -70,6 +72,7 @@ function judgeCase(c) {
function judgeSubtask(subtask) {
return async (ctx) => {
subtask.time *= ctx.time_limit_rate;
subtask.type = subtask.type || 'min';
const ctxSubtask = {
subtask,
@@ -90,6 +93,10 @@ function judgeSubtask(subtask) {
export const judge = async (ctx) => {
ctx.next({ status: STATUS.STATUS_COMPILING });
const LANGS = yaml.load(getConfig('langs'));
if (!LANGS[ctx.lang]) throw new SystemError('Unsupported language {0}.', [ctx.lang]);
const info = LANGS[ctx.lang];
ctx.time_limit_rate = info.time_limit_rate || 1;
[ctx.executeUser, ctx.executeInteractor] = await Promise.all([
(async () => {
const copyIn = {};