├── api ├── __init__.py ├── views │ ├── __init__.py │ ├── pagination.py │ ├── user.py │ ├── tag.py │ ├── problemlist.py │ ├── problem.py │ └── submission.py ├── migrations │ └── __init__.py └── examples.py ├── blog ├── __init__.py ├── migrations │ └── __init__.py ├── urls.py └── forms.py ├── contest ├── reward.py ├── __init__.py └── migrations │ ├── __init__.py │ ├── 0002_contestinvitation_availability.py │ └── 0003_auto_20211215_1726.py ├── eoj3 ├── __init__.py ├── local_settings.example.py ├── captcha.py └── wsgi.py ├── home ├── __init__.py ├── migrations │ └── __init__.py └── api_views.py ├── paste ├── __init__.py ├── migrations │ └── __init__.py ├── urls.py ├── forms.py └── models.py ├── tests ├── __init__.py └── views.py ├── account ├── __init__.py ├── migrations │ ├── __init__.py │ └── 0002_auto_20210411_1442.py ├── admin.py ├── color.py ├── urls.py └── permissions.py ├── backstage ├── __init__.py ├── blog │ ├── __init__.py │ └── views.py ├── email │ └── __init__.py ├── server │ ├── __init__.py │ └── forms.py ├── site │ ├── __init__.py │ ├── forms.py │ └── views.py ├── account │ ├── __init__.py │ └── forms.py ├── contest │ └── __init__.py ├── migrations │ └── __init__.py └── problem │ └── __init__.py ├── commons └── __init__.py ├── dispatcher ├── __init__.py ├── migrations │ └── __init__.py ├── utils.py └── models.py ├── filemanager ├── __init__.py ├── migrations │ └── __init__.py └── urls.py ├── migrate ├── __init__.py ├── migrations │ └── __init__.py ├── forms.py └── models.py ├── polygon ├── __init__.py ├── contest │ └── __init__.py ├── package │ └── __init__.py ├── problem2 │ ├── __init__.py │ ├── views │ │ └── __init__.py │ └── utils.py ├── tests │ └── __init__.py ├── migrations │ └── __init__.py ├── assets │ └── jplag-2.11.9_SNAPSHOT.jar ├── templates │ └── polygon │ │ ├── problem2 │ │ ├── case │ │ │ ├── update.jinja2 │ │ │ └── create.jinja2 │ │ ├── simple_form.jinja2 │ │ ├── status.jinja2 │ │ ├── template │ │ │ └── preview.jinja2 │ │ ├── package.jinja2 │ │ ├── program │ │ │ └── preview.jinja2 │ │ └── statement │ │ │ └── preview.jinja2 │ │ ├── contest │ │ ├── ghost_import.jinja2 │ │ ├── status.jinja2 │ │ ├── base.jinja2 │ │ └── anticheat.jinja2 │ │ └── runs.jinja2 ├── base_views.py └── urls.py ├── problem ├── __init__.py ├── migrations │ ├── __init__.py │ └── 0002_auto_20201222_1327.py ├── models │ ├── __init__.py │ ├── tag.py │ ├── feedback.py │ ├── skill.py │ └── status.py ├── testlib │ ├── checker │ │ ├── pointscmp.cpp │ │ ├── icmp.cpp │ │ ├── acmp.cpp │ │ ├── rcmp.cpp │ │ ├── dcmp.cpp │ │ ├── rncmp.cpp │ │ ├── yesno.cpp │ │ ├── rcmp6.cpp │ │ ├── rcmp4.cpp │ │ ├── rcmp9.cpp │ │ ├── fcmp.cpp │ │ ├── hcmp.cpp │ │ ├── wcmp.cpp │ │ └── lcmp.cpp │ ├── validator │ │ ├── ival.cpp │ │ ├── sval.cpp │ │ ├── nval.cpp │ │ ├── validate-using-testset-and-group.cpp │ │ ├── bipartite-graph-validator.cpp │ │ └── undirected-graph-validator.cpp │ ├── generator │ │ ├── bgen.cpp │ │ ├── igen.cpp │ │ ├── sgen.cpp │ │ ├── swgen.cpp │ │ ├── multigen.cpp │ │ ├── iwgen.cpp │ │ ├── gen-rooted-tree-graph.cpp │ │ └── gen-tree-graph.cpp │ ├── interactor │ │ └── interactor-a-plus-b.cpp │ └── pack.py └── urls.py ├── scripts ├── __init__.py └── invalidate_problem_stats.py ├── submission ├── __init__.py ├── migrations │ └── __init__.py ├── assets │ └── template.tex └── util.py ├── templates ├── test.jinja2 ├── blank.jinja2 ├── captcha │ ├── hidden_field.html │ ├── text_field.html │ ├── field.html │ └── image.html ├── api │ └── problem.jinja2 ├── account │ ├── preference.jinja2 │ ├── security.jinja2 │ ├── password_reset.jinja2 │ ├── password_reset_done.jinja2 │ ├── password_reset_confirm.jinja2 │ ├── password_reset_email.jinja2 │ ├── migrate.jinja2 │ ├── base.jinja2 │ └── profile.jinja2 ├── comments │ └── comment_reply.jinja2 ├── components │ ├── message.jinja2 │ ├── timeanddate_link.jinja2 │ ├── post_link.jinja2 │ ├── username_display.jinja2 │ ├── delete_confirmation.jinja2 │ ├── search_user.jinja2 │ ├── rsa_encrypt.jinja2 │ ├── modal.jinja2 │ ├── profile_card.jinja2 │ ├── blog_preview.jinja2 │ ├── footer.jinja2 │ └── pagination.jinja2 ├── problem │ ├── status.jinja2 │ ├── detail │ │ ├── discussion.jinja2 │ │ ├── base.jinja2 │ │ └── tag.jinja2 │ ├── source.jinja2 │ ├── reward.jinja2 │ ├── standings.jinja2 │ ├── base.jinja2 │ ├── archive.jinja2 │ └── feedback │ │ └── compare.jinja2 ├── backstage │ ├── index.jinja2 │ ├── email │ │ ├── create.jinja2 │ │ └── list.jinja2 │ ├── server │ │ ├── server_add.jinja2 │ │ └── server_edit.jinja2 │ ├── problem │ │ ├── skill_edit.jinja2 │ │ ├── tags_edit.jinja2 │ │ ├── source_edit.jinja2 │ │ └── skill.jinja2 │ ├── account │ │ ├── school_form.jinja2 │ │ └── school.jinja2 │ ├── site │ │ └── site.jinja2 │ ├── contest │ │ └── contest.jinja2 │ ├── base.jinja2 │ └── blog │ │ └── blog.jinja2 ├── contest │ ├── status.jinja2 │ ├── contest_pdf_statement_notice.jinja2 │ ├── activity │ │ ├── add.jinja2 │ │ ├── admin_add.jinja2 │ │ ├── admin_update.jinja2 │ │ ├── edit.jinja2 │ │ ├── school_form.jinja2 │ │ ├── confirm_complete.jinja2 │ │ ├── confirmation.jinja2 │ │ └── list.jinja2 │ ├── standings_penalty_detail.jinja2 │ ├── reward.jinja2 │ ├── my_status.jinja2 │ ├── contest_ratings.jinja2 │ ├── balloon_detail.jinja2 │ ├── problem.jinja2 │ └── balloon.jinja2 ├── support │ └── feedback.jinja2 ├── blog │ ├── blog_add.jinja2 │ ├── blog_edit.jinja2 │ ├── reward_list.jinja2 │ └── generic.jinja2 ├── taggraph.jinja2 ├── register.jinja2 ├── error │ ├── closed.jinja2 │ ├── 404.jinja2 │ ├── 500.jinja2 │ └── 403.jinja2 ├── login.jinja2 ├── report_download.jinja2 ├── update_log.jinja2 ├── paste │ └── detail.jinja2 ├── print │ └── admin.jinja2 ├── notification │ └── list.jinja2 ├── submission.jinja2 └── base.jinja2 ├── notification ├── __init__.py ├── migrations │ └── __init__.py ├── context_processors │ ├── __init__.py │ └── notification_processor.py ├── urls.py └── views.py ├── static ├── less │ ├── polygon.less │ ├── username.less │ ├── simplemde.less │ ├── app.less │ └── layout.less ├── css │ └── fake.css ├── .bowerrc ├── favicon.ico ├── image │ ├── bg │ │ ├── 1.jpg │ │ ├── 2.jpg │ │ ├── 3.jpg │ │ ├── 4.jpg │ │ ├── 5.jpg │ │ ├── 6.jpg │ │ └── 7.jpg │ ├── error │ │ ├── 403.png │ │ ├── 404.png │ │ ├── 500.png │ │ └── smile.png │ └── avatar │ │ ├── large │ │ ├── ade.jpg │ │ ├── eve.png │ │ ├── joe.jpg │ │ ├── nan.jpg │ │ ├── nom.jpg │ │ ├── tom.jpg │ │ ├── zoe.jpg │ │ ├── cassie.png │ │ ├── chris.jpg │ │ ├── daniel.jpg │ │ ├── elliot.jpg │ │ ├── elyse.png │ │ ├── helen.jpg │ │ ├── jenny.jpg │ │ ├── justen.jpg │ │ ├── kristy.png │ │ ├── laura.jpg │ │ ├── lena.png │ │ ├── mark.png │ │ ├── matt.jpg │ │ ├── molly.png │ │ ├── rachel.png │ │ ├── steve.jpg │ │ ├── stevie.jpg │ │ ├── lindsay.png │ │ ├── matthew.png │ │ ├── patrick.png │ │ ├── veronika.jpg │ │ └── christian.jpg │ │ └── small │ │ ├── ade.jpg │ │ ├── eve.png │ │ ├── joe.jpg │ │ ├── nan.jpg │ │ ├── nom.jpg │ │ ├── tom.jpg │ │ ├── zoe.jpg │ │ ├── cassie.png │ │ ├── chris.jpg │ │ ├── daniel.jpg │ │ ├── elliot.jpg │ │ ├── elyse.png │ │ ├── helen.jpg │ │ ├── jenny.jpg │ │ ├── justen.jpg │ │ ├── kristy.png │ │ ├── laura.jpg │ │ ├── lena.png │ │ ├── mark.png │ │ ├── matt.jpg │ │ ├── molly.png │ │ ├── rachel.png │ │ ├── steve.jpg │ │ ├── stevie.jpg │ │ ├── lindsay.png │ │ ├── matthew.png │ │ ├── patrick.png │ │ ├── veronika.jpg │ │ └── christian.jpg ├── fonts │ ├── FontAwesome.otf │ ├── material-icons.woff2 │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ ├── fontawesome-webfont.woff2 │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── js │ ├── backstage.js │ ├── markdown.js │ ├── longpoll.js │ ├── input.file.js │ └── countdown.js ├── bower.json ├── gulpfile.js └── package.json ├── utils ├── jinja2 │ ├── __init__.py │ └── tests.py ├── middleware │ ├── __init__.py │ ├── close_site_middleware.py │ └── globalrequestmiddleware.py ├── migrations │ ├── __init__.py │ └── 0001_initial.py ├── __init__.py ├── time.py ├── authentication.py ├── serve_nginx.py ├── tagging.py ├── detail_formatter.py ├── debug.py ├── url_formatter.py ├── csv_writer.py ├── multiple_choice_field.py ├── email.py ├── markdown3 │ ├── __init__.py │ ├── semantic.py │ └── mdx_downheader.py ├── language.py ├── upload.py ├── permission.py └── rsa_gen.py ├── locale └── humanize │ └── zh_Hans │ └── LC_MESSAGES │ └── django.mo ├── .gitignore ├── .dockerignore ├── README.md ├── .github └── workflows │ ├── docker-image.yml │ └── pythonapp.yml ├── Dockerfile ├── manage.py ├── pylintrc ├── LICENSE └── docs └── Development.md /api/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /blog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /contest/reward.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /eoj3/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /home/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /paste/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /account/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /api/views/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backstage/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /commons/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /contest/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dispatcher/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /filemanager/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /migrate/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /polygon/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /problem/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /submission/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /templates/test.jinja2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /api/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backstage/blog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backstage/email/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backstage/server/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backstage/site/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /blog/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /home/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notification/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /paste/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /polygon/contest/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /polygon/package/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /polygon/problem2/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /polygon/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/less/polygon.less: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utils/jinja2/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utils/middleware/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utils/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /account/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backstage/account/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backstage/contest/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backstage/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backstage/problem/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /contest/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dispatcher/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /migrate/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /polygon/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /problem/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/css/fake.css: -------------------------------------------------------------------------------- 1 | p { 2 | 3 | } -------------------------------------------------------------------------------- /submission/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /filemanager/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notification/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /polygon/problem2/views/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /templates/blank.jinja2: -------------------------------------------------------------------------------- 1 |
EOJ 后台管理
10 | 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /templates/captcha/field.html: -------------------------------------------------------------------------------- 1 |10 | 密码重置邮件已经发送到你的邮箱,请查收。 11 |
12 | 13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /scripts/invalidate_problem_stats.py: -------------------------------------------------------------------------------- 1 | import progressbar 2 | 3 | from problem.models import Problem 4 | from problem.statistics import invalidate_problem 5 | 6 | 7 | def run(*args): 8 | for problem in progressbar.progressbar(Problem.objects.all()): 9 | invalidate_problem(problem) 10 | -------------------------------------------------------------------------------- /templates/contest/activity/add.jinja2: -------------------------------------------------------------------------------- 1 | {% extends 'base.jinja2' %} 2 | 3 | {% block title %}Activities - {% endblock %} 4 | 5 | {% block page_header %}Add an activity{% endblock %} 6 | 7 | {% block content %} 8 | 9 | {% include 'components/form.jinja2' %} 10 | 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /templates/contest/activity/admin_add.jinja2: -------------------------------------------------------------------------------- 1 | {% extends 'base.jinja2' %} 2 | 3 | {% block title %}Activities - {% endblock %} 4 | 5 | {% block page_header %}Add a user{% endblock %} 6 | 7 | {% block content %} 8 | 9 | {% include 'components/form.jinja2' %} 10 | 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /static/less/simplemde.less: -------------------------------------------------------------------------------- 1 | .CodeMirror-fullscreen { 2 | z-index: 109 !important; 3 | } 4 | 5 | .editor-toolbar.fullscreen { 6 | z-index: 109 !important; 7 | } 8 | 9 | .CodeMirror:not(.CodeMirror-fullscreen) { 10 | min-height: 200px !important; 11 | height: 300px !important; 12 | } 13 | -------------------------------------------------------------------------------- /templates/contest/activity/admin_update.jinja2: -------------------------------------------------------------------------------- 1 | {% extends 'base.jinja2' %} 2 | 3 | {% block title %}Activities - {% endblock %} 4 | 5 | {% block page_header %}Update a user{% endblock %} 6 | 7 | {% block content %} 8 | 9 | {% include 'components/form.jinja2' %} 10 | 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /templates/contest/activity/edit.jinja2: -------------------------------------------------------------------------------- 1 | {% extends 'base.jinja2' %} 2 | 3 | {% block title %}Activities - {% endblock %} 4 | 5 | {% block page_header %}Update an activity{% endblock %} 6 | 7 | {% block content %} 8 | 9 | {% include 'components/form.jinja2' %} 10 | 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /templates/contest/activity/school_form.jinja2: -------------------------------------------------------------------------------- 1 | {% extends 'base.jinja2' %} 2 | 3 | {% block title %}Add a school - {% endblock %} 4 | 5 | {% block page_header %}Add a school{% endblock %} 6 | 7 | {% block content %} 8 | 9 | {% include 'components/form.jinja2' %} 10 | 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /utils/serve_nginx.py: -------------------------------------------------------------------------------- 1 | from django.http import HttpResponse 2 | from django.utils.http import urlquote 3 | 4 | def serve_with_nginx(request, path, root_name=None): 5 | response = HttpResponse() 6 | response['X-Accel-Redirect'] = "/fake/{0}/{1}".format(root_name, urlquote(path)) 7 | return response 8 | -------------------------------------------------------------------------------- /problem/models/tag.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | from tagging.models import Tag 4 | 5 | 6 | class TagInfo(models.Model): 7 | tag = models.OneToOneField(Tag, on_delete=models.CASCADE) 8 | description = models.TextField(blank=True) 9 | parent_id = models.IntegerField(default=-1) 10 | -------------------------------------------------------------------------------- /templates/captcha/image.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% spaceless %} 3 | {% if audio %}{% endif %} 4 |EOJ is currently closed due to maintenance or running contests.
9 |Please try again later or see contests running here.
10 |请确认支付 {{ price | round(1) }} EMB 以获取提交 #{{ submission }}的评测报告。
9 | 14 | 15 | {% endblock %} -------------------------------------------------------------------------------- /utils/url_formatter.py: -------------------------------------------------------------------------------- 1 | def url_linker(host, port, path): 2 | if not host.startswith('http'): 3 | if host.startswith('//'): 4 | host = 'http:' + host 5 | else: 6 | host = 'http://' + host 7 | if not path.startswith('/'): 8 | path = '/' + path 9 | return host + ':' + str(port) + path 10 | 11 | 12 | def upload_linker(host, port, pid): 13 | return url_linker(host, port, 'upload/%s' % str(pid)) 14 | 15 | 16 | def judge_linker(host, port): 17 | return url_linker(host, port, 'judge') 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # junk files 2 | [Tt]humbs.db 3 | *.DS_Store 4 | .idea/ 5 | __pycache__/ 6 | .vscode 7 | 8 | # Database 9 | *.sqlite3 10 | *.sqlite 11 | 12 | # ignore datadir 13 | data/ 14 | upload/ 15 | testdata/ 16 | cases/ 17 | generate/ 18 | media/ 19 | repo/ 20 | logs/ 21 | 22 | # local settings 23 | local_settings.py 24 | 25 | # dev env 26 | init.bat 27 | 28 | # library 29 | cdn/ 30 | node_modules/ 31 | bower_components/ 32 | venv/ 33 | package-lock.json 34 | 35 | # generated css 36 | app.css 37 | app.min.css 38 | -------------------------------------------------------------------------------- /contest/migrations/0002_contestinvitation_availability.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2021-12-15 17:01 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('contest', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='contestinvitation', 15 | name='availability', 16 | field=models.IntegerField(default=1), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /migrate/forms.py: -------------------------------------------------------------------------------- 1 | from captcha.fields import CaptchaField 2 | from django import forms 3 | 4 | 5 | class MigrateForm(forms.Form): 6 | is_new = forms.ChoiceField(label='注册时间', choices=( 7 | ('old', '在 2017 年二月之前在旧 EOJ 中注册'), 8 | ('new', '在 2017 年五月之后在新 EOJ 中注册') 9 | )) 10 | username = forms.CharField(label='你想要注销掉的用户名', max_length=224, required=True) 11 | password = forms.CharField(label='那个账户的密码', widget=forms.PasswordInput, max_length=224, required=True) 12 | captcha = CaptchaField(label="小学数学题") 13 | -------------------------------------------------------------------------------- /templates/components/username_display.jinja2: -------------------------------------------------------------------------------- 1 | {{ username }} {% if ghost %}{% endif %}{% if in_contest %}{% elif legend %}{% endif %} 2 | -------------------------------------------------------------------------------- /api/views/tag.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from django.http import HttpResponse 4 | from tagging.models import TaggedItem 5 | 6 | from problem.models import Problem 7 | 8 | 9 | def return_problems(request): 10 | if request.method == "GET": 11 | tag = request.GET.get("tag", default="tree") 12 | queryset = TaggedItem.objects.get_by_model(Problem, tag) 13 | problem_id_dic = {"problems": list(queryset.values_list("id", flat=True))} 14 | return HttpResponse(json.dumps(problem_id_dic), content_type="application/json") 15 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # junk files 2 | [Tt]humbs.db 3 | *.DS_Store 4 | .idea/ 5 | __pycache__/ 6 | .vscode 7 | 8 | # Database 9 | *.sqlite3 10 | *.sqlite 11 | 12 | # ignore datadir 13 | data/ 14 | upload/ 15 | testdata/ 16 | cases/ 17 | generate/ 18 | media/ 19 | repo/ 20 | logs/ 21 | 22 | # local settings 23 | local_settings.py 24 | 25 | # dev env 26 | init.bat 27 | 28 | # library 29 | cdn/ 30 | node_modules/ 31 | bower_components/ 32 | venv/ 33 | package-lock.json 34 | 35 | # generated css 36 | app.css 37 | app.min.css 38 | 39 | Dockerfile -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ECNU Online Judge 2 | 3 | ## 常见问题 4 | 5 | 没有文档。 6 | 7 | 对华东师范大学本科 / 硕博感兴趣的:https://acm.ecnu.edu.cn/ 8 | 9 | 受 policy 影响时不时会上不去,可以尝试备用域名:https://eoj.i64d.com/ 10 | 11 | 如果只是为了做题,有很多更好的 OJ 可以用。 12 | 13 | 想要部署本 OJ 的,建议不要做这种没有前途的浪费人生的事情。世界很大,有很多更好的 OJ 可以用。 14 | 15 | **For international readers:** We don't provide documentation/software for international users any more. 16 | 17 | ## 重构计划 18 | 19 | 因为野鸡群主要毕业,重构可能要鸽鸽了。 20 | 21 | ## 联系我们 22 | 23 | 如果以上说明没能解决你的困惑,可以加入野鸡群主自建群 691713742。入群问题答案不带空格。群里大多数时间都没人说话,说话也跟 OJ 没啥关系。 24 | -------------------------------------------------------------------------------- /contest/migrations/0003_auto_20211215_1726.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2.10 on 2021-12-15 17:26 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('contest', '0002_contestinvitation_availability'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='contestinvitation', 15 | name='availability', 16 | field=models.PositiveIntegerField(default=1), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /problem/testlib/checker/acmp.cpp: -------------------------------------------------------------------------------- 1 | #include "testlib.h" 2 | #include是否确定删除?该操作可能无法撤销。
8 || Language | 8 |{{ template.get_language_display() }} | 9 |
| Template | 12 |{{ template.template_code_as_html | safe }} | 13 |
| Grader | 16 |{{ template.grader_code_as_html | safe }} | 17 |
22 | | 名称 | 9 |# | 10 |
|---|---|
| 16 | {{ source.source }} 17 | | 18 |{{ source.count }} | 19 |
22 |
22 | 你的排名:{{ my_rank }}
6 | 7 || # | 11 |12 | | 解决 | 13 |EMB | 14 |
|---|---|---|---|
| {{ page_obj.start_index() + loop.index0 }} | 20 |{{ username_display(rank) }} | 21 |{{ rank.solved }} | 22 |{{ rank.score | round(1) }} | 23 |
| # | 11 |When | 12 |Status | 13 |Label | 14 |Message | 15 |
|---|---|---|---|---|
| {{ run.id }} | 21 |{{ run.create_time | date('Y-m-d H:i:s') }} | 22 |{{ run.get_status_display() }} | 23 |{{ run.label }} | 24 |Reveal | 25 |
{{ participant.real_name }},您好!
2 | 3 |感谢报名参加 {{ activity.title }}。
4 | 5 | {% if participant.is_deleted %} 6 |您已放弃这次比赛。您收到这封邮件是为了确认您的「放弃」操作。如果存疑,请联系下面的邮箱。
7 | {% endif %} 8 | 9 | {{ activity.description | markdown | safe }} 10 | 11 |您提供的报名信息如下:
12 | 13 |请尽快点击下面的确认链接确认报名!逾期未确认视为自动放弃。
24 | 25 | 26 | 27 |如果上述报名信息有误,请联系:acmsupport@admin.ecnu.edu.cn。
28 | 29 |EOJ Team
30 | -------------------------------------------------------------------------------- /static/less/app.less: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | @import '../node_modules/semantic-ui-less/semantic'; 3 | @import 'homepage'; 4 | @import 'layout'; 5 | @import 'typography'; 6 | @import 'problem'; 7 | @import 'code'; 8 | @import 'simplemde'; 9 | @import 'heatmap'; 10 | @import 'username'; 11 | 12 | // typed.js 13 | .typed-cursor { 14 | opacity: 1; 15 | -webkit-animation: blink 0.7s infinite; 16 | -moz-animation: blink 0.7s infinite; 17 | -ms-animation: blink 0.7s infinite; 18 | -o-animation: blink 0.7s infinite; 19 | animation: blink 0.7s infinite; 20 | } 21 | 22 | .float-right { 23 | float: right !important; 24 | } 25 | 26 | // problem 27 | 28 | .property { 29 | p:first-child { 30 | margin-top: 1rem; 31 | } 32 | p:not(:last-child) { 33 | margin-bottom: .2rem; 34 | } 35 | } 36 | 37 | .blog-like-link { 38 | cursor: pointer; 39 | display: inline-block; 40 | margin: 0 .75em 0 0; 41 | color: rgba(0, 0, 0, .4); 42 | font-size: .875em; 43 | } -------------------------------------------------------------------------------- /api/views/problem.py: -------------------------------------------------------------------------------- 1 | from django.template import loader, Context 2 | from rest_framework import serializers 3 | from rest_framework.generics import RetrieveAPIView 4 | 5 | from problem.models import Problem 6 | 7 | 8 | class ProblemSerializer(serializers.ModelSerializer): 9 | class Meta: 10 | model = Problem 11 | fields = ("id", "title", "tags", "statement", "level", "ac_user_count", "total_user_count", "ac_count", 12 | "total_count", "reward") 13 | 14 | tags = serializers.SerializerMethodField() 15 | statement = serializers.SerializerMethodField() 16 | 17 | def get_tags(self, problem): 18 | return [tag.name for tag in problem.tags] 19 | 20 | def get_statement(self, problem): 21 | t = loader.get_template('api/problem.jinja2') 22 | return t.render(Context({"problem": problem})) 23 | 24 | 25 | class ProblemView(RetrieveAPIView): 26 | queryset = Problem.objects.filter(visible=True) 27 | serializer_class = ProblemSerializer 28 | -------------------------------------------------------------------------------- /static/js/longpoll.js: -------------------------------------------------------------------------------- 1 | function longPoll(url, callback, restInterval, stopCondition, timeout) { 2 | // when stopCondition(something) is true, callback will be called and no more poll request 3 | $.ajax({ 4 | url: url, 5 | dataType: "json", 6 | success: function (data) { 7 | if (stopCondition(data)) { 8 | callback(data); 9 | } else { 10 | setTimeout(function () { 11 | longPoll(url, callback, restInterval, stopCondition, timeout); 12 | }, restInterval); 13 | } 14 | }, 15 | timeout: timeout || 30000 16 | }); 17 | } 18 | 19 | function longPollUntilForever(url, callback, restInterval, timeout) { 20 | $.ajax({ 21 | url: url, 22 | success: callback, 23 | dataType: "json", 24 | complete: function () { 25 | setTimeout(function () { 26 | longPollUntilForever(url, callback, restInterval, timeout); 27 | }, restInterval); 28 | }, 29 | timeout: timeout || 30000 30 | }); 31 | } -------------------------------------------------------------------------------- /utils/middleware/globalrequestmiddleware.py: -------------------------------------------------------------------------------- 1 | import threading 2 | 3 | 4 | class GlobalRequestMiddleware(object): 5 | _threadmap = {} 6 | 7 | def __init__(self, get_response): 8 | self.get_response = get_response 9 | 10 | def __call__(self, request): 11 | self.process_request(request) 12 | response = self.get_response(request) 13 | return self.process_response(request, response) 14 | 15 | @classmethod 16 | def get_current_request(cls): 17 | return cls._threadmap[threading.get_ident()] 18 | 19 | def process_request(self, request): 20 | self._threadmap[threading.get_ident()] = request 21 | 22 | def process_exception(self, request, exception): 23 | try: 24 | del self._threadmap[threading.get_ident()] 25 | except KeyError: 26 | pass 27 | 28 | def process_response(self, request, response): 29 | try: 30 | del self._threadmap[threading.get_ident()] 31 | except KeyError: 32 | pass 33 | return response 34 | -------------------------------------------------------------------------------- /templates/blog/generic.jinja2: -------------------------------------------------------------------------------- 1 | {# has a weird name; it means personal profile... #} 2 | {# UPD: this is a personal blog page now #} 3 | 4 | {% extends 'base.jinja2' %} 5 | {% from 'components/profile_card.jinja2' import profile_card with context %} 6 | {% from 'components/blog_preview.jinja2' import blog_preview %} 7 | 8 | {% block title %}博客 - {% endblock %} 9 | 10 | {% block page_header %}{{ profile.get_username_display() }}{% endblock %} 11 | 12 | {% block content %} 13 | 14 || 14 | 15 | Add School 16 | 17 | | 18 ||||
|---|---|---|---|
| {{ school.pk }} | 24 |{{ school.name }} | 25 |{{ school.abbr }} | 26 |{{ school.alias }} | 27 |
| 创建时间 | 13 |类型 | 14 |优先级 | 15 |Polygon | 16 |内容 | 17 |签名 | 18 |
|---|---|---|---|---|---|
| {{ log.create_time | date('Y-m-d H:i:s') }} | 24 |{{ log.get_log_type_display() }} | 25 |{{ log.get_priority_display() }} | 26 |{{ log.is_about_polygon }} | 27 |{{ log.content }} | 28 |{% if log.created_by %}{{ username_display(log.created_by) }}{% endif %} | 29 |
| 用户名 | 16 |积分 | 17 |
|---|---|
| {{ username_display(rating_user) }} | 23 |{{ rating_user.rating }} | 24 |
这是你第 {{ user.username_change_attempt + 1 }} 次修改用户名的尝试,这将会消耗 {{ (user.username_change_attempt ** 2) * 100 }} EMB.
27 |
10 | * result = rnd.next(1, 1000000);
11 | * for (int i = 0; i < weight; i++)
12 | * result = max(result, rnd.next(1, 1000000));
13 | *
14 | *
15 | * If parameter "weight" < 0 then you can think about it as code like this:
16 | *
17 | * result = rnd.next(1, 1000000);
18 | * for (int i = 0; i < -weight; i++)
19 | * result = min(result, rnd.next(1, 1000000));
20 | *
21 | *
22 | * It is typical behaviour of "wnext" methods to use this strategy to
23 | * generate off-center random distribution.
24 | */
25 |
26 | #include "testlib.h"
27 | #include | Key | 16 |Value | 17 |
|---|---|
| {{ settings.key }} | 23 |{{ settings.val }} | 24 |
| User | 28 |Limit | 29 |Created | 30 |
|---|---|---|
| {{ manager.user.username }} | 36 |{{ manager.limit }} | 37 |{{ manager.create_time | date('Y-m-d H:i:s') }} | 38 |
| Name | 8 |{{ program.name }} | 9 |
| Language | 12 |{{ program.get_lang_display() }} | 13 |
| Tag | 16 |{{ program.get_tag_display() }} | 17 |
| Created | 20 |{{ program.create_time | date("Y-m-d H:i:s") }} | 21 |
| Updated | 24 |{{ program.update_time | date("Y-m-d H:i:s") }} | 25 |
| Fingerprint | 28 |{{ program.fingerprint }} | 29 |
| Based on | 32 |{% if program.parent_id %}{{ program.parent_id }}{% endif %} | 33 |
| Code | 36 |{{ program.code_as_html | safe }} | 37 |
| # | 17 |Name | 18 |Register Open | 19 |Register Closed | 20 | {#Participants | #} 21 |
|---|---|---|---|---|
| {{ activity.pk }} | 27 |{{ activity.title }} | 28 |{{ activity.register_start_time | date("Y-m-d H:i") }} | 29 |{{ activity.register_end_time | date("Y-m-d H:i") }} | 30 | {#× {{ activity.participants__count }} | #} 31 |