feat: upgrade judge languages and remove python2

This commit is contained in:
Mikucat 2024-01-29 16:16:55 +08:00
parent 5307965efe
commit f347409789
No known key found for this signature in database
GPG Key ID: CE6B09A6F462E04D

View File

@ -26,7 +26,7 @@ int main() {
"max_cpu_time": 3000,
"max_real_time": 10000,
"max_memory": 256 * 1024 * 1024,
"compile_command": "/usr/bin/gcc -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c11 {src_path} -lm -o {exe_path}",
"compile_command": "/usr/bin/gcc -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c17 {src_path} -lm -o {exe_path}",
},
"run": {
"command": "{exe_path}",
@ -41,7 +41,7 @@ _c_lang_spj_compile = {
"max_cpu_time": 3000,
"max_real_time": 10000,
"max_memory": 1024 * 1024 * 1024,
"compile_command": "/usr/bin/gcc -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c11 {src_path} -lm -o {exe_path}"
"compile_command": "/usr/bin/gcc -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c17 {src_path} -lm -o {exe_path}"
}
_c_lang_spj_config = {
@ -73,7 +73,7 @@ int main() {
"max_cpu_time": 10000,
"max_real_time": 20000,
"max_memory": 1024 * 1024 * 1024,
"compile_command": "/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c++14 {src_path} -lm -o {exe_path}",
"compile_command": "/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c++20 {src_path} -lm -o {exe_path}",
},
"run": {
"command": "{exe_path}",
@ -88,7 +88,7 @@ _cpp_lang_spj_compile = {
"max_cpu_time": 10000,
"max_real_time": 20000,
"max_memory": 1024 * 1024 * 1024,
"compile_command": "/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c++14 {src_path} -lm -o {exe_path}"
"compile_command": "/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c++20 {src_path} -lm -o {exe_path}"
}
_cpp_lang_spj_config = {
@ -120,41 +120,16 @@ class Main {
"max_cpu_time": 5000,
"max_real_time": 10000,
"max_memory": -1,
"compile_command": "/usr/bin/javac {src_path} -d {exe_dir} -encoding UTF8"
"compile_command": "/usr/bin/javac {src_path} -d {exe_dir}"
},
"run": {
"command": "/usr/bin/java -cp {exe_dir} -XX:MaxRAM={max_memory}k -Djava.security.manager -Dfile.encoding=UTF-8 "
"-Djava.security.policy==/etc/java_policy -Djava.awt.headless=true Main",
"command": "/usr/bin/java -cp {exe_dir} -XX:MaxRAM={max_memory}k Main",
"seccomp_rule": None,
"env": default_env,
"memory_limit_check_only": 1
}
}
_py2_lang_config = {
"template": """//PREPEND BEGIN
//PREPEND END
//TEMPLATE BEGIN
//TEMPLATE END
//APPEND BEGIN
//APPEND END""",
"compile": {
"src_name": "solution.py",
"exe_name": "solution.pyc",
"max_cpu_time": 3000,
"max_real_time": 10000,
"max_memory": 128 * 1024 * 1024,
"compile_command": "/usr/bin/python -m py_compile {src_path}",
},
"run": {
"command": "/usr/bin/python {exe_path}",
"seccomp_rule": "general",
"env": default_env
}
}
_py3_lang_config = {
"template": """//PREPEND BEGIN
//PREPEND END
@ -170,16 +145,16 @@ print(add(1, 2))
//APPEND END""",
"compile": {
"src_name": "solution.py",
"exe_name": "__pycache__/solution.cpython-36.pyc",
"exe_name": "solution.py",
"max_cpu_time": 3000,
"max_real_time": 10000,
"max_memory": 128 * 1024 * 1024,
"compile_command": "/usr/bin/python3 -m py_compile {src_path}",
},
"run": {
"command": "/usr/bin/python3 {exe_path}",
"command": "/usr/bin/python3 -BS {exe_path}",
"seccomp_rule": "general",
"env": default_env + ["PYTHONIOENCODING=utf-8"]
"env": default_env
}
}
@ -213,8 +188,7 @@ func main() {
"run": {
"command": "{exe_path}",
"seccomp_rule": "golang",
# 降低内存占用
"env": ["GODEBUG=madvdontneed=1", "GOMAXPROCS=1"] + default_env,
"env": ["GOMAXPROCS=1"] + default_env,
"memory_limit_check_only": 1
}
}
@ -250,13 +224,12 @@ console.log(add(1, 2))
}
languages = [
{"config": _c_lang_config, "spj": {"compile": _c_lang_spj_compile, "config": _c_lang_spj_config},
"name": "C", "description": "GCC 9.4", "content_type": "text/x-csrc"},
{"config": _cpp_lang_config, "spj": {"compile": _cpp_lang_spj_compile, "config": _cpp_lang_spj_config},
"name": "C++", "description": "G++ 9.4", "content_type": "text/x-c++src"},
{"config": _java_lang_config, "name": "Java", "description": "OpenJDK 11", "content_type": "text/x-java"},
{"config": _py2_lang_config, "name": "Python2", "description": "Python 2.7", "content_type": "text/x-python"},
{"config": _py3_lang_config, "name": "Python3", "description": "Python 3.6", "content_type": "text/x-python"},
{"config": _go_lang_config, "name": "Golang", "description": "Golang 1.17", "content_type": "text/x-go"},
{"config": _node_lang_config, "name": "JavaScript", "description": "Node 14", "content_type": "text/javascript"},
{"config": _c_lang_config, "name": "C", "description": "GCC 13", "content_type": "text/x-csrc",
"spj": {"compile": _c_lang_spj_compile, "config": _c_lang_spj_config}},
{"config": _cpp_lang_config, "name": "C++", "description": "GCC 13", "content_type": "text/x-c++src",
"spj": {"compile": _cpp_lang_spj_compile, "config": _cpp_lang_spj_config}},
{"config": _java_lang_config, "name": "Java", "description": "Temurin 21", "content_type": "text/x-java"},
{"config": _py3_lang_config, "name": "Python3", "description": "Python 3.12", "content_type": "text/x-python"},
{"config": _go_lang_config, "name": "Golang", "description": "Golang 1.22", "content_type": "text/x-go"},
{"config": _node_lang_config, "name": "JavaScript", "description": "Node.js 20", "content_type": "text/javascript"},
]