示例#1
0
        /// <summary>
        /// 评测此JudgeTask
        /// </summary>
        private void Judge(JudgeContext context)
        {
            JudgeTask task = context.Task;

            ITaskSubmitter submitter = FetcherFactory.CreateTaskSubmitter();

            try
            {
                UpdateTestData(context);

                using (BaseJudger judger = JudgerFactory.Create(context))
                {
                    LogStartJudgeTask(task.SubmitId);
                    judger.Judge();
                }

                LogJudgeResult(context.Result);
            }
            catch (Exception ex) //判题失败
            {
                LogJudgeFailed(ex, task.SubmitId);
                context.Result = CreateFailedJudgeResult(context, ex.ToString());
                throw ex;
            }
            finally
            {
                submitter.Submit(context);
            }
        }
示例#2
0
        /// <summary>
        /// 评测此JudgeTask
        /// </summary>
        private void Judge(JudgeTask task)
        {
            ITaskSubmitter submitter = FetcherFactory.CreateTaskSubmitter();

            try
            {
                // 检查测试数据是否为最新
                if (!TestDataManager.CheckData(task.ProblemID, task.DataVersion))
                {
                    ITestDataFetcher fetcher = FetcherFactory.CreateTestDataFetcher();
                    TestDataManager.WriteTestData(task.ProblemID, fetcher.Fetch(task.ProblemID));
                }

                JudgeResult result;
                using (MainJudger judger = new MainJudger(task))
                {
                    result = judger.Judge();
                }

                submitter.Submit(result);
            }
            catch (Exception ex)//判题失败
            {
                submitter.Submit(CreateFailedJudgeResult(task, ex.ToString()));
                throw ex;
            }
        }