-
Notifications
You must be signed in to change notification settings - Fork 1
Problem Queries
For problem batches and tests, see problem batches and tests.
Type Definitions
Queries
- Get Checker Types
- Create Problem
- Get Problem IDs
- Get Problem Info
- Get Contest Problem Info
- Set Problem Info
- Add Sample
- Set Sample
- Delete Sample
- Reorder Samples
- Add Batch
- Set Batch
- Delete Batch
- Reorder Batches
- Upload PDF Statement
- Exist Problem Id
- Problem Submissions
Todo: Get PDF Statement, Add user groups and testing for owner/admin for permission, add batches and testfiles
{
id: string, // problem id, the same as the query parameter
checkerType: string, // default = "diff", checkerID of corresponding checkerType
title: string, // problem title (may contain any character)
usePdf: boolean, // default = False, whether the problem uses pdf statement
timeLimit: number, // default = 0, in milliseconds
memoryLimit: number, // default = 100,000,000 in bytes
languages: !Array<coda.Language> // supported languages
description: string, // contains text description if usePDF = False
input: string, // input description, markdown and mathjax supported
output: string, // output description, markdown and mathjax supported
explanation: string, // problem explanation typically for samples, markdown and mathjax supported
samples: Array<coda.Sample>,
batches: Array<coda.Batch>
}
{
input: string,
output: string,
sampleId: number
}
{
constraints: string // constraints for each batch
}
@enum {string}
It is defined by
/** @enum {string} */
coda.Language = {
C: 'c',
CPP: 'c++',
JAVA: 'java',
PYTHON: 'python'
};
{
id: string, // the checker id
onlyExec: boolean // true if the checker is exec'd directly, false if using a flavor of diff
}
Retrieves the valid checker types
problem/getCheckerTypes
Params
Return
!Array<coda.Checker>
Creates a problem with given id.
problem/createProblem
Params
problemId: string
Return
"Success Message"
Gets list of problem IDs
problem/getProblemIDs
Params
Return
Array<string> // problem IDs
Gets the problem info, including description, time/memory limit, batches, constraints, etc.
problem/getProblemInfo/problemID
URL Params
problemID: string
Return
coda.Problem
Gets the problem info, with a problem index of a specified contest.
problem/getContestProblemInfo/
Params
contestId: string, // contest id
problemIndex: string // 'A', 'B', ...
Return
{
problemID: string, // problem id, the same as the query parameter
checkerType: string, // default = "diff", checkerID of corresponding checkerType
title: string,
usePdf: boolean, // default = False, whether the problem uses pdf statement
timeLimit: number, // default = 0, in milliseconds
memoryLimit: number, // default = 100,000,000 in bytes
langs: !Array<string> // supported languages
statement: string, //Statement if usePDF = False
input: string,
output: string,
samples: Array<{
input: string,
output: string,
sampleID: number
}>,
batches: Array<{
constraints: string // constraints for each batch
}>
}
Sets the problem info, including statement, time/memory limit, batches, constraints, etc.
problem/setProblemInfo/problemID
URL Params
problemId: string
Params
// Only non-null elements in info are to be set.
info: {
title: ?string,
usePdf: ?boolean, //if usePdf, problem statement can be set by uploadPdfStatement or by multipart form
statement: ?string, // problem description
input: ?string,
output: ?string,
}
Multipart Form File Params
//Optionally upload pdfStatement
pdfStatement : ?file
Return
"Success message"
Adds a sample to a problem
problem/addSample/problemID
URL Params
problemID: string
Params
input: string,
output: string
Return
"Success message"
Sets a sample to a problem
problem/addSample/problemID/sampleID
URL Params
problemID: string
sampleID: number
Params
input: string,
output: string
Return
"Success message"
Deletes a sample of a problem and renumbers all later samples to maintain a consecutive list
problem/deleteSample/problemID/sampleID
URL Params
problemID: string,
sampleID: number
Params
Return
"Success message"
Reorder samples
problem/reorderSamples/problemID
URL Params
problemID: string
Params
newSampleIDs : Array<number> //Must have same length as number of samples and be sequentially numbered
Return
"Success message"
Uploads a PDF statment by posting a file.
uploadPdfStatement(problemId, file)
Params
problemId: string,
file: File (sent via post multi-part form)
Return
{
// empty or failure message
}
Checks if a problem id exists.
existProblemId(problemId)
Params
problemId: string
Return
boolean
Gets all submissions (across sessions) for a given problem. This is for moderator. Usually submissions are under sessions and are queried by sessionSubmissions.
problemSubmissions(problemId)
Params
problemId: string
Return
{
submissions: !Array<{
id: string, // submission id
user: string, // who submitted
time: number, // Posix time
lang: string, // source language ('c', 'c++', 'java')
size: number, // source file size in bytes
verdict: string // result of submission
}>
}