Genuine-OJ API 接口文档
  1. problem
Genuine-OJ API 接口文档
  • README
  • contest
    • 创建比赛
      POST
    • 获取比赛列表
      GET
    • 获取比赛详情
      GET
    • 修改比赛
      PUT
    • 获取比赛排行榜
      GET
  • problem
    • tag
      • 获取标签列表
      • 标签管理
    • data
      • 获取题目测试数据信息
      • 更新题目测试数据信息
      • 获取题目测试点文件
    • 创建题目
      POST
    • 获取题目列表
      GET
    • 获取题目详情
      GET
    • 修改题目
      PUT
  • submission
    • 创建提交
      POST
    • 获取提交列表
      GET
    • 获取提交详情
      GET
    • 获取提交的测试点信息
      GET
  • user
    • 登录
      POST
    • 注册
      POST
    • 修改当前登录的用户密码
      POST
    • 登出
      GET
    • 获取用户信息
      GET
    • 更新用户信息
      PUT
    • 获取当前登录的用户信息
      GET
    • 更新当前登录的用户信息
      PUT
  1. problem

创建题目

开发中
POST
/problem/
仅限管理员访问

请求参数

Body 参数application/json
samples
array[object (Sample) {3}] 
必需
index
enum<integer> 
样例编号
必需
枚举值:
123
input
string 
样例输入
必需
output
string 
样例输出
必需
tags
array[integer]
题目标签
只写必需
传递时为integer,获取时为json
title
string 
题目标题
必需
description
string 
题目描述
必需
input_format
string 
题目输入描述
必需
output_format
string 
题目输出描述
必需
hint
string 
题目提示
必需
difficulty
integer 
题目难度
必需
time_limit
integer 
评测时间限制
必需
单位:ms
memory_limit
integer 
评测内存限制
必需
单位:MB
is_hidden
boolean 
是否隐藏
必需
submission_count
integer 
提交总数
必需
accepted_count
integer 
通过的提交总数
必需
示例
{
    "samples": [
        {
            "index": 1,
            "input": "string",
            "output": "string"
        }
    ],
    "tags": [
        0
    ],
    "title": "string",
    "description": "string",
    "input_format": "string",
    "output_format": "string",
    "hint": "string",
    "difficulty": 0,
    "time_limit": 0,
    "memory_limit": 0,
    "is_hidden": true,
    "submission_count": 0,
    "accepted_count": 0
}

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST '/problem/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "samples": [
        {
            "index": 1,
            "input": "string",
            "output": "string"
        }
    ],
    "tags": [
        0
    ],
    "title": "string",
    "description": "string",
    "input_format": "string",
    "output_format": "string",
    "hint": "string",
    "difficulty": 0,
    "time_limit": 0,
    "memory_limit": 0,
    "is_hidden": true,
    "submission_count": 0,
    "accepted_count": 0
}'

返回响应

🟢200成功
application/json
Body
id
integer 
比赛ID
必需
title
string 
比赛标题
必需
start_time
string 
开始时间
必需
end_time
string 
结束时间
必需
joined
boolean 
当前用户是否为参与者
必需
description
string 
比赛描述
必需
problem_list_mode
boolean 
是否为题单模式
必需
题单模式下开始时间、结束时间、是否参赛和排行榜的概念无意义
is_hidden
boolean 
是否隐藏
必需
allow_sign_up
boolean 
是否允许为参与者报名
必需
problems
array[object (Problem) {8}] 
题目列表
必需
id
integer 
题目ID
只读必需
solved
boolean 
当前用户是否已通过此题
只读必需
tags
array[object (Tag) {2}] 
题目标签
只读必需
title
string 
题目标题
必需
difficulty
integer 
题目难度
必需
is_hidden
boolean 
是否隐藏
必需
submission_count
integer 
提交总数
必需
accepted_count
integer 
通过的提交总数
必需
users
array[object (UserBrief) {4}] 
参赛者列表
必需
id
integer 
用户ID
必需
username
string 
用户名称
必需
real_name
string 
用户真实姓名
必需
avatar
string 
用户头像
必需
示例
{
    "id": 0,
    "title": "string",
    "start_time": "string",
    "end_time": "string",
    "joined": true,
    "description": "string",
    "problem_list_mode": true,
    "is_hidden": true,
    "allow_sign_up": true,
    "problems": [
        {
            "id": 0,
            "solved": true,
            "tags": [
                {
                    "id": 0,
                    "name": "string"
                }
            ],
            "title": "string",
            "difficulty": 0,
            "is_hidden": true,
            "submission_count": 0,
            "accepted_count": 0
        }
    ],
    "users": [
        {
            "id": 0,
            "username": "string",
            "real_name": "string",
            "avatar": "string"
        }
    ]
}
修改于 2022-11-05 07:36:03
上一页
获取题目测试点文件
下一页
获取题目列表
Built with