This repository was archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Contests
gedorinku edited this page May 12, 2018
·
10 revisions
- 🔒コンテストを作成
- コンテストを取得
- 🔒コンテストを更新
- 🔒コンテストに参加
- 🔒 コンテストに問題を追加
- 🔒 コンテストの問題を取得
- 🔒 ランキングを取得
- 🔒 提出一覧を取得
- 🔒 最新の自分の提出の状態を取得する
writers
に指定したユーザーとコンテストを作ったユーザーは、コンテストとコンテストの問題を編集できるようになる。自分は自動的にwriters
に追加される。
POST /contests
Content-Type: application/json
{
"title": "タイトル",
"description": "説明",
"startAt": "2018-01-14T13:00:00+09:00",
"endAt": "2018-01-14T15:00:00+09:00",
"writers": [
{
"id": 1
}
]
}
201 Created
Content-Type: application/json
{
"id": 9,
"createdAt": "2018-01-27T15:50:20.336413+09:00",
"updatedAt": "2018-01-27T15:50:20.336413+09:00",
"title": "タイトル",
"description": "説明",
"startAt": "2018-01-14T13:00:00+09:00",
"endAt": "2018-01-14T15:00:00+09:00",
"writers":[
{
"id": 1,
"name": "hoge",
"displayName": "hoge",
"authority": 0
},
{
"id": 2,
"name": "admin",
"displayName": "admin",
"authority": 1
}
],
"participants":[
]
}
GET /contests/:id
200 OK
Content-Type: application/json
{
"id": 9,
"createdAt": "2018-01-27T15:50:20.336413+09:00",
"updatedAt": "2018-01-27T15:50:20.336413+09:00",
"title": "タイトル",
"description": "説明",
"startAt": "2018-01-14T13:00:00+09:00",
"endAt": "2018-01-14T15:00:00+09:00",
"writers":[
{
"id": 1,
"name": "hoge",
"displayName": "hoge",
"authority": 0
},
{
"id": 2,
"name": "admin",
"displayName": "admin",
"authority": 1
}
],
"participants":[
]
}
PUT /contests/:id
Content-Type: application/json
{
"title": "タイトル",
"description": "説明",
"startAt": "2018-01-14T13:00:00+09:00",
"endAt": "2018-01-14T15:00:00+09:00",
"writers": [
{
"id": 1
}
]
}
200 OK
Content-Type: application/json
{
"id": 9,
"createdAt": "2018-01-27T15:50:20.336413+09:00",
"updatedAt": "2018-01-27T15:50:20.336413+09:00",
"title": "タイトル",
"description": "説明",
"startAt": "2018-01-14T13:00:00+09:00",
"endAt": "2018-01-14T15:00:00+09:00",
"writers":[
{
"id": 1,
"name": "hoge",
"displayName": "hoge",
"authority": 0
},
{
"id": 2,
"name": "admin",
"displayName": "admin",
"authority": 1
}
],
"participants":[
]
}
POST /contests/:id/enter
200 OK
Content-Type: application/json
{
"id": 9,
"createdAt": "2018-01-27T15:50:20.336413+09:00",
"updatedAt": "2018-01-27T15:50:20.336413+09:00",
"title": "タイトル",
"description": "説明",
"startAt": "2018-01-14T13:00:00+09:00",
"endAt": "2018-01-14T15:00:00+09:00",
"writers":[
{
"id": 1,
"name": "admin",
"displayName": "admin",
"authority": 1
}
],
"participants":[
{
"id": 2,
"name": "hoge",
"displayName": "hoge",
"authority": 0
}
]
}
コンテストのwriterはコンテストに問題を追加することができます。 問題 - 問題を作成 も参照してください
POST /contests/:contestID/problems/new
Content-Type: application/json
{
"title": "タイトル",
"body": "問題文",
"inputFormat": "入力形式",
"outputFormat": "出力形式",
"constraints": "制約",
"samples": [
{
"input": "入力例",
"output": "出力例"
}
],
"timeLimit": 1000000000,
"memoryLimit": 256,
"judgeType": 0,
"judgeSourceCode": ""
}
201 Created
Content-Type: application/json
{
"id": 1,
"createdAt": "2014-08-25T00:00:00+09:00",
"updatedAt": "2014-08-25T00:00:00+09:00",
"writer": {
"id": 1,
"name": "hoge",
"displayName": "ほげ",
"authority": 0
},
"title": "タイトル",
"body": "問題文",
"inputFormat": "入力形式",
"outputFormat": "出力形式",
"constraints": "制約",
"samples": [
{
"input": "入力例",
"output": "出力例"
}
],
"timeLimit": 1000000000,
"memoryLimit": 256,
"judgeType": 0,
"judgeSourceCode": "",
"contestID": 0
}
GET /contests/:contestID/problems
200 OK
Content-Type: application/json
[
{
"id": 1,
"createdAt": "2018-01-06T20:32:38+09:00",
"updatedAt": "2018-01-06T20:32:38+09:00",
"writer": {
"id": 1,
"name": "hoge",
"displayName": "ほげ",
"authority": 0
},
"title": "タイトル",
"body": "問題文",
"inputFormat": "入力形式",
"outputFormat": "出力形式",
"constraints": "制約",
"samples": [
{
"input": "入力例",
"output": "出力例"
}
],
"caseSets":[
{
"id": 1,
"createdAt": "2018-01-06T20:32:38+09:00",
"updatedAt": "2018-01-06T20:32:38+09:00",
"problemID": 1,
"point": 0
}
],
"timeLimit": 1000000000,
"memoryLimit": 256,
"judgeType": 0,
"judgeSourceCode": "",
"contestID": 1
}
]
GET /contests/:contestID/standings
200 OK
Content-Type: application/json
[{
"id": 1,
"createdAt": "2018-03-03T22:03:56+09:00",
"updatedAt": "2018-03-03T22:29:02+09:00",
"point": 0,
"UserID": 2,
"details": [{
"id": 1,
"createdAt": "2018-03-03T22:29:02+09:00",
"updatedAt": "2018-03-03T22:29:02+09:00",
"point": 0,
"wrongCount": 0,
"problemID": 2
}]
}]
コンテストの問題への提出を取得する。 提出時刻の昇順にソートされている。
GET /contests/:contestID/submissions
クエリパラメーターの指定は任意。
パラメーター | デフォルト値 | 例 | 説明 |
---|---|---|---|
limit | 25 | 25 | 1ページあたりの最大の件数(0 < limit <= 100) |
page | 1 | 1 | 取得するページ(0 < page) |
userID | 1 | ユーザーのIDを指定して提出を絞り込む | |
problemID | 1 | 問題のIDを指定して提出を絞り込む |
total
はlimit
とpage
を除いた条件にマッチした提出の件数。
{
"submissions":[
{
"id": 1,
"createdAt": "2018-05-12T13:04:14+09:00",
"updatedAt": "2018-05-12T13:04:19+09:00",
"userID": 1,
"user":{
"id": 1,
"name": "admin",
"displayName": "admin",
"authority": 1
},
"problemID": 1,
"problem":{
"id": 1,
"writerID": 1,
"writer":{"id": 0, "name": "", "displayName": "", "authority": 0},
"createdAt": "2018-05-10T08:45:28+09:00",
"updatedAt": "2018-05-10T16:38:06+09:00",
"title": "花見",
"body": "花見\n問題",
"inputFormat": "いんぷっと",
"outputFormat": "あうとぷっと",
"constraints": "**せいやく**",
"timeLimit": 2000000000,
"memoryLimit": 512,
"judgeType": 1,
"contestID": 1
},
"languageID": 1,
"language":{
"id": 1,
"displayName": "C++17 (GCC 7.2.0)",
"compileCommand": "g++ -w -lm -std=gnu++17 -O2 -o main.o main.cpp",
"execCommand": "./main.o"
},
"sourceCode": "#include <iostream>\nusing namespace std;\nint main() {while(1);}",
"point": 0,
"status": 10,
"errorLog": "",
"execTime": 0,
"memoryUsage": 0,
"codeBytes": 63
}
],
"total": 16
}
コンテストの各問題について、最新の自分の提出の状態を取得する。
ただし1度ACした問題については、常に status
が 2
(AC)になる。提出した問題についてのみ状態が返されるので、コンテストで1度も提出していない時は空の配列が返される。
GET /contests/:contestID/statuses
[
{
"contestID": 8,
"userID": 1,
"problemID": 11,
"createdAt": "2018-05-03T16:05:52+09:00",
"updatedAt": "2018-05-03T16:08:49+09:00",
"status": 5,
"point": 0
}
]