Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
setrlimit(RLIMIT_CPU, &max_cpu_time)
It will also exit in real execution time, and the if code block does not handle the case where real_time > max_cpu_time.
reproduce json code for JudgerServer api:
{ "language_config": { "compile": { "src_name": "main.cpp", "exe_name": "main", "max_cpu_time": 1000, "max_real_time": 2000, "max_memory": 1073741824, "compile_command": "/usr/bin/g++ -DONLINE_JUDGE -O2 -Werror=return-type -fmax-errors=3 -std=c++11 {src_path} -lm -o {exe_path}" }, "run": { "command": "{exe_path}", "seccomp_rule": "c_cpp", "env": [ "LANG=en_US.UTF-8", "LANGUAGE=en_US:en", "LC_ALL=en_US.UTF-8" ] } }, "src": "#include <stdio.h>\nint main() {\n int cnt1 = 0;\n int cnt2 = 0; \n int cnt3 = 0; \n int cnt4 = 0; \n char c;\n\n while ((c = getchar()) != '\\n') { \n if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {\n cnt1++; \n } else if (c == ' ') {\n cnt2++; \n } else if (c >= '0' && c <= '9') {\n cnt3++; \n } else {\n cnt4++; \n }\n }\n printf(\"英文字母:%d\\n\", cnt1);\n printf(\"空格:%d\\n\", cnt2);\n printf(\"数字:%d\\n\", cnt3);\n printf(\"其他字符:%d\\n\", cnt4);\n return 0;\n}\n", "max_cpu_time": 5000, "max_memory": 134217728, "output": true, "test_case": [ { "input": "Hi everyone, my name is Li Na. I'm 18 years old and I love programming.", "output": "英文字母:51\n空格:14\n数字:2\n其他字符:4" } ] }response:
{ "err": null, "data": [ { "cpu_time": 2870, "real_time": 6000, "memory": 524288, "signal": 9, "exit_code": 0, "error": 0, "result": 4, // here should be "1" "test_case": "1", "output_md5": null, "output": "" } ] }