From 8979def927914143f150ebd0d3c7586ac002698a Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Wed, 12 Aug 2015 10:56:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=97=B6=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- judge/judger/language.py | 4 +-- judge/judger/run.py | 75 +--------------------------------------- 2 files changed, 3 insertions(+), 76 deletions(-) diff --git a/judge/judger/language.py b/judge/judger/language.py index 5923edb..3cbf002 100644 --- a/judge/judger/language.py +++ b/judge/judger/language.py @@ -6,14 +6,14 @@ languages = { "name": "c", "src_name": "main.c", "code": 1, - "compile_command": "gcc -DONLINE_JUDGE -O2 -Wall -std=c99 -pipe {src_path} -lm -o {exe_path}main", + "compile_command": "gcc -DONLINE_JUDGE -O2 -w -std=c99 -pipe {src_path} -lm -o {exe_path}main", "execute_command": "{exe_path}main" }, "2": { "name": "cpp", "src_name": "main.cpp", "code": 2, - "compile_command": "g++ -DONLINE_JUDGE -O2 -Wall -std=c++11 -pipe {src_path} -lm -o {exe_path}main", + "compile_command": "g++ -DONLINE_JUDGE -O2 -w -std=c++11 -pipe {src_path} -lm -o {exe_path}main", "execute_command": "{exe_path}main" }, "3": { diff --git a/judge/judger/run.py b/judge/judger/run.py index 6a67e16..03474cf 100644 --- a/judge/judger/run.py +++ b/judge/judger/run.py @@ -5,81 +5,8 @@ from language import languages from compiler import compile_ from result import result -# -# c_src = r""" -# #include -# #include -# int main() -# { -# FILE *fp; -# fp = NULL; -# fprintf(fp, "This is testing for fprintf...\n"); -# fputs("This is testing for fputs...\n", fp); -# fclose(fp); -# printf("111111"); -# return 0; -# } -# """ -# -# cpp_src = r""" -# #include -# -# using namespace std; -# -# int main() -# { -# int a,b; -# cin >> a >> b; -# cout << a+b; -# return 0; -# } -# """ -# -# java_src = r""" -# import java.io.*; -# import java.util.*; -# 11 -# public class Main -# { -# public static void main(String[] args) -# { -# Scanner in = new Scanner(System.in); -# PrintWriter out = new PrintWriter(System.out); -# -# int a = in.nextInt(); -# int b = in.nextInt(); -# out.print(a + b); -# throw new EmptyStackException(); -# -# } -# } -# """ -# def judge(language_code, source_string): -# language = languages[str(language_code)] -# src_path = judger_workspace + language["src_name"] -# f = open(src_path, "w") -# f.write(source_string) -# f.close() -# -# try: -# exe_path = compile_(languages[str(language_code)], src_path, judger_workspace) -# except Exception as e: -# print e -# return [{"result": result["compile_error"]}] -# -# client = JudgeClient(language_code=language_code, -# exe_path=exe_path, -# max_cpu_time=1000000, -# max_real_time=200000, -# max_memory=1000, -# test_case_dir="/var/test_cases/1/") -# return client.run() -# -# print judge(1, c_src) -# print judge(2, cpp_src) -# print judge(3, java_src) -judger_workspace = "/var/judger/" +judger_workspace = "/var/judger/run/" # 简单的解析命令行参数 # 参数有 -solution_id -max_cpu_time -max_memory -test_case_id # 获取到的值是['xxx.py', '-solution_id', '1111', '-max_cpu_time', '1000', '-max_memory', '100', '-test_case_id', 'aaaa']