Example #1
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;
            }
        }
Example #2
0
        private void UpdateTestData(JudgeContext context)
        {
            JudgeTask task = context.Task;

            // 检查测试数据是否为最新
            if (!TestDataManager.CheckData(task.ProblemId, task.DataVersion))
            {
                LogInvalidTestData(task.ProblemId);

                ITestDataFetcher fetcher = FetcherFactory.CreateTestDataFetcher();
                TestDataManager.WriteTestData(task.ProblemId, fetcher.Fetch(context));

                LogTestDataFetched(task.ProblemId);
            }
        }