", status=429
)
if not problem.allowed_languages.filter(
id=form.cleaned_data["language"].id
@@ -1064,22 +1072,7 @@ def problem_submit(request, problem, submission=None):
with transaction.atomic():
if profile.current_contest is not None:
- contest = profile.current_contest.contest
contest_id = profile.current_contest.contest_id
- rate_limit = contest.rate_limit
-
- if rate_limit:
- t = last_nth_submitted_date_in_contest(
- profile, contest, rate_limit
- )
- if t is not None and timezone.now() - t < timezone.timedelta(
- minutes=1
- ):
- return HttpResponse(
- _("
- LQDOJ (Le Quy Don Online Judge) là một trang web chấm bài tự động được phát triển dựa trên nền tảng mã nguồn mở DMOJ. Được xây dựng với mục đích ban đầu là tạo ra một môi trường học tập cho học sinh khối chuyên Tin trường THPT chuyên Lê Quý Đôn (TP Đà Nẵng), hiện nay LQDOJ đã cho phép đăng ký tự do để trở thành một sân chơi rộng mở cho toàn bộ cộng đồng học sinh yêu Tin học. Trang web cung cấp lượng bài luyện tập đồ sộ từ các kỳ thi HSG Quốc Gia, ACM ICPC, Olympic Duyên Hải Bắc Bộ, etc. cho đến các contest định kỳ để xếp loại khả năng (rating) giúp các bạn có thêm động lực cạnh tranh và khí thế phấn đấu rèn luyện nâng cao trình độ lập trình. Các bạn có thể tham khảo mã nguồn của trang web tại Github repo chính thức. Mọi ý kiến đóng góp và thắc mắc xin gửi về:
-
+ LQDOJ (Le Quy Don Online Judge) là một trang web chấm bài tự động được phát triển dựa trên nền tảng mã nguồn mở DMOJ. Được xây dựng với mục đích ban đầu là tạo ra một môi trường học tập cho học sinh khối chuyên Tin trường THPT chuyên Lê Quý Đôn (TP Đà Nẵng), hiện nay LQDOJ đã cho phép đăng ký tự do để trở thành một sân chơi rộng mở cho toàn bộ cộng đồng học sinh yêu Tin học. Trang web cung cấp lượng bài luyện tập đồ sộ từ các kỳ thi HSG Quốc Gia, ACM ICPC, Olympic Duyên Hải Bắc Bộ, etc. cho đến các contest định kỳ để xếp loại khả năng (rating) giúp các bạn có thêm động lực cạnh tranh và khí thế phấn đấu rèn luyện nâng cao trình độ lập trình. Các bạn có thể tham khảo mã nguồn của trang web tại Github repo chính thức. Mọi ý kiến đóng góp và thắc mắc xin gửi về:
+
+ Đây là checker mặc định của website, cho phép người dùng cập nhật được nhiều thông tin nhất (chi tiết xem ở bên dưới). Chúng ta cần hoàn thành hàm check dưới đây:
+
Dưới đây là ví dụ cho bài toán: Input gồm 1 số nguyên n. In ra 2 số nguyên a, b sao cho a + b = n.
+
+{{
+"""
+from dmoj.result import CheckerResult
+
+
+def wa(feedback):
+ return CheckerResult(False, 0, feedback)
+
+
+def check(process_output, judge_output, judge_input, **kwargs):
+ # process the input
+ input_arr = judge_input.split()
+ assert(len(input_arr) == 1)
+ n = int(input_arr[0])
+
+ # process the contestant's output
+ output_arr = process_output.split()
+
+ if (len(output_arr) != 2):
+ return wa('Wrong output format')
+
+ try:
+ a, b = int(output_arr[0]), int(output_arr[1])
+ except:
+ return wa('Wrong output format')
+
+ if (n == a + b):
+ return True
+ return wa('a + b != n')
+"""| highlight('py')}}
+
+
+
2. Custom validator (CPP)
+
+
+ Để sử dụng chức năng này, cần viết một chương trình C++ pass vào 3 arguments theo thứ tự input_file, output_file, ans_file tương ứng với các file input, output, đáp án.
+
+
+ Để test chương trình trên máy tính, có thể dùng lệnh như sau (Windows):
+
+main.exe [input_file] [output_file] [ans_file]
+ hoặc thay bằng ./main trên Linux/MacOS.
+
+
Return:
+
+ Chương trình trả về giá trị:
+
+
0 nếu AC (100% điểm)
+
1 nếu WA (0 điểm)
+
2 nếu điểm thành phần. Khi đó cần in ra stderr một số thực trong đoạn [0, 1] thể hiện cho tỷ lệ điểm. Nếu điểm < 1 thì hiển thị WA, điểm = 1 thì hiển thị AC.
+
+ Những thông tin được viết ra stdout (bằng cout) sẽ được in ra màn hình cho người nộp bài(feedback)
+
+
+
Ví dụ:
+
Chương trình sau dùng để chấm bài toán: Cho n là một số nguyên dương. In ra hai số tự nhiên a, b sao cho a + b = n.
+
Nếu in ra a + b = n và a, b >= 0 thì được 100% số điểm, nếu a + b = n nhưng một trong 2 số a, b âm thì được 50% số điểm.
+{{
+"""
+#include
+using namespace std;
+
+int main(int argc, char** argv) {
+ ifstream inp(argv[1]);
+ ifstream out(argv[2]);
+ ifstream ans(argv[3]);
+
+ int n, a, b, c, d;
+
+ inp >> n;
+ out >> a >> b;
+ ans >> c >> d;
+
+ if (a + b == c + d) {
+ cout << a << \" + \" << b << \" = \" << c << \" + \" << d << endl;
+
+ if (a >= 0 && b >= 0) {
+ return 0; // AC
+ }
+ else {
+ cerr << 0.5;
+ return 2; // PARTIAL
+ }
+ }
+ else {
+ cout << \"a + b = \" << a + b << \" != \" << n << endl;
+ return 1; // WA
+ }
+}
+""" | highlight('cpp')}}
+
+
+
3. Interactive (CPP)
+
+
+ Để sử dụng chức năng này, cần viết một chương trình C++ pass vào 2 arguments input_fileanswer_file tương ứng file input và đáp án (nếu cần thiết).
+
+
+ Để test chương trình trên máy tính với tư cách thí sinh, có thể dùng lệnh như sau (Windows):
+
+main.exe [input_file] [answer_file]
+ hoặc thay bằng ./main trên Linux/MacOS.
+
+
Return:
+
+ Chương trình trả về giá trị:
+
+
0 nếu AC (100% điểm)
+
1 nếu WA (0 điểm)
+
2 nếu điểm thành phần. Khi đó cần in ra stderr một số thực trong đoạn [0, 1] thể hiện cho tỷ lệ điểm. Nếu điểm < 1 thì hiển thị WA, điểm = 1 thì hiển thị AC.
+
+ Thông tin được in ra trong stderr (bằng cerr) sẽ là feedback hiển thị cho người dùng.
+
+
+
Ví dụ:
+
Chương trình sau dùng để chấm bài toán guessgame: Người chơi phải tìm 1 số bí mật n (n chứa trong file input). Mỗi lần họ được hỏi một số x, và chương trình sẽ trả về "SMALLER", "BIGGER" hoặc "HOLA" dựa trên giá trị của n và x. Cần tìm ra n sau không quá 31 câu hỏi.
+{{
+"""
+#include
+using namespace std;
+
+void quit(string reason) {
+ cerr << reason << endl;
+ exit(1);
+}
+
+void read(long long& guess) {
+ if (!(cin >> guess)) exit(1); // Nếu không có dòng này, chương trình sẽ chờ vô hạn
+ if (guess < 1 || guess > 2e9) exit(1);
+}
+
+int main(int argc, char *argv[]) {
+ ifstream inp(argv[1]);
+ int N, guesses = 0;
+ long long guess;
+ inp >> N;
+
+ while (guess != N && guesses <= 31) {
+ read(guess);
+ if (guess == N) {
+ cout << \"HOLA\" << endl;
+ } else if (guess > N) {
+ cout << \"SMALLER\" << endl;
+ } else {
+ cout << \"BIGGER\" << endl;
+ }
+ guesses++;
+ }
+ cerr << \"Number of used guesses: \" << guesses << endl;
+ if (guesses <= 31)
+ return 0; // AC
+ else {
+ cerr << \"Used too many guesses\" << endl;
+ return 1; // WA
+ }
+}
+""" | highlight('cpp')}}
+
+{% endblock %}
\ No newline at end of file
diff --git a/templates/actionbar/list.html b/templates/actionbar/list.html
index b02048b..d5ae2b1 100644
--- a/templates/actionbar/list.html
+++ b/templates/actionbar/list.html
@@ -1,62 +1,51 @@
{% set logged_in = request.user.is_authenticated %}
{% set profile = request.profile if logged_in else None %}
-{% set hide_texts_on_mobile = (not hide_actionbar_comment) or actionbar_report_url %}
{% if logged_in %}
- {% if include_hr %}
-
- {% endif %}
-
+ {% set pagevote = post.pagevote %}
+ {% set bookmark = post.bookmark %}
+ {% set hide_actionbar_comment = True %}
+ {% set include_hr = True %}
+ {% set share_url = request.build_absolute_uri(post.get_absolute_url()) %}
+ {% include "actionbar/list.html" %}
-
- {% set pagevote = post.get_or_create_pagevote() %}
- {% set bookmark = post.get_or_create_bookmark() %}
- {% set hide_actionbar_comment = True %}
- {% set include_hr = False %}
- {% set share_url = request.build_absolute_uri(post.get_absolute_url()) %}
- {% include "actionbar/list.html" %}
-
-
-{% endfor %}
-{% include "feed/has_next.html" %}
\ No newline at end of file
+
\ No newline at end of file
diff --git a/templates/blog/dashboard.html b/templates/blog/dashboard.html
index 36a2fa5..7ec50e4 100644
--- a/templates/blog/dashboard.html
+++ b/templates/blog/dashboard.html
@@ -1,34 +1,34 @@
-
Dashboard
-
-
-
-
-
-
-
Recently attempted problems
-
- {% for code, name, problem_points, user_points, s_date in recently_attempted_problems %}
-
+
\ No newline at end of file
diff --git a/templates/chat/message_list.html b/templates/chat/message_list.html
index 3f7e188..cf6c823 100644
--- a/templates/chat/message_list.html
+++ b/templates/chat/message_list.html
@@ -1,10 +1,12 @@
-
{% if object_list %}
-
{{num_pages}}
- {% for message in object_list | reverse%}
+
{{num_pages}}
+{% for message in object_list | reverse%}
{% include "chat/message.html" %}
- {% endfor %}
+{% endfor %}
{% else %}
-
{{_('You are connect now. Say something to start the conversation.')}}
+
{{_('You are connect now. Say something to start the conversation.')}}
{% endif %}
-
+{% if REQUIRE_JAX %}
+ {% include "mathjax-load.html" %}
+{% endif %}
+{% include "comments/math.html" %}
\ No newline at end of file
diff --git a/templates/chat/online_status.html b/templates/chat/online_status.html
index d17b6ff..e090163 100644
--- a/templates/chat/online_status.html
+++ b/templates/chat/online_status.html
@@ -1,61 +1,40 @@
{% endblock %}
\ No newline at end of file
diff --git a/templates/comments/feed.html b/templates/comments/feed.html
index c0fff1d..dcb813a 100644
--- a/templates/comments/feed.html
+++ b/templates/comments/feed.html
@@ -1,22 +1,18 @@
-{% for comment in comments %}
-
\ No newline at end of file
diff --git a/templates/comments/list.html b/templates/comments/list.html
index fc0df78..7cafe3e 100644
--- a/templates/comments/list.html
+++ b/templates/comments/list.html
@@ -1,52 +1,165 @@
{% set can_comment = request.user.is_authenticated and comment_form and not comment_lock %}
+ {% if contest.time_limit %}
+ {% trans trimmed start_time=contest.start_time|date(_("F j, Y, G:i T")), end_time=contest.end_time|date(_("F j, Y, G:i T")), time_limit=contest.time_limit|timedelta('localized-no-seconds') %}
+ {{ time_limit }} window between {{ start_time }} and {{ end_time }}
+ {% endtrans %}
+ {% else %}
+ {% trans trimmed length=contest.contest_window_length|timedelta("localized-no-seconds"), start_time=contest.start_time|date(_("F j, Y, G:i T")) %}
+ {{ length }} long starting on {{ start_time }}
+ {% endtrans %}
+ {% endif %}
+
+ {% if contest.freeze_after and contest.freeze_after + contest.start_time < now %}
+
+ {{_("Standing was frozen")}} {{_("at")}} {{ (contest.freeze_after + contest.start_time) | date(_("F j, Y, G:i T")) }}
+
+ {% endif %}
\ No newline at end of file
diff --git a/templates/contest/contest-list-tabs.html b/templates/contest/contest-list-tabs.html
index 7e0ea63..66e565a 100644
--- a/templates/contest/contest-list-tabs.html
+++ b/templates/contest/contest-list-tabs.html
@@ -1,8 +1,5 @@
\ No newline at end of file
diff --git a/templates/contest/contest-tabs.html b/templates/contest/contest-tabs.html
index b63adae..2da2fee 100644
--- a/templates/contest/contest-tabs.html
+++ b/templates/contest/contest-tabs.html
@@ -1,38 +1,40 @@
+ {% if request.profile in contest.authors.all() or request.profile in contest.curators.all() or request.profile in contest.testers.all() %}
+
+ {% else %}
+
+ {% endif %}
+
{% endblock %}
\ No newline at end of file
diff --git a/templates/list-pages.html b/templates/list-pages.html
index 9f0f428..463797c 100644
--- a/templates/list-pages.html
+++ b/templates/list-pages.html
@@ -1,31 +1,31 @@
- {% if page_obj.has_previous() %}
- {% if page_obj.previous_page_number() == 1 and first_page_href != None %}
-
-
- {% trans id=node.id %}This comment is hidden due to too much negative feedback. Click here to view it.{% endtrans %} -
-