judge

package
v0.12.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorInvalidOiejqResults = "invalid oiejq results returned"
View Source
const ErrorPerfEventParanoid = "to use oiejq you have to run `sudo sysctl kernel.perf_event_paranoid=-1`"

Variables

View Source
var Verdicts = []VerdictStatus{
	OK,
	WA,
	TLE,
	MLE,
	OLE,
	RE,
	INT,
}

Functions

func ExtractTaskName

func ExtractTaskName(file string) (task string)

func InstallSio2Jail

func InstallSio2Jail() (err error)

func ParseMemory added in v0.11.1

func ParseMemory(memory float64) string

func Plain

func Plain(raw []byte) string

Types

type OiejqOptions added in v0.10.0

type OiejqOptions struct {
	MemorylimitInMegaBytes string
	TimeLimitInSeconds     string
}

type ProcessInfo

type ProcessInfo struct {
	Status            VerdictStatus
	TimeInSeconds     float64
	MemoryInMegabytes float64
	Output            []byte
	Stderr            []byte
}

func RunProcess

func RunProcess(command string, input io.Reader, extrafile *os.File) (ProcessInfo, error)

func RunProcessWithOiejq

func RunProcessWithOiejq(command string, input io.Reader, oiejqOptions *OiejqOptions) (oiejqProcessInfo ProcessInfo, err error)

type Verdict

type Verdict struct {
	Status            VerdictStatus
	TimeInSeconds     float64
	MemoryInMegabytes float64
	Message           string
	Err               error
}

func GenerateVerdict

func GenerateVerdict(testID, answer string, processInfo ProcessInfo) Verdict

func Judge

func Judge(inPath, ansPath, sampleID, command string, oiejqOptions *OiejqOptions) Verdict

type VerdictStatus added in v0.11.1

type VerdictStatus string
const (
	OK  VerdictStatus = "OK"
	WA  VerdictStatus = "WA"
	TLE VerdictStatus = "TLE"
	MLE VerdictStatus = "MLE"
	OLE VerdictStatus = "OLE"
	RE  VerdictStatus = "RE"
	INT VerdictStatus = "INT"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL