Accept Merge Request #66 : (virusdefender-dev -> dev)
Merge Request: 部分 bug 修复;单元测试的问题修复 Created By: @virusdefender Accepted By: @virusdefender URL: https://coding.net/u/virusdefender/p/qduoj/git/merge/66
This commit is contained in:
12
judge/tests/c/cpu_time_timeout.c
Normal file
12
judge/tests/c/cpu_time_timeout.c
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int a = 0;
|
||||||
|
int i = 0;
|
||||||
|
for(i = 0; i < 9999999999;i++)
|
||||||
|
{
|
||||||
|
a += i;
|
||||||
|
}
|
||||||
|
printf("%d", a);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
6
judge/tests/c/real_time_timeout.c
Normal file
6
judge/tests/c/real_time_timeout.c
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
8
judge/tests/c/success.c
Normal file
8
judge/tests/c/success.c
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# include <stdio.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int a, b;
|
||||||
|
scanf("%d %d", &a, &b);
|
||||||
|
printf("%d", a + b);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -42,4 +42,6 @@ urlpatterns = [
|
|||||||
url(r'^api/admin/problem/$', ProblemAdminAPIView.as_view(), name="problem_admin_api"),
|
url(r'^api/admin/problem/$', ProblemAdminAPIView.as_view(), name="problem_admin_api"),
|
||||||
url(r'^api/admin/test_case_upload/$', TestCaseUploadAPIView.as_view(), name="test_case_upload_api"),
|
url(r'^api/admin/test_case_upload/$', TestCaseUploadAPIView.as_view(), name="test_case_upload_api"),
|
||||||
url(r'^api/admin/tag/$', ProblemTagAdminAPIView.as_view(), name="problem_tag_admin_api"),
|
url(r'^api/admin/tag/$', ProblemTagAdminAPIView.as_view(), name="problem_tag_admin_api"),
|
||||||
|
url(r'^problem/(?P<problem_id>\d+)/my_solutions/', "problem.views.problem_my_solutions_list_page", name="problem_my_solutions_page"),
|
||||||
|
url(r'^my_solution/(?P<solution_id>\d+)/$', "problem.views.my_solution", name="my_solution_page"),
|
||||||
]
|
]
|
||||||
|
|||||||
19
problem/migrations/0003_auto_20150810_2233.py
Normal file
19
problem/migrations/0003_auto_20150810_2233.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('problem', '0002_remove_problemtag_description'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='problem',
|
||||||
|
old_name='sample',
|
||||||
|
new_name='samples',
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -6,7 +6,6 @@ from account.models import User
|
|||||||
|
|
||||||
class ProblemTag(models.Model):
|
class ProblemTag(models.Model):
|
||||||
name = models.CharField(max_length=30)
|
name = models.CharField(max_length=30)
|
||||||
# description = models.CharField(max_length=50)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = "problem_tag"
|
db_table = "problem_tag"
|
||||||
@@ -18,7 +17,7 @@ class AbstractProblem(models.Model):
|
|||||||
# 问题描述 HTML 格式
|
# 问题描述 HTML 格式
|
||||||
description = models.TextField()
|
description = models.TextField()
|
||||||
# 样例输入 可能会存储 json 格式的数据
|
# 样例输入 可能会存储 json 格式的数据
|
||||||
sample = models.TextField(blank=True)
|
samples = models.TextField(blank=True)
|
||||||
# 测试用例id 这个id 可以用来拼接得到测试用例的文件存储位置
|
# 测试用例id 这个id 可以用来拼接得到测试用例的文件存储位置
|
||||||
test_case_id = models.CharField(max_length=40)
|
test_case_id = models.CharField(max_length=40)
|
||||||
# 提示
|
# 提示
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ class ProblemSampleSerializer(serializers.ListField):
|
|||||||
|
|
||||||
class JSONField(serializers.Field):
|
class JSONField(serializers.Field):
|
||||||
def to_representation(self, value):
|
def to_representation(self, value):
|
||||||
print value, type(value)
|
|
||||||
return json.loads(value)
|
return json.loads(value)
|
||||||
|
|
||||||
|
|
||||||
@@ -22,18 +21,18 @@ class CreateProblemSerializer(serializers.Serializer):
|
|||||||
title = serializers.CharField(max_length=50)
|
title = serializers.CharField(max_length=50)
|
||||||
description = serializers.CharField(max_length=10000)
|
description = serializers.CharField(max_length=10000)
|
||||||
# [{"input": "1 1", "output": "2"}]
|
# [{"input": "1 1", "output": "2"}]
|
||||||
sample = ProblemSampleSerializer()
|
samples = ProblemSampleSerializer()
|
||||||
test_case_id = serializers.CharField(max_length=40)
|
test_case_id = serializers.CharField(max_length=40)
|
||||||
source = serializers.CharField(max_length=30, required=False, default=None)
|
source = serializers.CharField(max_length=30, required=False, default=None)
|
||||||
time_limit = serializers.IntegerField()
|
time_limit = serializers.IntegerField()
|
||||||
memory_limit = serializers.IntegerField()
|
memory_limit = serializers.IntegerField()
|
||||||
difficulty = serializers.IntegerField()
|
difficulty = serializers.IntegerField()
|
||||||
tags = serializers.ListField(child=serializers.IntegerField())
|
tags = serializers.ListField(child=serializers.CharField(max_length=10))
|
||||||
hint = serializers.CharField(max_length=3000, required=False, default=None)
|
hint = serializers.CharField(max_length=3000, required=False, default=None)
|
||||||
|
|
||||||
|
|
||||||
class ProblemSerializer(serializers.ModelSerializer):
|
class ProblemSerializer(serializers.ModelSerializer):
|
||||||
sample = JSONField()
|
samples = JSONField()
|
||||||
|
|
||||||
class UserSerializer(serializers.ModelSerializer):
|
class UserSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -56,7 +55,7 @@ class EditProblemSerializer(serializers.Serializer):
|
|||||||
memory_limit = serializers.IntegerField()
|
memory_limit = serializers.IntegerField()
|
||||||
difficulty = serializers.IntegerField()
|
difficulty = serializers.IntegerField()
|
||||||
tags = serializers.ListField(child=serializers.IntegerField())
|
tags = serializers.ListField(child=serializers.IntegerField())
|
||||||
sample = ProblemSampleSerializer()
|
samples = ProblemSampleSerializer()
|
||||||
hint = serializers.CharField(max_length=10000)
|
hint = serializers.CharField(max_length=10000)
|
||||||
visible = serializers.BooleanField()
|
visible = serializers.BooleanField()
|
||||||
|
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ class ProblemAdminTest(APITestCase):
|
|||||||
|
|
||||||
def test_success_problem(self):
|
def test_success_problem(self):
|
||||||
self.client.login(username="test", password="testaa")
|
self.client.login(username="test", password="testaa")
|
||||||
ProblemTag.objects.create(name="tag1", description="destag1")
|
ProblemTag.objects.create(name="tag1")
|
||||||
data = {"title": "title1",
|
data = {"title": "title1",
|
||||||
"description": "des1",
|
"description": "des1",
|
||||||
"test_case_id": "1",
|
"test_case_id": "1",
|
||||||
"source": "source1",
|
"source": "source1",
|
||||||
"sample": [{"input": "1 1", "output": "2"}],
|
"samples": [{"input": "1 1", "output": "2"}],
|
||||||
"time_limit": "100",
|
"time_limit": "100",
|
||||||
"memory_limit": "1000",
|
"memory_limit": "1000",
|
||||||
"difficulty": "1",
|
"difficulty": "1",
|
||||||
@@ -52,13 +52,13 @@ class ProblemAdminTest(APITestCase):
|
|||||||
|
|
||||||
def test_problem_does_not_exist(self):
|
def test_problem_does_not_exist(self):
|
||||||
self.client.login(username="test", password="testaa")
|
self.client.login(username="test", password="testaa")
|
||||||
ProblemTag.objects.create(name="tag1", description="destag1")
|
ProblemTag.objects.create(name="tag1")
|
||||||
tags = ProblemTag.objects.filter(id__in=[1])
|
tags = ProblemTag.objects.filter(id__in=[1])
|
||||||
problem = Problem.objects.create(title="title1",
|
problem = Problem.objects.create(title="title1",
|
||||||
description="des1",
|
description="des1",
|
||||||
test_case_id="1",
|
test_case_id="1",
|
||||||
source="source1",
|
source="source1",
|
||||||
sample=[{"input": "1 1", "output": "2"}],
|
samples=[{"input": "1 1", "output": "2"}],
|
||||||
time_limit=100,
|
time_limit=100,
|
||||||
memory_limit=1000,
|
memory_limit=1000,
|
||||||
difficulty=1,
|
difficulty=1,
|
||||||
@@ -70,7 +70,7 @@ class ProblemAdminTest(APITestCase):
|
|||||||
"description": "des1",
|
"description": "des1",
|
||||||
"test_case_id": "1",
|
"test_case_id": "1",
|
||||||
"source": "source1",
|
"source": "source1",
|
||||||
"sample": [{"input": "1 1", "output": "2"}],
|
"samples": [{"input": "1 1", "output": "2"}],
|
||||||
"time_limit": "100",
|
"time_limit": "100",
|
||||||
"memory_limit": "1000",
|
"memory_limit": "1000",
|
||||||
"difficulty": "1",
|
"difficulty": "1",
|
||||||
@@ -82,14 +82,14 @@ class ProblemAdminTest(APITestCase):
|
|||||||
def test_success_edit_problem(self):
|
def test_success_edit_problem(self):
|
||||||
self.client.login(username="test", password="testaa")
|
self.client.login(username="test", password="testaa")
|
||||||
self.client.login(username="test", password="testaa")
|
self.client.login(username="test", password="testaa")
|
||||||
ProblemTag.objects.create(name="tag1", description="destag1")
|
ProblemTag.objects.create(name="tag1")
|
||||||
ProblemTag.objects.create(name="tag2", description="destag2")
|
ProblemTag.objects.create(name="tag2")
|
||||||
tags = ProblemTag.objects.filter(id__in=[1])
|
tags = ProblemTag.objects.filter(id__in=[1])
|
||||||
problem0 = Problem.objects.create(title="title1",
|
problem0 = Problem.objects.create(title="title1",
|
||||||
description="des1",
|
description="des1",
|
||||||
test_case_id="1",
|
test_case_id="1",
|
||||||
source="source1",
|
source="source1",
|
||||||
sample=[{"input": "1 1", "output": "2"}],
|
samples=[{"input": "1 1", "output": "2"}],
|
||||||
time_limit=100,
|
time_limit=100,
|
||||||
memory_limit=1000,
|
memory_limit=1000,
|
||||||
difficulty=1,
|
difficulty=1,
|
||||||
@@ -101,7 +101,7 @@ class ProblemAdminTest(APITestCase):
|
|||||||
"description": "des1",
|
"description": "des1",
|
||||||
"test_case_id": "1",
|
"test_case_id": "1",
|
||||||
"source": "source1",
|
"source": "source1",
|
||||||
"sample": [{"input": "1 1", "output": "2"}],
|
"samples": [{"input": "1 1", "output": "2"}],
|
||||||
"time_limit": "100",
|
"time_limit": "100",
|
||||||
"memory_limit": "1000",
|
"memory_limit": "1000",
|
||||||
"difficulty": "1",
|
"difficulty": "1",
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class ProblemTagAdminAPIView(APIView):
|
|||||||
return error_response(serializer)
|
return error_response(serializer)
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
return success_response(ProblemTagSerializer(ProblemTag.objects.all(), many=True).data)
|
||||||
keyword = request.GET.get("keyword", None)
|
keyword = request.GET.get("keyword", None)
|
||||||
if not keyword:
|
if not keyword:
|
||||||
return error_response(u"参数错误")
|
return error_response(u"参数错误")
|
||||||
@@ -44,8 +45,20 @@ class ProblemTagAdminAPIView(APIView):
|
|||||||
|
|
||||||
|
|
||||||
def problem_page(request, problem_id):
|
def problem_page(request, problem_id):
|
||||||
# todo
|
try:
|
||||||
return render(request, "oj/problem/problem.html")
|
problem = Problem.objects.get(id=problem_id)
|
||||||
|
except Problem.DoesNotExist:
|
||||||
|
return render(request, "utils/error.html", {"error": u"题目不存在"})
|
||||||
|
return render(request, "oj/problem/problem.html", {"problem": problem, "samples": json.loads(problem.samples)})
|
||||||
|
|
||||||
|
|
||||||
|
def problem_my_solutions_list_page(request, problem_id):
|
||||||
|
return render(request, "oj/problem/my_solutions_list.html")
|
||||||
|
|
||||||
|
|
||||||
|
def my_solution(request, solution_id):
|
||||||
|
return render(request, "oj/problem/my_solution.html")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProblemAdminAPIView(APIView):
|
class ProblemAdminAPIView(APIView):
|
||||||
@@ -63,15 +76,19 @@ class ProblemAdminAPIView(APIView):
|
|||||||
description=data["description"],
|
description=data["description"],
|
||||||
test_case_id=data["test_case_id"],
|
test_case_id=data["test_case_id"],
|
||||||
source=data["source"],
|
source=data["source"],
|
||||||
sample=json.dumps(data["sample"]),
|
samples=json.dumps(data["samples"]),
|
||||||
time_limit=data["time_limit"],
|
time_limit=data["time_limit"],
|
||||||
memory_limit=data["memory_limit"],
|
memory_limit=data["memory_limit"],
|
||||||
difficulty=data["difficulty"],
|
difficulty=data["difficulty"],
|
||||||
created_by=request.user,
|
created_by=request.user,
|
||||||
hint=data["hint"])
|
hint=data["hint"])
|
||||||
|
|
||||||
tags = ProblemTag.objects.filter(id__in=data["tags"])
|
for tag in data["tags"]:
|
||||||
problem.tags.add(*tags)
|
try:
|
||||||
|
tag = ProblemTag.objects.get(name=tag)
|
||||||
|
except ProblemTag.DoesNotExist:
|
||||||
|
tag = ProblemTag.objects.create(name=tag)
|
||||||
|
problem.tags.add(tag)
|
||||||
return success_response(ProblemSerializer(problem).data)
|
return success_response(ProblemSerializer(problem).data)
|
||||||
else:
|
else:
|
||||||
return serializer_invalid_response(serializer)
|
return serializer_invalid_response(serializer)
|
||||||
@@ -98,7 +115,7 @@ class ProblemAdminAPIView(APIView):
|
|||||||
problem.time_limit = data["time_limit"]
|
problem.time_limit = data["time_limit"]
|
||||||
problem.memory_limit = data["memory_limit"]
|
problem.memory_limit = data["memory_limit"]
|
||||||
problem.difficulty = data["difficulty"]
|
problem.difficulty = data["difficulty"]
|
||||||
problem.sample = json.dumps(data["sample"])
|
problem.samples = json.dumps(data["samples"])
|
||||||
problem.hint = data["hint"]
|
problem.hint = data["hint"]
|
||||||
problem.visible = data["visible"]
|
problem.visible = data["visible"]
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
@import url("simditor/simditor.css");
|
@import url("simditor/simditor.css");
|
||||||
@import url("webuploader/webuploader.css");
|
@import url("webuploader/webuploader.css");
|
||||||
@import url("datetime_picker/bootstrap-datetimepicker.css");
|
@import url("datetime_picker/bootstrap-datetimepicker.css");
|
||||||
|
@import url("tagEditor/jquery.tag-editor.css");
|
||||||
|
|
||||||
#loading-gif{
|
#loading-gif{
|
||||||
width: 40px;
|
width: 40px;
|
||||||
|
|||||||
@@ -64,18 +64,15 @@ require(["jquery", "avalon", "editor", "uploader", "bs_alert", "csrf", "tagEdito
|
|||||||
})
|
})
|
||||||
.on("success.form.fv", function (e) {
|
.on("success.form.fv", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (vm.test_case_id == '')
|
if (vm.test_case_id == '') {
|
||||||
{
|
|
||||||
bs_alert("你还没有上传测试数据!");
|
bs_alert("你还没有上传测试数据!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vm.description == '')
|
if (vm.description == '') {
|
||||||
{
|
|
||||||
bs_alert("题目描述不能为空!");
|
bs_alert("题目描述不能为空!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vm.hint == '')
|
if (vm.hint == '') {
|
||||||
{
|
|
||||||
bs_alert("提示不能为空!");
|
bs_alert("提示不能为空!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -88,33 +85,30 @@ require(["jquery", "avalon", "editor", "uploader", "bs_alert", "csrf", "tagEdito
|
|||||||
test_case_id: vm.test_case_id,
|
test_case_id: vm.test_case_id,
|
||||||
hint: vm.hint,
|
hint: vm.hint,
|
||||||
source: vm.source,
|
source: vm.source,
|
||||||
tags: [],
|
tags: $("#tags").tagEditor("getTags")[0].tags,
|
||||||
difficulty: vm.difficulty
|
difficulty: vm.difficulty
|
||||||
};
|
};
|
||||||
if (vm.samples.length == 0)
|
if (vm.samples.length == 0) {
|
||||||
{
|
|
||||||
bs_alert("请至少添加一组样例!");
|
bs_alert("请至少添加一组样例!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var tags = $("#tags").tagEditor("getTags")[0].tags;
|
|
||||||
if (tags.length == 0)
|
if (tags.length == 0) {
|
||||||
{
|
|
||||||
bs_alert("请至少添加一个标签,这将有利于用户发现你的题目!");
|
bs_alert("请至少添加一个标签,这将有利于用户发现你的题目!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (key in vm.samples.length) {
|
|
||||||
ajaxData.samples.push({input: vm.samples[key].input, output: vm.samples[key].output});
|
for (var i = 0; i < vm.samples.$model.length; i++) {
|
||||||
|
ajaxData.samples.push({input: vm.samples.$model[i].input, output: vm.samples.$model[i].output});
|
||||||
}
|
}
|
||||||
for (key in tags) {
|
|
||||||
ajaxData.tags.push(tags[key].tag);
|
|
||||||
}
|
|
||||||
console.log(ajaxData);
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
beforeSend: csrfHeader,
|
beforeSend: csrfHeader,
|
||||||
url: "/api/admin/problem/",
|
url: "/api/admin/problem/",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data:ajaxData,
|
data: JSON.stringify(ajaxData),
|
||||||
method: "post",
|
method: "post",
|
||||||
|
contentType: "application/json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (!data.code) {
|
if (!data.code) {
|
||||||
bs_alert("successful!");
|
bs_alert("successful!");
|
||||||
@@ -188,8 +182,8 @@ require(["jquery", "avalon", "editor", "uploader", "bs_alert", "csrf", "tagEdito
|
|||||||
if (!data.code) {
|
if (!data.code) {
|
||||||
tagList = data.data;
|
tagList = data.data;
|
||||||
completeList = [];
|
completeList = [];
|
||||||
for (key in tagList) {
|
for (var i = 0; i < tagList.length; i++) {
|
||||||
completeList.push(tagList[key].name);
|
completeList.push(tagList[i].name);
|
||||||
}
|
}
|
||||||
$("#tags").tagEditor({
|
$("#tags").tagEditor({
|
||||||
autocomplete: {
|
autocomplete: {
|
||||||
|
|||||||
@@ -22,10 +22,12 @@ require(["jquery", "code_mirror"], function ($, code_mirror) {
|
|||||||
setTimeout(
|
setTimeout(
|
||||||
function () {
|
function () {
|
||||||
$("#a").animate({opacity: '1'})
|
$("#a").animate({opacity: '1'})
|
||||||
}
|
}, 3);
|
||||||
,
|
});
|
||||||
3);
|
|
||||||
|
|
||||||
|
$("#show-more-btn").click(function(){
|
||||||
|
$(".hide").attr("class", "problem-section");
|
||||||
|
$("#show-more-btn").hide();
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -12,7 +12,7 @@ var require = {
|
|||||||
validation: "utils/validation",
|
validation: "utils/validation",
|
||||||
code_mirror: "utils/code_mirror",
|
code_mirror: "utils/code_mirror",
|
||||||
bs_alert: "utils/bs_alert",
|
bs_alert: "utils/bs_alert",
|
||||||
submit_code: "app/oj/problem/submit_code",
|
problem: "app/oj/problem/problem",
|
||||||
contest: "app/admin/contest/contest",
|
contest: "app/admin/contest/contest",
|
||||||
csrf: "utils/csrf",
|
csrf: "utils/csrf",
|
||||||
admin: "app/admin/admin",
|
admin: "app/admin/admin",
|
||||||
|
|||||||
@@ -1,23 +1,17 @@
|
|||||||
<div ms-controller="add_problem" class="col-md-9">
|
<div ms-controller="add_problem" class="col-md-9">
|
||||||
<form id="add-problem-form">
|
<form id="add-problem-form">
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-12">
|
||||||
<label>题目标题</label>
|
<label>题目标题</label>
|
||||||
<input type="text" name="title" class="form-control" ms-duplex="title">
|
<input type="text" name="title" class="form-control" ms-duplex="title">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<label>来源</label>
|
<div class="form-group col-md-12">
|
||||||
<input type="text" name="source" class="form-control" ms-duplex="source">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>题目描述</label>
|
<label>题目描述</label>
|
||||||
<textarea id="problemDescription" placeholder="这里输入内容" autofocus ms-duplex="description"></textarea>
|
<textarea id="problemDescription" placeholder="这里输入内容" autofocus ms-duplex="description"></textarea>
|
||||||
<small ms-visible="description==''" style="color:red">请填写题目描述</small>
|
<small ms-visible="description==''" style="color:red">请填写题目描述</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label>提示</label>
|
|
||||||
<textarea id="hint" placeholder="这里输入内容" ms-duplex="hint"></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group"><label>时间限制(ms)</label>
|
<div class="form-group"><label>时间限制(ms)</label>
|
||||||
@@ -81,10 +75,19 @@
|
|||||||
<div class="col-md-12"><br>
|
<div class="col-md-12"><br>
|
||||||
<label>测试数据</label><br>
|
<label>测试数据</label><br>
|
||||||
<small class="text-info">请将所有测试用例打包在一个文件中上传,所有文件要在压缩包的根目录,且输入输出文件名要以从1开始连续数字标识要对应例如:<br>
|
<small class="text-info">请将所有测试用例打包在一个文件中上传,所有文件要在压缩包的根目录,且输入输出文件名要以从1开始连续数字标识要对应例如:<br>
|
||||||
1.in 1.out 2.in 2.out</small>
|
1.in 1.out 2.in 2.out
|
||||||
|
</small>
|
||||||
<table class="table table-striped" ms-visible="uploadSuccess">
|
<table class="table table-striped" ms-visible="uploadSuccess">
|
||||||
<tr><td>编号</td><td>输入文件名</td><td>输出文件名</td></tr>
|
<tr>
|
||||||
<tr ms-repeat="testCaseList"><td>{{$index}}</td><td>{{el.input}}</td><td>{{el.output}}</td></tr>
|
<td>编号</td>
|
||||||
|
<td>输入文件名</td>
|
||||||
|
<td>输出文件名</td>
|
||||||
|
</tr>
|
||||||
|
<tr ms-repeat="testCaseList">
|
||||||
|
<td>{{$index + 1}}</td>
|
||||||
|
<td>{{ el.input }}</td>
|
||||||
|
<td>{{ el.output }}</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@@ -92,7 +95,15 @@
|
|||||||
<div id="testCaseFile">选择文件</div>
|
<div id="testCaseFile">选择文件</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label>提示</label>
|
||||||
|
<textarea id="hint" placeholder="这里输入内容" ms-duplex="hint"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label>来源</label>
|
||||||
|
<input type="text" name="source" class="form-control" ms-duplex="source">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<input type="submit" class="btn btn-success btn-lg" value="发布题目" id="submitBtn">
|
<input type="submit" class="btn btn-success btn-lg" value="发布题目" id="submitBtn">
|
||||||
</div>
|
</div>
|
||||||
@@ -100,4 +111,3 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/app/admin/problem/add_problem.js"></script>
|
<script src="/static/js/app/admin/problem/add_problem.js"></script>
|
||||||
<link href="/static/css/tagEditor/jquery.tag-editor.css" rel="stylesheet">
|
|
||||||
31
template/oj/problem/my_solution.html
Normal file
31
template/oj/problem/my_solution.html
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{% extends 'oj_base.html' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<div class="container main">
|
||||||
|
<ul class="nav nav-tabs nav-tabs-google">
|
||||||
|
<li role="presentation">
|
||||||
|
<a href="problem.html">题目</a></li>
|
||||||
|
<li role="presentation" class="active"><a href="my_solutions_list.html">我的提交</a></li>
|
||||||
|
<li role="presentation"><a href="#">讨论</a></li>
|
||||||
|
</ul>
|
||||||
|
<h2 class="text-center">Battle Over Cities - Hard Version</h2>
|
||||||
|
<p class="text-muted text-center">cpu: 1000ms 内存: 256M</p>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-body">
|
||||||
|
<h4>运行结果:<span class="text-success">Accepted</span></h4>
|
||||||
|
<p>cpu: 1000ms 内存: 256M 语言:python</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="code-field">
|
||||||
|
<textarea id="code-editor">
|
||||||
|
#include <stdio.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
printf("Hello world");
|
||||||
|
return 0;
|
||||||
|
}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
53
template/oj/problem/my_solutions_list.html
Normal file
53
template/oj/problem/my_solutions_list.html
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{% extends 'oj_base.html' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<div class="container main">
|
||||||
|
<ul class="nav nav-tabs nav-tabs-google">
|
||||||
|
<li role="presentation">
|
||||||
|
<a href="/problem/1/">题目</a></li>
|
||||||
|
<li role="presentation" class="active"><a href="my_solutions_list.html">我的提交</a></li>
|
||||||
|
</ul>
|
||||||
|
<h2 class="text-center">Battle Over Cities - Hard Version</h2>
|
||||||
|
<p class="text-muted text-center">cpu: 1000ms 内存: 256M</p>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr class=""success>
|
||||||
|
<th>#</th>
|
||||||
|
<th>提交时间</th>
|
||||||
|
<th>结果</th>
|
||||||
|
<th>运行时间</th>
|
||||||
|
<th>运行内存</th>
|
||||||
|
<th>语言</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="warning">
|
||||||
|
<th scope="row">1</th>
|
||||||
|
<td>1</td>
|
||||||
|
<td>Error Format</td>
|
||||||
|
<td>3</td>
|
||||||
|
<td>3</td>
|
||||||
|
<td>3</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="danger">
|
||||||
|
<th scope="row">2</th>
|
||||||
|
<td>Wrong</td>
|
||||||
|
<td>Wrong Answer</td>
|
||||||
|
<td>@fat</td>
|
||||||
|
<td>3</td>
|
||||||
|
<td>3</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="success">
|
||||||
|
<th scope="row">3</th>
|
||||||
|
<td>Larry</td>
|
||||||
|
<td>Accepted</td>
|
||||||
|
<td>@twitter</td>
|
||||||
|
<td>3</td>
|
||||||
|
<td>3</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -5,18 +5,17 @@
|
|||||||
<ul class="nav nav-tabs nav-tabs-google">
|
<ul class="nav nav-tabs nav-tabs-google">
|
||||||
<li role="presentation" class="active">
|
<li role="presentation" class="active">
|
||||||
<a href="problem.html">题目</a></li>
|
<a href="problem.html">题目</a></li>
|
||||||
<li role="presentation"><a href="my_solutions_list.html">我的提交</a></li>
|
<li role="presentation"><a href="/problem/1/my_solutions/">我的提交</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<h2 class="text-center">Battle Over Cities - Hard Version</h2>
|
<h2 class="text-center">{{ problem.title }}</h2>
|
||||||
|
|
||||||
<p class="text-muted text-center">cpu: 1000ms 内存: 256M</p>
|
<p class="text-muted text-center">发布时间: {{ problem.create_time }} CPU: {{ problem.time_limit }}ms 内存: {{ problem.memory_limit }}M</p>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class="problem-section">
|
<div class="problem-section">
|
||||||
<label class="problem-label">描述</label>
|
<label class="problem-label">描述</label>
|
||||||
|
|
||||||
<p class="problem-detail"> n的阶乘定义为n!=1*2*3*……*n 如3!=6
|
<p class="problem-detail">{{ problem.description|safe }}</p>
|
||||||
n!通常最后会有很多0,如5!=120 最后有一个0,现在统计n!去除末尾的0后,最后k位是多少</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="problem-section">
|
<div class="problem-section">
|
||||||
<label class="problem-label">输入</label>
|
<label class="problem-label">输入</label>
|
||||||
@@ -28,21 +27,43 @@
|
|||||||
|
|
||||||
<p class="problem-detail">第一行包括两个数n,k</p>
|
<p class="problem-detail">第一行包括两个数n,k</p>
|
||||||
</div>
|
</div>
|
||||||
|
{% for item in samples %}
|
||||||
<div class="problem-section">
|
<div class="problem-section">
|
||||||
<label class="problem-label">样例输入</label>
|
<label class="problem-label">样例输入1</label>
|
||||||
<pre title="双击可以复制哦~">
|
|
||||||
1 2 3 4 5 6 7
|
|
||||||
1 2 3 4 5 6 7</pre>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="problem-section">
|
|
||||||
|
|
||||||
<label class="problem-label">样例输出</label>
|
|
||||||
<pre>
|
<pre>
|
||||||
1 2 3 4 5 6 7</pre>
|
{{ item.input }}</pre>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="problem-section">
|
||||||
|
|
||||||
|
<label class="problem-label">样例输出1</label>
|
||||||
|
<pre>
|
||||||
|
{{ item.output }}</pre>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
<div>
|
||||||
|
<button type="button" id="show-more-btn" class="btn btn-info btn-sm">查看隐藏信息</button>
|
||||||
|
</div>
|
||||||
|
{% if problem.hind %}
|
||||||
|
<div class="problem-section hide">
|
||||||
|
<label class="problem-label">提示</label>
|
||||||
|
|
||||||
|
<p class="problem-detail">{{ problem.hint|safe }}</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="problem-section hide">
|
||||||
|
<label class="problem-label">标签</label>
|
||||||
|
|
||||||
|
<p class="problem-detail">
|
||||||
|
{% for tag in problem.tags.all %}
|
||||||
|
<span class="label label-success">{{ tag.name }}</span>
|
||||||
|
{% endfor %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>选择语言</label>
|
<label>选择语言</label>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="radio-inline">
|
<label class="radio-inline">
|
||||||
<input type="radio" name="inlineRadioOptions" value="c" checked> c (gcc 4.8)
|
<input type="radio" name="inlineRadioOptions" value="c" checked> c (gcc 4.8)
|
||||||
@@ -55,6 +76,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="code-field">
|
<div id="code-field">
|
||||||
<label class="problem-label">提交代码</label>
|
<label class="problem-label">提交代码</label>
|
||||||
<textarea id="code-editor"></textarea>
|
<textarea id="code-editor"></textarea>
|
||||||
@@ -89,5 +111,5 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block js_block %}
|
{% block js_block %}
|
||||||
<script src="/static/js/app/oj/problem/submit_code.js"></script>
|
<script src="/static/js/app/oj/problem/problem.js"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user