diff --git a/judge/languages.py b/judge/languages.py index 3d29b50d..88a12717 100644 --- a/judge/languages.py +++ b/judge/languages.py @@ -42,7 +42,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 -w -fmax-errors=3 -std=c11 {src_path} -lm -o {exe_path}" } _c_lang_spj_config = { @@ -51,7 +51,8 @@ _c_lang_spj_config = { "seccomp_rule": "c_cpp_file_io" } -_cpp_lang_config = { + +_cpp11_lang_config = { "template": """//PREPEND BEGIN #include //PREPEND END @@ -84,6 +85,39 @@ int main() { } } +_cpp_lang_config = { + "template": """//PREPEND BEGIN +#include +//PREPEND END + +//TEMPLATE BEGIN +int add(int a, int b) { + // Please fill this blank + return ___________; +} +//TEMPLATE END + +//APPEND BEGIN +int main() { + std::cout << add(1, 2); + return 0; +} +//APPEND END""", + "compile": { + "src_name": "main.cpp", + "exe_name": "main", + "max_cpu_time": 3000, + "max_real_time": 10000, + "max_memory": 512 * 1024 * 1024, + "compile_command": "/usr/bin/g++ -DONLINE_JUDGE -w -fmax-errors=3 {src_path} -lm -o {exe_path}", + }, + "run": { + "command": "{exe_path}", + "seccomp_rule": {ProblemIOMode.standard: "c_cpp", ProblemIOMode.file: "c_cpp_file_io"}, + "env": default_env + } +} + _cpp_lang_spj_compile = { "src_name": "spj-{spj_version}.cpp", "exe_name": "spj-{spj_version}", @@ -205,8 +239,8 @@ languages = [ "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": _cpp11_lang_config, "name": "C++11", "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.15", "content_type": "text/x-go"}, ]