diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml new file mode 100644 index 000000000..d1d1a0010 --- /dev/null +++ b/.github/workflows/mkdocs.yml @@ -0,0 +1,24 @@ +name: ci +on: + push: + branches: + - v2.0 + paths: + - 'mkdocs.yml' + - 'docs/**' +permissions: + contents: write +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - uses: actions/cache@v4 + with: + key: ${{ github.ref }} + path: .cache + - run: pip install mkdocs-material + - run: mkdocs gh-deploy --force diff --git a/docs/contest-manage.md b/docs/contest-manage.md new file mode 100644 index 000000000..82ad9b163 --- /dev/null +++ b/docs/contest-manage.md @@ -0,0 +1,108 @@ +# Contest Manage + +## `/contests/manage/add` +用於新增比賽 +有以下 Field 要設定 +- Contest Name (最多 50 字) + +## `/contests/\d+/manage/acct` +用於新增參賽者與管理員 +管理員自己不能移除自己 +每次新增完後會按照 acct_id 進行排序 +比賽建立者不能被刪除 (Not Impl) + +當模式為 Approval,如果管理員手動加入等待 approval 的 acct,該acct 將會從 approval list 移除 + +## `/contests/\d+/manage/desc` +Contest Description 分為 + +- 賽前 +- 賽中 +- 賽後 +可以 Preview 內容 (會 Render Markdown 與 LaTex) +(最多 20000 字, NotImpl) + +## `/contests/\d+/manage/general` +有以下 Field 要設定 + +- Contest Name (最多 50 字, NotImpl) +- [Contest Mode](../system#contest-mode) +- Contest Start Time +- Contest End Time (必須 > Contest Start Time) +- [Registration Mode](../system#registration-mode) +- Registration Deadline (必須 <= Contest End Time) +- Submit CD Time (ms) +- Freeze Scoreboard Period (minutes) (必須在 <= Contest End Time - Contest Start Time) +- Is Public Scoreboard +- Enable System Test +- [Allow Compilers](../system#support-compilers) + +當 [Contest Mode](../system#contest-mode) 切換到 ICPC/ACM 時,會有以下行為 +- 可以設定 Penalty Time (minutes),預設為 20 分鐘 +- 將 Submit CD Time 設為 1 秒 +- 將所有題目的 [Score Type](../system#score-type) 改為 ICPC + +當 [Contest Mode](../system#contest-mode) 切換到 IOI 時,會有以下行為 +- 不能設定 Penalty Time +- 將 Submit CD Time 設為 30 秒 +- 將所有題目的 [Score Type](../system#score-type) 改為 IOI2017 + +當 Registration Mode 從 Approval 轉到 Free 時,所有等待 approve 的帳號將會自動通過 + +## `/contests/\d+/manage/pro` +用於新增或刪除題目,只能新增 [ONLINE](../system#problem-status) 與 [CONTEST](../system#problem-status) 狀態的題目 +題目順序按照新增順序排列 + +當 Contest Mode = IOI 時,每個題目可以設定 Score Mode,有 IOI2013 與 IOI2017 +Contest Mode = ICPC 時,Score Mode 固定為 ICPC + +對於每個題目可以設定 Challenge Style +包含以下五種選項 + +- Full +- Testdata [State](../system#challenge-state) Count +- Subtask [State](../system#challenge-state) Count (NotImpl) +- Subtask Only +- Total Only + +當比賽結束後,可以使用 Public Problem,會將題目狀態改為 [ONLINE](../system#problem-status) +Public All Problems 會將所有題目狀態改為 [ONLINE](../system#problem-status) +Rechallenge 會將賽中該題所有 challenge rejudge 一次,但不會跑 rejected (NotImpl) +當 Enable System Test 時,會多出 System Test All 與 System Test 按鈕,只能在 Contest Running Status 為 Ended 時使用 + +### System Test +對於所有 Contest Admin 的 Challenge 不會執行 System Test + +## `/contests/\d+/manage/reg` +Reg有三種模式,分別為 Invited, Free Registration, Registration Approval + +可以 Approve 與 Reject 等待 approve 的帳號 + +## `/contests/\d+/manage/question` +用來回覆參賽者問題 +有提供以下幾個預設回覆內容 + +- Yes +- No +- No comment +- Answered in problem description +- Invalid question + +選擇 Other 可以自行填寫回覆內容 + +已經回覆後可以更新回覆內容,會更新回覆時間 +當參賽者被從 Contest 移除後,該參賽者的所有問題不會被刪除 +當參賽者發問問題後,會收到一個紅點通知 +當管理員回覆問題後,參賽者會收到一個紅點通知,且 Contest Admin 的紅點數量會減一 + +## `/contests/\d+/manage/announce` +用來發布公告 +有兩個 Field 要設定 + +- Subject (最多 50 字) +- Content (最多 256 字) + +對於已發佈的公告,可以進行以下操作 + +- Edit, 會更新公告時間,更新成功後參賽者會收到更新紅點 +- Popup, 會向所有參賽者彈出公告視窗 diff --git a/docs/contest.md b/docs/contest.md new file mode 100644 index 000000000..088569bc9 --- /dev/null +++ b/docs/contest.md @@ -0,0 +1,266 @@ +# Contest + + +## `/index` +Contest 模式下的NavBar 會有以下 Entry + +- Icon +- Info +- ProblemSet +- Challenges +- Scoreboard + +如果是 Contest User 會有以下 Entry + +- Q & A + +如果是 Contest Admin 會有以下 Entry + +- Manage + +當 User 收到 Reply 後,NavBar 會在 Q&A 上面顯示紅點 +當 Admin 公告 Announcement 後,User 的 NavBar 上 Q&A 會顯示紅點 +當 Admin 有新的 Question 時,NavBar 上的 Mange 會顯示紅點 + +## `/contests` +列出所有比賽 +包含以下內容 + +- Title +- Start Time +- End Time +- Time Length +- Contest Type +- Is Public Scoreboard + +依據比賽時間狀態分成四類 +- Active (比賽進行中) +- Upcoming (比賽還沒開始) +- Recent (比賽已經結束) +- Permanent (永久比賽) + +## `/contests/\d+` && `/contests/\d+/info` +顯示 Contest Info +包含以下內容 + +- Title +- Start Time +- End Time +- Registration Deadline +- Registration Mode +- User Registertion Status +- Time Length +- Contest Type +- Is Public Scoreboard +- Contest Description (Support Markdown and LaTex) + +Contest Description 分為 + +- 賽前 +- 賽中 +- 賽後 + +## `/contests/\d+/chal` +Contest標準 + +用來顯示比賽所有 challenge 的 Total Result,不顯示 Response +一頁顯示 20 個筆 Challenges +當頁面中的 challenges 有狀態更新時,會透過 WebSocket 自動更新 +當有新的 challenges 時,最上面會顯示新增幾個 chals (只有 ProblemStatus 是 [ONLINE](../system#problem-status) 或是 [CONTEST](../system#problem-status)) + +### Filter Options + +- Problem ID List: 顯示指定使用者的 challenges +- Account ID List: 顯示指定題目的 challenges +- [state](../system#challenge-state): 可選所有 State +- [Compiler](../system#support-compilers): 可選所有 Compiler +當 state 的 filter 選 Not Started 或是 Challenging 時,下方會出現 rechallenge all 的按鈕,將會 rejudge 該頁面中 chals + +NotImpl +所顯示的 challenges 由以下規則指定 + +| Viewer User Type | Challenge Submitter User Type | Contest Running Status | 是否顯示 | +| ---------------- | ----------------------------- | ---------------------- | -------- | +| Not Member | Contest User | Not Start | 不存在這種情況 | +| Not Member | Contest User | Running | 依照 Public Scoreboard 決定 | +| Not Member | Contest User | Ended | 依照 Public Scoreboard 決定 | +| Not Member | Contest Admin | Not Start | Permission Denied | +| Not Member | Contest Admin | Running | Permission Denied | +| Not Member | Contest Admin | Ended | Permission Denied | +| Contest User | Self | Not Start | 不存在這種情況 | +| Contest User | Self | Running | 顯示 | +| Contest User | Self | Ended | 顯示 | +| Contest User | Other Contest User | Not Start | 不存在這種情況 | +| Contest User | Other Contest User | Running | 依照 Public Scoreboard 決定 | +| Contest User | Other Contest User | Ended | 依照 Public Scoreboard 決定 | +| Contest User | Contest Admin | ANY | Permission Denied | +| Contest Admin | Contest User | Not Start | 不存在這種情況 | +| Contest Admin | Contest User | Running | 顯示 | +| Contest Admin | Contest User | Ended | 顯示 | +| Contest Admin | Contest Admin | ANY | 顯示 | + +## `/contests/\d+/chal/(\d+)` +顯示比賽的 Challenge +規則用 [`/contests/\d+/chal`](#contestsdchal) + +如果 Enable System Test +Subtask Results 不會顯示帶有 `system-test` tag 的 Subtask +Testdata Results 不會顯示帶有 `system-test` tag 的 Testdata + +Contest Admin 不受此影響 +也就是說,Contest Admin 查看 Contest User 的 Challenge 時,會看到 [State 為 Skipped](../system#challenge-state) 的 [Testdata Result](../system#subtask-results) 與 [Subtask Result](../system#subtask-results) + +[Total Result](../system#total-result) 的 Message, [Testdata Results](../system#testdata-results), Code 只能在管理員或是該 Challenge 的上傳者查看時顯示,如果是管理員觀看會有審計log +如果 Code 遺失,則會顯示 `ERROR: The code is lost on the server.` + +依據 [Message Type](../system#message-type) +- NONE: 不顯示任何 Message +- TEXT: 會對 Message 做跳脫 (Escape) +- HTML: 不會對 Message 做跳脫 (Escape) + +按照 Contest 的 [Challenge Style](#challenge-style) 顯示 [Total Result](../system#total-result), [Subtask Results](../system#subtask-results), [Testdata Results](../system#testdata-results) +Contest Admin 永遠使用 [Full Challenge Style](#full) +### Challenge Style +#### Full +與 `/chal/(\d+)` 相同 + +#### Testdata [State](../system#challenge-state) Count +不顯示 [Testdata Results](../system#testdata-results) +只對所有 [Testdata Results](../system#testdata-results) 的 [State](../system#challenge-state) 進行統計 +For Example: +3xAC, 1xWA, 2xTLE + +#### Subtask [State](../system#challenge-state) Count +不顯示 [Testdata Results](../system#testdata-results) +只顯示所有 [Subtask Results](../system#subtask-results) 的 [Testdata Result](../system#testdata-results) [State](../system#challenge-state) 的統計 +For Example: + +- Subtask 1: 2xAC, 1xWA +- Subtask 2: 3xAC +- Subtask 3: 1xTLE, 2xRE + +#### Subtask Only +不顯示 [Testdata Results](../system#testdata-results) + +#### Total Only +不顯示 [Subtask Results](../system#subtask-results) 與 [Testdata Results](../system#testdata-results) + +admin 能透過 reject 功能將特定 challenge 取消評分,且該筆 challenge 直到被取消 rejected 狀態前,不應該被 rechallenge (not impl) + +## `/contests/\d+/pro/(\d+)` +| Viewer User Type | [Problem Status](../system#problem-status) | Contest Running Status | Behavior | +| ---------------- | ------------------------------------------ | ---------------------- | -------- | +| Not Member | ONLINE | ANY | Redirect to std | +| Not Member | CONTEST | ANY | Redirect to std (But Will Get Permission Denied) | +| Not Member | HIDDEN | ANY | 不存在這種情況 | +| Contest User | ONLINE | Not Start | Permission Denied | +| Contest User | ONLINE | Running | Allow | +| Contest User | ONLINE | Ended | Redirect to Std Problem | +| Contest User | CONTEST | Not Start | Permission Denied | +| Contest User | CONTEST | Running | Allow | +| Contest User | CONTEST | Ended | Redirect to Std Problem (But Will Get Permission Denied) | +| Contest User | HIDDEN | ANY | 不存在這種情況 | +| Contest Admin | ONLINE | Not Start | Allow | +| Contest Admin | ONLINE | Running | Allow | +| Contest Admin | ONLINE | Ended | Allow | +| Contest Admin | CONTEST | Not Start | Allow | +| Contest Admin | CONTEST | Running | Allow | +| Contest Admin | CONTEST | Ended | Allow | +| Contest Admin | HIDDEN | ANY | 不存在這種情況 | + +不顯示 TopCoder + +## `/contests/\d+/proset` +| Viewer User Type | [Problem Status](../system#problem-status) | Contest Running Status | Behavior | +| ---------------- | ------------------------------------------ | ---------------------- | -------- | +| Not Member | ANY | ANY | Permission Denied | +| Contest User | ANY | Not Start | Permission Denied | +| Contest User | ANY | Running | Allow | +| Contest User | ONLINE | Ended | Allow, but click problem link will redirect to std problem | +| Contest User | CONTEST | Ended | Allow | +| Contest User | HIDDEN | Ended | 不存在這種情況 | +| Contest Admin | ANY | ANY | Allow | + +依照該題目的 Score Type 顯示該題狀態 (必須要與 Scoreboard 一樣) + +- IOI2013: Best Score or TODO +- IOI2017: Best Score or TODO +- ICPC: Best State or TODO + +| Viewer User Type | Is Public Scoreboard | Freeze Time | Contest Running Status | Behavior | +| ---------------- | -------------------- | ----------- | ---------------------- | -------- | +| Not Member | ANY | ANY | ANY | Permission Denied | +| Contest User | No | ANY | ANY | No AC Ratio | +| Contest User | Yes | Not set | Running | Show AC Ratio | +| Contest User | Yes | Set | Running | Show AC Ratio (Freeze Apply) | +| Contest User | No | ANY | Ended | No AC Ratio | +| Contest User | Yes | ANY | Ended | Show AC Ratio | +| Contest Admin | ANY | ANY | ANY | Show AC Ratio | + +AC Ratio 包含以下內容 + +- Challenge AC Ratio (Challenge AC Count / Challenge Count) +- User AC Ratio (User Challenged AC Count / User Challenged Count) + +題目會按照新增順序排序 + +## `/contests/\d+/reg` + +## `/contests/\d+/scoreboard` +| Viewer User Type | Target User Type | Contest Running Status | Freeze Scoreboard Period | Is Public Scoreboard | 是否顯示 | +| ---------------- | ---------------- | ---------------------- | ------------------------ | -------------------- | -------- | +| Not Member | Contest User | Not Start | ANY | ANY | 不存在這種情況 | +| Not Member | Contest User | Running | Not set | Yes | Allow | +| Not Member | Contest User | Running | Set | Yes | Allow (Freeze Apply) | +| Not Member | Contest User | Running | ANY | No | Permission Denied | +| Not Member | Contest User | Ended | ANY | Yes | Allow | +| Not Member | Contest User | Ended | ANY | No | Permission Denied | +| Not Member | Contest Admin | Not Start | ANY | ANY | Permission Denied | +| Not Member | Contest Admin | Running | ANY | ANY | Permission Denied | +| Not Member | Contest Admin | Ended | ANY | ANY | Permission Denied | +| Contest User | Self | Not Start | ANY | ANY | Contest Not Start | +| Contest User | Self | Running | Not set | ANY | Allow | +| Contest User | Self | Running | Set | ANY | Allow (Freeze Apply) | +| Contest User | Self | Ended | ANY | ANY | Allow | +| Contest User | Other Contest User | Not Start | ANY | ANY | Contest Not Start | +| Contest User | Other Contest User | Running | Not set | Yes | Allow | +| Contest User | Other Contest User | Running | Set | Yes | Allow (Freeze Apply) | +| Contest User | Other Contest User | Running | ANY | No | Permission Denied | +| Contest User | Other Contest User | Ended | ANY | Yes | Allow | +| Contest User | Other Contest User | Ended | ANY | No | Permission Denied | +| Contest User | Contest Admin | ANY | ANY | ANY | Permission Denied | +| Contest Admin | Contest User | Not Start | ANY | ANY | 不存在這種情況 | +| Contest Admin | Contest User | Running | ANY | ANY | Allow | +| Contest Admin | Contest User | Ended | ANY | ANY | Allow | +| Contest Admin | Contest Admin | ANY | ANY | ANY | Allow | + +依照 [Contest Mode](../system#contest-mode) 與 [Score Type](../system#score-type-only-for-ioi) 選擇 [Scoreboard 排名算法](../system#scoreboard-計分算法) + +## `/contests/\d+/submit/(\d+)` +可選 [Compiler](../system#support-compilers) 為該題目允許的 Compiler 與 Contest 允許的 Compiler 的交集 +無法上傳情況 (檢查順序按照下面) + +- 沒有可用的 judge +- 長度大於 3227 或內容為空 +- 不允許的 [Compiler](../system#support-compilers) +- 同一題同一類型的Compiler上傳相同 Code +- 上傳冷卻時間計時尚未結束 (秒數為比賽自訂) + +上傳成功後,會更新上傳冷卻時間與[使用者的 Last Compiler](../system#user-system) + +## `/contests/\d+/qa` +用來發問問題,查看公告與回覆,管理員沒有此頁面 +左側為公告列表,右側為問題列表 +當管理員回覆問題後,參賽者會收到一個紅點通知 + +發問問題有以下 Field 要設定 + +- Subject (最多 50 字) +- Content (最多 256 字) +每次發問後會有冷卻時間 (180 秒) + +| Viewer User Type | Contest Running Status | Read Announcement | Ask Question | +| ---------------- | ---------------------- | ----------------- | ------------- | +| Not Member | ANY | Allow | Permission Denied | +| Contest User | ANY | Allow | Allow | +| Contest Admin | ANY | Allow | Permission Denied | \ No newline at end of file diff --git a/docs/dev-setup.md b/docs/dev-setup.md new file mode 100644 index 000000000..1da06d88d --- /dev/null +++ b/docs/dev-setup.md @@ -0,0 +1,135 @@ +# Development Environment Setup +## Docker +### Install +1. `git clone https://github.com/TFcis/NTOJ` +2. `docker compose -f docker-compose.dev.yml up --watch` +3. 新開一個 Terminal +5. `docker compose -f docker-compose.dev.yml exec -it backend bash` 進到 container 裡面 +6. `./scripts/runserver.sh` +7. 開啟瀏覽器進入 http://localhost:5500,就可以看到 TOJ 了 + +### Dev +可以在 Container 裡面修改檔案,如果要裝 Vim 的話,按照下面步驟 +```sh linenums="1" +apt update -y +apt install vim -y +``` + +也可直接在本機修改檔案,內容會同步到 Container 裡面,是否要重起 Server 取決於修改的檔案是什麼 +```sh linenums="1" +# Ctrl+C 會關閉 Server +./scripts/runserver.sh # 重起 Server +``` + +如果要刪掉 Container 與 Volume 重新執行 + +1. `docker compose -f docker-compose.dev.yml down -v` +2. `docker compose -f docker-compose.dev.yml up --watch` + +如果連 Image 也要刪掉 + +1. `docker compose -f docker-compose.dev.yml down -v --rmi all` +2. `docker compose -f docker-compose.dev.yml up --watch` + +重新 Build Image + +1. `docker compose -f docker-compose.dev.yml up --build --watch` + +進到 Database 裡面 + +1. `cat config.py` 確認 Database 帳號密碼 (預設是帳號 ntoj 密碼 ntoj) +2. `psql -d ntoj -U ntoj -h db` + +清除所有 Redis Cache +```sh linenums="1" +poetry run python3 -c "import redis,config;r=redis.Redis(host=config.REDIS_HOST,port=6379,db=config.REDIS_DB);r.flushall();r.close();" +``` + +執行 Unit Test +```sh linenums="1" +./rununittest.sh +``` + +執行 Integration Test +```sh linenums="1" +./runintegratedtest.sh +``` + +### Note For Windows +一定要用 WSL + +1. WSL 要開 cgroup2, 請參考 https://stackoverflow.com/questions/73021599/how-to-enable-cgroup-v2-in-wsl2 +2. `git clone` 的位置要在 WSL 的 Folder,不能在 Windows 的 Folder,否則檔案無法同步到 Container 裡面 +3. git CRLF 請參考[這篇設定](https://darkcode.top/post/git_lf_crlf/),不然會遇到很多 CRLF 的問題 + +## VM (Installation Script) +### NOTE: 這東西可以不用看了 +### Deploy +#### Pre +1. 去 ubuntu 24.04 或 debian 12 的 VM 或 WSL (TOJ 特別爛,只能在這個上面跑) +2. sudo apt install git tmux python3 python3-pip +3. echo echo "set -g mouse on" > $HOME/.tmux.conf +4. sudo mkdir /srv (理論上 ubuntu 跟 debian 都有) + +#### Deploy Judge +1. cd $HOME +2. git clone https://github.com/tobiichi3227/NTOJ-Judge-Rewrite +3. cd NTOJ-Judge-Rewrite +4. sudo tmux +5. pip3 install tornado cffi --break-system-packages +6. cd src +7. cd default-checker +8. make +9. cd .. + +#### Deploy Backend +1. cd $HOME +2. git clone https://github.com/TFcis/NTOJ +3. cd NTOJ +4. cd scripts +5. cp .env.example .env +6. ./install.sh +7. 跑就對了 +8. cd /srv/ntoj +9. 改 config.py +10. JUDGE_SERVER_LIST 改成 +```py +JUDGE_SERVER_LIST = [ +{'name': '隨便你打', 'url': 'ws://127.0.0.1:2502/judge', 'problems_path': '/srv/ntoj/problem', 'codes_path': '/srv/ntoj/code'} +] +``` +11. 記得存檔 + +### Run Judge +1. cd $HOME/NTOJ-Judge-Rewrite/src +2. tmux +3. python3 server.py + +### Run Backend +1. cd /srv/ntoj +2. tmux +3. ./runserver.sh +4. Ctrl+B D 暫時離開 tmux 或是繼續留在 tmux + +judge 的路徑會在 $HOME/NTOJ-Judge-Rewrite +backend 的路徑會在 /srv/ntoj + +### Dev +改 /srv/ntoj 跟原本 git 的 Code +然後重啟 Backend 即可 +TOJ 就很爛,如果要看 backend 要改 /srv/ntoj,看跑 test 要改原本 git 的地方 + +### 跑 Test +去你原本 Git 的地方 +$HOME/.local/bin/poetry install +$HOME/.local/bin/poetry add coverage requests bs4 playwright +$HOME/.local/bin/poetry run playwright install +cd src +./rununittest.sh +./runintegratedtest.sh +./rune2etest.sh + +### Tmux 教學 +Ctrl+B D 是先按住 Ctrl+B,然後放掉,再按 D,這樣會暫時離開 tmux,裡面的東西會繼續執行 +tmux attach -t 0 可以回到第 0 個 tmux +tmux attach -t 1 以此類推 \ No newline at end of file diff --git a/docs/spec.md b/docs/spec.md new file mode 100644 index 000000000..1a77e11d1 --- /dev/null +++ b/docs/spec.md @@ -0,0 +1,11 @@ +# TOJ Spec + +這個文檔描述了 NTOJ 系統的規範。 + +系統分為以下主要部份: + +- **[System](system.md)** - 系統基礎設施,包括 Judge 系統、Rate 系統、Problem 系統和 Challenge 系統 +- **[Standard](std.md)** - 標準模式的用戶界面和功能 +- **[Standard Manage](std-manage.md)** - 標準模式的管理界面 +- **[Contest](contest.md)** - 比賽模式的用戶界面和功能 +- **[Contest Manage](contest-manage.md)** - 比賽模式的管理界面 diff --git a/docs/std-manage.md b/docs/std-manage.md new file mode 100644 index 000000000..e54c63884 --- /dev/null +++ b/docs/std-manage.md @@ -0,0 +1,267 @@ +# Standard Manage + +更新都會有審計log + +## `/manage/acct` +表格有以下內容 + +- 帳號名稱 +- 帳號Mail +- 最後一次登入的IP +- 指定 IP +- 帳號權限 + +## `/manage/acct/update` +更新 UserType 與 指定 IP +指定 IP 必須為 IPv4 格式 + +## `/manage/board` +顯示所有的 board + +表格有以下內容 + +- Name +- [Board Status](../system#board-type) + +## `/manage/board/add` +新增 board + +有以下 Field 要設定 + +- Name (最多 100 字, NotImpl) +- [Status](../system#board-type) +- Start Time +- End Time (必須 > Start Time) +- Account ID List +- Problem ID List + +## `/manage/board/update` +更新 board + +有以下 Field 要設定 + +- Name (最多 100 字, NotImpl) +- Status +- Start Time +- End Time (必須 > Start Time) +- Account ID List +- Problem ID List + +## `/manage/bulletin` +顯示所有 Bulletin + +表格有以下內容 + +- Title +- Color +- Creator +- Create Timestamp + +如果 bulletin 有標記 pin, 會在 title 最前方加上一個 ICON + +## `/manage/bulletin/add` +有以下 Field 要設定 + +- Title (最多 50 字) +- Title Color (CSS) (最多 64 字, NotImpl) +- Is pinned +- Content (Support Markdown 與 LaTex, 最多 2048 字) + +如果 Title Color 填入空字串,則使用 `white` + +## `/manage/bulletin/update` +有以下 Field 要設定 + +- Title (最多 50 字) +- Title Color (CSS) (最多 64 字, NotImpl) +- Is pinned +- Content (Support Markdown 與 LaTex, 最多 2048 字) + +可以 Preview 內容 (會 Render Markdown 與 LaTex) + +## `/manage/pro` +表格有以下內容 + +- Problem Name +- [Status](../system#problem-status) +- Rechallenge 的按鈕 與 Rechallenge All 的按鈕 + +Rechallenge 僅 rejudge 狀態為 Not Started 與 Challenging 的 challenges +Rechallenge All 會 rejudge 全部的 challenges,需要系統密碼 +上面兩個都會有審計log + +## `/manage/pro/add` +有以下 Field 要設定 + +- Name (最多 64 字) +- [Status](../system#problem-status) +- Add Mode + +### Add Mode +- Upload: 上傳檔案,支援 TOJ 格式的題目包 +- SetupByUI: 透過 UI 設定題目內容,預設會建立一個空的題目 + +## `/manage/pro/update` +有以下 Field 要設定 + +- Name (最多 64 字) +- [Status](../system#problem-status) +- Is Allow Submit +- Tags (只允許 A~Z, a~z, 0~9, ` `, `-`, `_`, `,`, 最多 64 字 NotImpl) + +與 [`/manage/pro`](#managepro) 一樣有 Rejudge 與 Rejudge All 的按鈕 +可以上傳 TOJ 格式的題目包,會完全覆蓋原有題目內容 (如果上傳錯誤的格式,該題目內容會錯誤而被清空,十分危險),只要更新成功後,**該題所有的 challenges 的狀態皆會變成 Not Started (方便 Rechallenge)** + +## `/manage/pro/updatetestdata` +用來更新題目的測資,測資檔案架構由 [Problem Type](../system#problem-system) 決定 +包含以下功能 + +- Preview Single Testdata File (超過 25 行不會顯示) +- Download Single Testdata File +- Add Single Testdata +- Delete Single Testdata +- Update Single Testdata File +- Update Testdata Tags (目前只支援 system-test) + +測資新增與刪除,子任務新增刪除與分數更新,**該題所有的 challenges 的狀態皆會變成 [Not Started](../system#challenge-state) (方便 Rechallenge)** + +TODO: 限制總測資大小與數量 + +## `/manage/pro/updatelimit` +設定題目 [Limit](../system#limit) +包含以下三種 + +- Time Limit (ms) +- Memory Limit (KiB) +- Output Limit (KiB) + +可以設定不同 Compiler 的資源限制,Compiler 會受到題目支援的 Compiler 限制 + +## `/manage/pro/updatesubtask` +用來更新題目的 [Subtask](../system#subtask) +包含以下功能 + +- Add Subtask +- Delete Subtask +- Update Subtask Rate +- Update Testdata (testdata 必須要存在) +- Update Subtask Dependencies (id 必須要存在, 且不能有 Cycle) +- Update Subtask Tags (目前只支援 system-test) + +## `/manage/pro/updatejudge` +取決於 [Problem Type](../system#problem-system) + +## `/manage/pro/filemanager` +用來更新題目的附屬檔案 +包含以下功能 + +- Preview File +- Download File +- Add Single File +- Delete Single File +- Update Single File +- Rename Single File + +有哪些 Folder 取決於 [Problem Type](../system#problem-system) +一定會有 [`http/`](../system#http-content--achievement) + +TODO: 限制總檔案大小與數量 + +## `/manage/proclass` +顯示所有的 Official ProClass + +表格有以下內容 + +- Name +- Type (Public / Hidden) + +## `/manage/proclass/add` +有以下 Field 要設定 + +- Name (最多 50 字) +- [Type](../system#proclass-type) (OFFICIAL_PUBLIC / OFFICIAL_HIDDEN) +- Problem ID List +- Description (最多 2048 字,支援 Markdown 與 LaTex) + +可以 Preview 內容 (會 Render Markdown 與 LaTex) + +## `/manage/proclass/update` +有以下 Field 要設定 + +- Name (最多 50 字) +- [Type](../system#proclass-type) (OFFICIAL_PUBLIC / OFFICIAL_HIDDEN) +- Problem ID List +- Description (最多 2048 字,支援 Markdown 與 LaTex) + +可以 Preview 內容 (會 Render Markdown 與 LaTex) + +## `/manage/question` +顯示所有的有問問題的帳號 + +## `/manage/question/reply` +顯示指定帳號的所有問題 +可以回覆問題,回覆後該帳號會在主頁上看到 Get Reply +第一次回覆按鈕會是 Reply,回覆過就會變成 Re Reply +重複回覆會覆蓋之前的訊息 +回覆內容最多 1024 字 + +## `/manage/judge` +顯示所有設定的 judge 與該 judge 執行 Challenge 的數量 +當頁面中的 judge 有狀態更新時,會透過 WebSocket 自動更新 +disconnect 需要系統密碼 +connect 不需要系統密碼 + +## `/manage/info` +顯示系統資訊,包含以下內容 + +### Git Information +- Git Branch +- Git Commit Hash + +### Database Information +- PostgreSQL Version +- Database Size +- Connected Clients Count +- Run VACUUM ANALYZE 按鈕 + +### Redis Information +- Redis Version +- Connected Clients Count + +### Path and Storage Information +- Installation Path +- Code Folder Path +- Problem Folder Path + +### System Configuation +- Site Title +- Base URL +- Port +- Timezone +- Active WebSocket connection count +- Can See Code User + +### Python Information +- Python Version +- Executable Path +- Package Dependencies + +### OS Information +- System +- Architecture +- System Version +- Uptime +- Service Running Time +- Environment Type (docker-release, docker-dev, installation-script, unknown) + +### Disk Usage Information +- Total Size +- Used Size +- Free Size +- Usage Progress Bar + +### System Resources +- CPU Cores +- CPU Usage +- Memory Total +- Memory Usage Progress Bar \ No newline at end of file diff --git a/docs/std.md b/docs/std.md new file mode 100644 index 000000000..d0f152257 --- /dev/null +++ b/docs/std.md @@ -0,0 +1,393 @@ +# Standard + +## `/index` +NavBar 會有以下 Entry + +- Icon +- Info +- Board +- Challenges +- ProblemSet +- Contests +- Rank +- Make A Wish +- About +- DevInfo +- Reg | Log + +登入以後 Reg | Log 會變成 Leave 與 account name + +如果是 User 會有以下 Entry + +- Question + +如果是 Admin 會有以下 Entry + +- Manage + +當 User 收到 Reply 後,NavBar 會顯示 Get Reply +當 Admin 有新的 Question 時,NavBar 會顯示 New Question +當有新的 Bulletin 時,NavBar 會顯示 New Bulletin + +在 NavBar 下方會顯示 Bulletin List +表格包含以下內容 + +- Title +- Time +- Author + +如果 bulletin 有標記 pin, 會在 title 最前方加上一個 ICON + +## `/about` +關於 TOJ 與 NTOJ 歷年開發者,不按照任何順序排序 +TOJ 包含以下成員 + +- allenwhale +- [LFsWang](https://github.com/LFsWang) +- [PZ Read](https://github.com/pzread) +- [Xiplus](https://github.com/Xi-Plus) + +NTOJ 包含以下成員 + +- [tobiichi3227](https://github.com/tobiichi3227) +- [ccccchhhheeenng](https://github.com/ccccchhhheeenng) +- [LifeAdventurer](https://github.com/LifeAdventurer) +- [blameazu](https://github.com/blameazu) +- [Wonderhoi](https://github.com/linushuan) +- [Yushiuan9499](https://github.com/yushiuan9499) +- [Chen Kai Liu](https://github.com/ChenKaiLiuG) + +## `/acct/(\d+)` +顯示使用者的個人訊息 +包含以下內容 + +- Name +- Motto +- Total Rate && AC Count && AC Rate (Normal Std) +- Problem Matrix (Only Online Problem) +- Photo && Cover + +如果 Photo 沒有設定,預設使用 `https://www.gravatar.com/avatar/{acct_id}?d=identicon&f=y&s=480` + +如果是當前使用者與帳號界面使用者相同,可以前往帳號設定 +如果是管理員,則可前往修改密碼 + +Problem Matrix 會根據題目狀態有不同的顏色 + +## `/acct-config/(\d+)` +有以下 Field 要設定 + +- Name (最多 27 字) +- Photo && Cover (最多 1110 字, NotImpl) +- Motto (最多 100 字) +- Password (最多 1024 字) + +### Login Device +可以檢視登入設備 IP, 時間, UserAgent,並遠端登出該設備 +可以登出所有設備,這時候使用者當前頁面會被強制登出 + +### Password +如果是當前使用者,可以修改密碼,需要輸入當前密碼 +如果是管理員,可以修改密碼,不需要輸入當前密碼,會有審計log + +## `/acct/proclass/(\d+)` +### Add ProClass +有以下 Field 要設定 + +- Name (最多 50 字) +- [Type](../system#proclass-type) (USER_PUBLIC / USER_HIDDEN) +- Problem ID List +- Description (最多 2048 字,支援 Markdown 與 LaTex) + +可以 Preview 內容 (會 Render Markdown 與 LaTex) + +### Update ProClass +有以下 Field 要設定 + +- Name (最多 50 字) +- [Type](../system#proclass-type) (USER_PUBLIC / USER_HIDDEN) +- Problem ID List +- Description (最多 2048 字,支援 Markdown 與 LaTex) + +可以 Preview 內容 (會 Render Markdown 與 LaTex) + +## `/board` +顯示該使用者有權限存取的 board + +| [Viewer User Type](../system#user-level) | [Board Status](../system#board-type) | 是否顯示 | +| ---------------------------------------- | ------------------------------------ | ------- | +| GUEST | ONLINE | Yes | +| GUEST | HIDEEN | No | +| USER | ONLINE | Yes | +| USER | HIDEEN | No | +| KERNEL | ONLINE | Yes | +| KERNEL | HIDDEN | Yes | + +依據 board 時間狀態分成三類 + +- Running +- Future +- Over + +## `/board/(\d+)` +如果 board 已經結束了,會顯示 Over,否則會顯示距離結束還有多久時間 +如果使用者在 board 中,會 highlight 使用者所在的那一行 +每一行會顯示以下內容 + +- Rank +- User Name +- Score +- Each Problem Solved Status (Score / Count of Attempts) + +最後一行會有以下內容 + +- Each Problem Total Solved Status (Total Score / Total Count of Attempts) + +Score 採用 IOI2013 標準計算 + +## `/bulletin/(\d+)` +顯示 + +- 公告的內容, 可以使用 Markdown 與 LaTeX +- 公告者 +- 公告建立時間 + +## `/chal` +用來顯示所有 Challenge 的 [Total Result](../system#total-result),不顯示 Message +一頁顯示 20 個筆 Challenges +當頁面中的 challenges 有狀態更新時,會透過 WebSocket 自動更新 +當有新的 challenges 時,最上面會顯示新增幾個 chals (只有 [ProblemStatus](../system#problem-status) 是 ONLINE) + +### Filter Options +- Account ID List: 顯示指定使用者的 challenges +- Problem ID List: 顯示指定題目的 challenges +- [state](../system#challenge-state): 可選所有 State +- [Compiler](../system#support-compilers): 可選所有 Compiler +當 state 的 filter 選 Not Started 或是 Challenging 時,下方會出現 rechallenge all 的按鈕,將會 rejudge 該頁面中 chals + +所顯示的 challenges 由以下規則指定 + +| [Viewer User Type](../system#user-level) | [Problem Status](../system#problem-status) | 是否顯示 | +| ----- | -------------- | ------ | +| GUEST | ONLINE | 顯示 | +| GUEST | HIDDEN | 不顯示 | +| GUEST | CONTEST | Permission Denied | +| USER | ONLINE | 顯示 | +| USER | HIDDEN | Permission Denied | +| USER | CONTEST | Permission Denied | +| KERNEL | ONLINE | 顯示 | +| KERNEL | HIDDEN | 顯示 | +| KERNEL | CONTEST | Permission Denied | + +## `/chal/(\d+)` +用來顯示指定 Challenge +會顯示 Challenge 的 [Total Result](../system#total-result), [Subtask Results](../system#subtask-results), [Testdata Results](../system#testdata-results), Code +如果 Code 遺失,則會顯示 `ERROR: The code is lost on the server.` +[Total Result](../system#total-result) 的 Message, [Testdata Results](../system#testdata-results), Code 只能在管理員或是該 Challenge 的上傳者查看時顯示,如果是管理員觀看會有審計log + +依據 [Message Type](../system#message-type) +- NONE: 不顯示任何 Message +- TEXT: 會對 Message 做跳脫 (Escape) +- HTML: 不會對 Message 做跳脫 (Escape) + +管理員會有一個 rechallenge 的按鈕,可以 rejudge 該題目,會有審計log +管理員會有一個 reject, 用來取消該 challenge 的評分,並且可以填寫理由,會有審計log +使用者會有一個 report problem 的按鈕,會將該 challenge 與 report 頁面連結起來 + +當 challenge 有狀態更新時,會透過 WebSocket 自動更新 + +## `/code` +用於 chal 看上傳的 Code +能否查看請參考 [`/chal`](#chald) + +## `/log` +用來查詢審計 log,僅管理員 +可以 Filter By LogType + +## `/pack` +用來上傳檔案,僅管理員 + +## `/pro/(\d+)` +用來顯示題目內容 + +| [Viewer User Type](../system#user-level) | [Problem Status](../system#problem-status) | 是否顯示 | +| ----- | -------------- | ------ | +| GUEST | ONLINE | 顯示 | +| GUEST | HIDDEN | Permission Denied | +| GUEST | CONTEST | Permission Denied | +| USER | ONLINE | 顯示 | +| USER | HIDDEN | Permission Denied | +| USER | CONTEST | Permission Denied | +| KERNEL | ONLINE | 顯示 | +| KERNEL | HIDDEN | 顯示 | +| KERNEL | CONTEST | Permission Denied | + +顯示內容包含 + +- Problem ID +- Name +- TopCoder +- [Problem Limit Settings](../system#limit) +- [Problem Subtask Settings](../system#subtask), 不包含 Testdata +- Tags + +如果使用者不是管理員或沒有 AC 該題目,則 tags 不會顯示 +管理員可以修改 tags,會有審計 log + +如果題目同時有 html 與 pdf,html 優先於 pdf + +## `/pro/(\d+)/(.*)` +用來讀取題目放在 `http/` 下面的[檔案](../system#http-content--achievement) +能否查看請參考 [`/pro/(\d+)`](#prod) + +## `/proset` +用來顯示題目,一頁顯示40個 + +| [Viewer User Type](../system#user-level) | [Problem Status](../system#problem-status) | 是否顯示 | +| ---------------------------------------- | ------------------------------------------ | -------- | +| GUEST | ONLINE | 顯示 | +| GUEST | HIDDEN | 不顯示 | +| GUEST | CONTEST | 不顯示 | +| USER | ONLINE | 顯示 | +| USER | HIDDEN | 不顯示 | +| USER | CONTEST | 不顯示 | +| KERNEL | ONLINE | 顯示 | +| KERNEL | HIDDEN | 顯示 | +| KERNEL | CONTEST | 不顯示 | + +每個題目顯示以下內容 + +- User State (取最好的 [State](../system#challenge-state), 如果沒有則顯示 TODO) +- Problem Name +- TopCoder 的 Photo +- User AC Ratio (User Challenged AC Count / User Challenged Count) +- Challenge AC Ratio (Challenge AC Count / Challenge Count) +- 該題目的 Chal Count(上傳次數) / Chal AC Count(上傳AC次數) +- 該題目的 User Count(上傳人數) / User AC Count(AC人數) +- Tags (如果使用者不是管理員或沒有 AC 該題目,則 tags 不會顯示) + +### Filter Options +- ProClass +- Search By Name +- Search By Tags +- Show Only Problme Status = Online (只有在管理員時出現) + +如果使用者不是管理員,則 Search By Tags 只搜索有 AC 的題目的 Tags + +### [Sort](./system#rate-system) +- Challenge AC Ratio (Challenge AC Count / Challenge Count) +- User AC Ratio (User Challenged AC Count / User Challenged Count) +- Challenge Count +- Challenge AC Count +- User Challenged Count +- User Challenged AC Count + +如果選擇 ProClass 後,會出現 Progress Bar 顯示該 ProClass 的完成度 + +### ProClass + +| [Viewer User Type](../system#user-level) | [ProClass Type](../system#proclass-type) | 顯示分類 | +| ---------------------------------------- | ---------------------------------------- | -------- | +| GUEST | OFFICIAL_PUBLIC | Official | +| GUEST | OFFICIAL_HIDDEN | 不顯示 | +| GUEST | USER_PUBLIC | User Shared | +| GUEST | USER_HIDDEN | 不顯示 | +| USER | OFFICIAL_PUBLIC | Official | +| USER | OFFICIAL_HIDDEN | 不顯示 | +| USER | USER_PUBLIC | User Shared | +| USER | USER_HIDDEN | 不顯示 | +| USER (Self) | USER_HIDDEN | My Problem Class | +| KERNEL | OFFICIAL_PUBLIC | Official | +| KERNEL | OFFICIAL_HIDDEN | Official | +| KERNEL | USER_PUBLIC | User Shared | +| KERNEL | USER_HIDDEN | 不顯示 | +| KERNEL (Self) | USER_HIDDEN | My Problem Class | + +顯示以下四個分類 + +- Official (OFFICIAL_PUBLIC, 如果是使用者 UserType = KERNEL 則包含 OFFICIAL_HIDDEN) +- User Shared (USER_PUBLIC) +- My Collected (使用者本人收藏的 ProClass) +- My Problem Class (使用者本人建立的 ProClass, 包含 USER_PUBLIC 與 USER_HIDDEN) + +顯示以下內容 + +- ProClass Name +- Progress (AC Problme Count / Total Problme Count) +- Creator Name (如果 ProClass 是 OFFICIAL_PUBLIC 或 OFFICIAL_HIDDEN,則顯示 Official) +- Collect Button +- Goto~ + +## `/question` +用來向管理員發問題,僅使用者可以使用 +如果問題超過 10 個,較早問的問題將被刪除 +當管理員回覆問題後,在主頁上會顯示 Get Reply +發問內容最多 1024 字 + +## `/rank/(\d+)` +顯示該題所有上傳者排名,一頁顯示 20 個 +Access Permission 與 [`/pro/(\d+)`](#prod) 相同 +顯示內容為 + +- Submitter Name +- Rate ([Total Result](../system#total-result)) +- Runtime ([Total Result](../system#total-result)) +- Memory ([Total Result](../system#total-result)) +- Timestamp ([Total Result](../system#total-result)) + +排序標準為 + +- Rate ([Total Result](../system#total-result)) 降序 +- Runtime ([Total Result](../system#total-result)) 升序 +- Memory ([Total Result](../system#total-result)) 升序 +- Timestamp ([Total Result](../system#total-result)) 升序 +只會計算使用者最好的一次 chal + +## `/report` +用來回報問題 +使用 question 的 API,因此會在 question 頁面中出現 + +## `/sign` +### 登入帳號 +帳號不存在或是密碼錯誤時顯示無法登入 +如果帳號有指定登入 IP,且當前 IP 不在允許範圍內,則無法登入 + +### 註冊新帳號 +有以下 Field 要設定 + +- Email (最多 1024 字, 改成 264 字, NotImpl) +- Password (最多 1024 字) +- Name (最多 27 字) + +Email 在系統中需要唯一不能重複 +重複將無法註冊 + +## `/submit/(\d+)` +用於上傳題目,題目上傳權限與 `/pro/(\d+)` 相同 +會顯示本題可使用的語言選項,並預設使用 last_compiler +如果該題目的 Limit 有設定特定 Compiler 的資源限制,則本次 Submit 使用該資源限制 + +無法上傳情況 (檢查順序按照下面) + +- 沒有可用的 judge +- 上傳內容為空 +- 上傳內容長度大於 3227 +- 不允許的 [Compiler](../system#support-compilers) +- 上傳冷卻時間計時尚未結束 (30秒) + +上傳成功後,會更新上傳冷卻時間與[使用者的 Last Compiler](../system#user-system) + +## `/users` +顯示所有使用者的排名,一頁顯示 20 個 +顯示內容為 + +- Name +- Photo +- AC Problme Count +- AC Ratio (AC Problme Challenge Count / Total Problem Challenge Count) + +排序標準為 + +- Total Rate 降序 +- AC Problme Count 降序 +- AC Ratio 降序 diff --git a/docs/system.md b/docs/system.md new file mode 100644 index 000000000..68bc0c27c --- /dev/null +++ b/docs/system.md @@ -0,0 +1,375 @@ +# System + +## Something Common +ID List 是指 `1, 2, 3`, `1-3, 5-9, 11,10` 這種列表 +時區由系統決定,預設為 UTC+8 + +## User System +### User Level +- GUEST +- USER +- KERNEL + + +- Mail +- Name +- Photo +- Cover +- Motto +- Lastip +- [Last Compiler](#support-compilers) +- ProClass Collection +- Specific IP + +ProClass Collection 範圍是該使用者所能看到的 ProClass + +## Judge System +### Support Compilers +- GCC GNU17 +- Clang C17 +- G++ GNU++17 +- Clang++ C++17 +- Rustc +- CPython +- OpenJDK +- Gas x86_64 Linux with Libc +- Gas x86_64 Linux with Libstdc++ + +## Rate System +用於計算在 Std 的題目與使用者統計資訊 +這邊的使用者包含了 [KERNEL](#user-level) 與 [USER](#user-level) + +- User Total Rate: 該使用者在 Std 中所有 [ONLINE](#problem-status) 題目的 Challenge 的 [Subtask Results](#subtask-results) 中 [State](#challenge-state) 為 AC 的 Rate 的總和 +- User Problem AC Count: 該使用者在 Std 中所有 [ONLINE](#problem-status) 題目中有至少一筆 Challenge 的 [Total Result](#total-result) [State](#challenge-state) 為 AC 的總和 +- Problem Challenge Count: 該題目在 Std 中所有使用者的 Challenge 總和 +- Problem Challenge AC Count: 該題目在 Std 中所有使用者的 Challenge 中 [Total Result](#total-result) [State](#challenge-state) 為 AC 的總和 +- Problem User Challenged Count: 該題目在 Std 中所有使用者中有至少一筆 Challenge 的使用者數量 +- Problem User AC Count: 該題目在 Std 中所有使用者中有至少一筆 Challenge 的 [Total Result](#total-result) [State](#challenge-state) 為 AC 的**使用者數量** +- Problem AC Ratio: Problem Challenge AC Count / Problem Challenge Count +- Problem User AC Ratio: Problem User AC Count / Problem User Challenged Count + +## Rank System + +## Board System +### Board Type +- ONLINE +- HIDDEN + +## ProClass System +### ProClass Type +- OFFICIAL_PUBLIC +- OFFICIAL_HIDEEN +- USER_PUBLIC +- USER_HIDDEN + + +## Problem System +### Problem Status +- ONLINE +- CONTEST +- HIDDEN + +### Limit +- Time Limit (ms) +- Memory Limit (KiB) +- Output Limit (KiB) + +Default 一定要設定 +其他可以設定題目開放的 [Compiler](#support-compilers) + +### Base Testdata +- Tags + +### Subtask +- Testdata +- Rate +- Dependency Subtasks (不會有 Cycle) +- Tags + +什麼是 Cycle, Simple Example + +- Subtask 1 (Depends on 2) +- Subtask 2 (Depends on 3) +- Subtask 3 (Depends on 1) + +這三個 Subtask 構成了一個 Cycle +Cycle 的詳細定義請參考 https://en.wikipedia.org/wiki/Cycle_(graph_theory) + +### HTTP Content / Achievement +放在 `http/`,育社會有 `cont.html` 或是 `cont.pdf` + +### BatchType +最常見的題目類型 + +#### `/manage/pro/updatejudge` +有以下 Field 要設定 + +Compiler Settings + +- Allow Compilers +- Enable Grader +- User Program Additinoal Compile Args + +Checker Configuration + +Checker Type +- diff +- diff-strict +- diff-float, max error 1e-4 +- diff-float, max error 1e-6 +- diff-float, max error 1e-9 +- CMS/TPS Testlib +- Standard Testlib (Polygon) +- IORedir (WIP) +- TOJ (WIP) + +在 Checker Type 為 CMS/TPS Testlib, Standard Testlib, TOJ 時,還需要設定以下內容 + +- Checker Compiler +- Checker Additinoal Compile Args + +在 Checker Type 為 IORedir 時,還需要設定以下內容 + +- Checker Compiler +- Checker Additinoal Compile Args +- IORedir Settings (JSON) + +Summary Configuration + +Summary Type + +- GroupMin +- Overwrite +- Custom + +Judge 需要保證 `GroupMin` 與 CMS 的 `GroupMin` 行為一樣 + +在 Summary Type 為 Custom 時,還需要設定以下內容 + +- Summary Compiler +- Summary Additinoal Compile Args + +Scoring Configuration + +- Score Precision (0 ~ 3) + +#### `/manage/pro/updatetestdata` +更新測資檔案 +由 `.in` 與 `.out` 組成 + +#### `/manage/pro/filemanager` +題目檔案 + +`http` +用於放置題目描述檔案如 cont.html, cont.pdf + +`checker` +當 Checker Type 為 CMS/TPS Testlib, Standard Testlib, IORedir, TOJ 時,用於放置 Checker 程式碼 + +`grader` +當 Enable Grader 時,用於放置 Grader 程式碼 +會根據 Compiler 設定分資料夾 +For Example: +``` +grader/ + c/ + grader.c + cpp/ + grader.cpp + python/ + grader.py +``` + +## Challenge System +### Challenge State +- Accepted (AC): Judge 認為答案完全正確 +- Partial Correct (PC): Judge 認為答案部份正確 +- Wrong Answer (WA): Judge 認為答案錯誤 +- Runtime Error (RE): Judge 過程中遇到 exit status 不為 0 +- Runtime Error Killed by signal (RESIG): Judge 過程中遇到 Signal 錯誤 +- Time Limit Exceeded (TLE): 執行時間超過 [Limit](#limit) +- Memory Limit Exceeded (MLE): 記憶體超過 [Limit](#limit) +- Output Limit Exceeded (OLE): 輸出超過 [Limit](#limit) +- Compile Error (CE): 編譯錯誤 +- Compilation Limit Exceeded (CLE): 編譯超過 Judge 限制 +- Internal Error (IE): Backend 或是 Judge 內部出錯 +- Judge Error (JE): 題目出錯 (Checker, Custom Summary, ......) +- Challenging: Judge 中 +- Not Started: 尚未 Judge +- Skipped: 跳過該 Subtask 或是 Testdata +- Rejected: 被管理員拒絕 + +#### Judge 需要保證只回傳以下 State +- AC +- PC +- WA +- RE +- RESIG +- TLE +- MLE +- OLE +- CE +- CLE +- IE +- JE +- Skipped + +#### 以下 State 是由 Backend 設定的 +- Challenging +- Not Started +- Rejected + +如果上傳的當下 Code 遺失了,則會得到 IE + +### Message Type +- NONE +- TEXT +- HTML + +### Total Result +- Runtime: Challenge 執行時間,依照 Judge 回傳值決定,Backend 無權決定此事,單位為毫秒 +- Memory: Challenge 記憶體消耗,依照 Judge 回傳值決定,Backend 無權決定此事,單位為 KiB +- [State](#challenge-state): Challenge 狀態,依照 Judge 回傳值決定,Backend 無權決定此事 +- Rate: Challenge 分數,由 Judge 回傳值決定,Backend 無權決定此事,依據題目的 Rate Precision 決定小數點位數 +- Message: Challenge 回應,依照 Judge 回傳值決定,Backend 無權決定此事,只有在狀態為 Rejected 時 Backend 才可修改 +- [MessageType](#message-type): Challenge 回應類型,依照 Judge 回傳值決定,Backend 無權決定此事 +- [Compiler](#support-compilers): 使用者上傳的 [Compiler](#support-compilers) +- Problem: 使用者上傳的 Problem +- Account: 使用者上傳的 Account +- Timestamp: 使用者 Submit 當下的 Timestamp +- Challenge ID: 對應的 Challenge ID + +### Subtask Results +- Runtime: 該 Subtask 的執行時間,依照 Judge 回傳值決定,Backend 無權決定此事 +- Memory: 該 Subtask 的記憶體消耗,依照 Judge 回傳值決定,Backend 無權決定此事 +- [State](#challenge-state): 該 Subtask 的狀態, 依照 Judge 回傳值決定,Backend 無權決定此事 +- Rate: 該 Subtask 的分數,由 Judge 回傳值決定,Backend 無權決定此事,[Subtask](#subtask) 的 Rate 僅供 Judge 參考,依據題目的 Rate Precision 決定小數點位數 + +### Testdata Results +- Runtime: 該 Subtask 的執行時間,依照 Judge 回傳值決定,Backend 無權決定此事 +- Memory: 該 Subtask 的記憶體消耗,依照 Judge 回傳值決定,Backend 無權決定此事 +- [State](#challenge-state): 該 Subtask 的狀態, 依照 Judge 回傳值決定,Backend 無權決定此事 +- Message: 該 Testdata 的回應,依照 Judge 回傳值決定,Backend 無權決定此事 +- [MessageType](#message-type): Challenge 回應類型,依照 Judge 回傳值決定,Backend 無權決定此事 + +## Contest System +### Field +- Contest Name +- Contest Creator +- Contest Desc Before Contest +- Contest Desc During Contest +- Contest Desc After Contest +- [Contest Mode](#contest-mode) +- Contest Start Time +- Contest End Time +- [Registration Mode](#registration-mode) +- Registration Deadline +- [Allow Compilers](#support-compilers) +- Submit CD Time +- Penalty Time +- Freeze Scoreboard Period +- Is Public Scoreboard + +### Contest Mode +- IOI +- ACM/ICPC + +### Score Type +- IOI2013 +- IOI2017 +- ICPC + +### Scoreboard 計分算法 +- [IOI2013](#score-type) +- [IOI2017](#score-type) +- [ICPC](#score-type) + +當 [Contest Mode](#contest-mode) 為 IOI 時,[Score Type](#score-type-only-for-ioi) 可以混用 IOI2013 與 IOI2017,不可選 ICPC +當 [Contest Mode](#contest-mode) 為 ACM/ICPC 時,不可選 [Score Type](#score-type-only-for-ioi),排名算法一定是 ICPC + +#### IOI2013 +取該題目該使用者所有 Challenge 的 [Total Result](total-result) rate 最大值用於排名,若同分則排名相同 + + +舉例 +Problem A 有以下 [Subtasks](#subtask) + +- [Subtask](#subtask) 1 (Rate 40) +- [Subtask](#subtask) 2 (Rate 30) +- [Subtask](#subtask) 3 (Rate 20) +- [Subtask](#subtask) 4 (Rate 10) + +User X 有以下 Challenge 的 Total Result + +- [Challenge Total Result 1](#total-result) (Total Rate 60) +- [Challenge Total Result 2](#total-result) (Total Rate 40) + +則 User X 在 Problem A 的分數為 Challenge 1 的 60 與 Challenge 2 的 40 最大值為 60 + +#### IOI2017 +取該題目該使用者所有 Challenge 的 [Subtask Results](../system#subtask-results) rate 聯集用於排名,若同分則排名相同 + + +舉例 +Problem A 有以下 [Subtasks](#subtask) + +- [Subtask](#subtask) 1 (Rate 40) +- [Subtask](#subtask) 2 (Rate 30) +- [Subtask](#subtask) 3 (Rate 20) +- [Subtask](#subtask) 4 (Rate 10) + +User X 有以下 Challenge + +- Challenge 1 + - [Subtask Result 1](#subtask-results) (Rate 40) + - [Subtask Result 2](#subtask-results) (Rate 0) + - [Subtask Result 3](#subtask-results) (Rate 20) + - [Subtask Result 4](#subtask-results) (Rate 0) + +- Challenge 2 + - [Subtask Result 1](#subtask-results) (Rate 0) + - [Subtask Result 2](#subtask-results) (Rate 30) + - [Subtask Result 3](#subtask-results) (Rate 0) + - [Subtask Result 4](#subtask-results) (Rate 10) + +則 User X 在 Problem A 的 Rate 為 Challenge 1 的 40 + 20 與 Challenge 2 的 30 + 10 總和為 100 + +#### ICPC +隊伍以解題數量多者排名較前,解題數量相同時,以總消耗時間少者排名較前。 +答對的題目的消耗時間計算方式為比賽開始至解出題目所消耗的分鐘數。 +如解出前有答錯,除編譯錯誤外,每一次需要另加 Penalty Time 分鐘。 +總消耗時間為所有答對題目的消耗時間加總。 +未答對的題目不計消耗時間。 +如兩隊解題數與耗時相同,則以最後答對題目的 Challenge ID 較小者為勝。 + +### Registration Mode +- Invited +- Free Registration +- Registration Need Approval + +### Contest User Status +- REJECTED +- REQUESTED +- APPROVED +- ADMIN + +Contest Admin 就是 [Contest User Status](#contest-user-status) 為 ADMIN 的帳號 +Contest User 就是 [Contest User Status](#contest-user-status) 為 APPROVED 的帳號 + +### System Test +類似 Codeforces 的系統測試 +在賽中 Contest User Submit 的 Challenge 會受到 System Test 限制,對於有 `system-test` tag 的 [Subtask](#subtask) 與 [Testdata](#base-testdata),其 [Subtask Result](#subtask-results) 與 [Testdata Result](#testdata-results) [State](#challenge-state) 會被標記為 Skipped,不會被 Judge 執行 +Rejudge Contest User Challenge 同樣也是受到 System Test 限制 +而 Contest Admin 的 Challenge 則會全部執行,不管是 Submit 還是 Rejudge + +賽後執行 System Test 時 +只會測試 PreTest [Total Result](#total-result) [State](#challenge-state) 為 AC 的 Challenge (NotImpl) +Contest Admin 的 Challenge 不受 System Test 影響 \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 48f9f7db7..a3e9da450 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -4,8 +4,8 @@ site_author: LifeAdventurer site_url: https://tfcis.github.io/NTOJ # Repository -repo_url: https://github.com/tfcis/NTOJ -repo_name: tfcis/NTOJ +repo_url: https://github.com/TFcis/NTOJ +repo_name: TFcis/NTOJ # Configuration theme: @@ -82,11 +82,17 @@ markdown_extensions: - tables - toc: permalink: true + baselevel: 2 # Page tree nav: - Home: index.md - - Getting started: - - Changelog: changelog.md - - Blog: - - blog/index.md + - Spec: + - System: system.md + - Standard: std.md + - Standard Manage: std-manage.md + - Contest: contest.md + - Contest Manage: contest-manage.md + - Development: + - Development Setup: dev-setup.md + - Code Style: code-style.md \ No newline at end of file