contest

package
v0.0.0-...-ca68a2b Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTEST_TYPE_CF   = "CF"
	CONTEST_TYPE_IOI  = "IOI"
	CONTEST_TYPE_ICPC = "ICPC"
)
View Source
const (
	CONTEST_PHASE_BEFORE              = "BEFORE"
	CONTEST_PHASE_CODING              = "CODING"
	CONTEST_PHASE_PENDING_SYSTEM_TEST = "PENDING_SYSTEM_TEST"
	CONTEST_PHASE_SYSTEM_TEST         = "SYSTEM_TEST"
	CONTEST_PHASE_FINISHED            = "FINISHED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Contest

type Contest struct {
	ID                    int64        `json:"id"`                    // .ID
	Name                  string       `json:"name"`                  // .Localized.
	Type                  ContestType  `json:"type"`                  // .Scoring system used for the contest.
	Phase                 ContestPhase `json:"phase"`                 // .BEFORE, CODING, PENDING_SYSTEM_TEST, SYSTEM_TEST, FINISHED.
	Frozen                bool         `json:"frozen"`                // .If true, then the ranklist for the contest is frozen and shows only submissions, created before freeze.
	DurationSeconds       int64        `json:"durationSeconds"`       // .Duration of the contest in seconds.
	FreezeDurationSeconds int64        `json:"freezeDurationSeconds"` // .Can be absent. The ranklist freeze duration of the contest in seconds if any.
	StartTimeSeconds      int64        `json:"startTimeSeconds"`      // .Can be absent. Contest start time in unix format.
	RelativeTimeSeconds   int64        `json:"relativeTimeSeconds"`   // .Can be absent. Number of seconds, passed after the start of the contest. Can be negative.
	PreparedBy            string       `json:"preparedBy"`            // .Can be absent. Handle of the user, how created the contest.
	WebsiteUrl            string       `json:"websiteUrl"`            // .Can be absent. URL for contest-related website.
	Description           string       `json:"description"`           // .Localized. Can be absent.
	Difficulty            int64        `json:"difficulty"`            // .Can be absent. From 1 to 5. Larger number means more difficult problems.
	Kind                  string       `json:"kind"`                  // .Kind Localized. Can be absent. Human-readable type of the contest from the following categories: Official ICPC Contest, Official School Contest, Opencup Contest, School/University/City/Region Championship, Training Camp Contest, Official International Personal Contest, Training Contest.
	IcpcRegion            string       `json:"icpcRegion"`            // .IcpcRegion Localized. Can be absent. Name of the Region for official ICPC contests.
	Country               string       `json:"country"`               // .Country Localized. Can be absent.
	City                  string       `json:"city"`                  // .City Localized. Can be absent.
	Season                string       `json:"season"`                // .Season Can be absent.

}

func List

func List(cli *client.Client, gym bool) ([]Contest, error)

type ContestPhase

type ContestPhase string

type ContestType

type ContestType string

type HacksPar

type HacksPar struct {
	ContestID int64 `json:"contestId"` // . Id of the contest. It is not the round number. It can be seen in contest URL. For example: /contest/566/status
	AsManager bool  `json:"asManager"` // . If set to true, the response will contain information available to contest managers. Otherwise, the response will contain only the information available to the participants. You must be a contest manager to use it.
}

func (HacksPar) ParseToCFPar

func (sp HacksPar) ParseToCFPar() (map[string][]string, error)

type HacksResult

type HacksResult struct {
	ID                  int64               `json:"id"`                  // .
	CreationTimeSeconds int64               `json:"creationTimeSeconds"` // . Hack creation time in unix format.
	Hacker              problemset.Party    `json:"hacker"`              //  object.
	Defender            problemset.Party    `json:"defender"`            //  object.
	Verdict             problemset.Verdict  `json:"verdict"`             // : HACK_SUCCESSFUL, HACK_UNSUCCESSFUL, INVALID_INPUT, GENERATOR_INCOMPILABLE, GENERATOR_CRASHED, IGNORED, TESTING, OTHER. Can be absent.
	Problem             *problemset.Problem `json:"problem"`             //  object. Hacked problem.
	Test                string              `json:"test"`                // . Can be absent.
	JudgeProtocol       JudgeProtocol       `json:"judgeProtocol"`       //  with three fields: "manual", "protocol" and "verdict". Field manual can have values "true" and "false". If manual is "true" then test for the hack was entered manually. Fields "protocol" and "verdict" contain human-readable description of judge protocol and hack verdict. Localized. Can be absent.

}

func Hacks

func Hacks(cli *client.Client, hacksPar HacksPar) ([]HacksResult, error)

type JudgeProtocol

type JudgeProtocol struct {
	Manual   string `json:"manual"`
	Protocol string `json:"protocol"`
	Verdict  string `json:"verdict"`
}

type ProblemResult

type ProblemResult struct {
	Points                    float64           `json:"points"`                    // . Floating point number.
	Penalty                   int64             `json:"penalty"`                   // . Integer. Penalty (in ICPC meaning) of the party for this problem. Can be absent.
	RejectedAttemptCount      int64             `json:"rejectedAttemptCount"`      // . Integer. Number of incorrect submissions.
	ProblemResultType         ProblemResultType `json:"type"`                      // . Enum: PRELIMINARY, FINAL. If type is PRELIMINARY then points can decrease (if, for example, solution will fail during system test). Otherwise, party can only increase points for this problem by submitting better solutions.
	BestSubmissionTimeSeconds int64             `json:"bestSubmissionTimeSeconds"` // . Integer. Number of seconds after the start of the contest before the submission, that brought maximal amount of points for this problem. Can be absent.
}

type ProblemResultType

type ProblemResultType string
const (
	ProblemResultType_PRELIMINARY ProblemResultType = "PRELIMINARY"
	ProblemResultType_FINAL       ProblemResultType = "FINAL"
)

type RanklistRow

type RanklistRow struct {
	Party                     problemset.Party `json:"party"`                     // . Party that took a corresponding place in the contest.
	Rank                      int64            `json:"rank"`                      // . Party place in the contest.
	Points                    float64          `json:"points"`                    // . point number. Total amount of points, scored by the party.
	Penalty                   int64            `json:"penalty"`                   // . Total penalty (in ICPC meaning) of the party.
	SuccessfulHackCount       int64            `json:"successfulHackCount"`       // .
	UnsuccessfulHackCount     int64            `json:"unsuccessfulHackCount"`     // .
	ProblemResults            []ProblemResult  `json:"problemResults"`            // . list of ProblemResult objects. Party results for each problem. Order of the problems is the same as in "problems" field of the returned object.
	LastSubmissionTimeSeconds int64            `json:"lastSubmissionTimeSeconds"` // . For IOI contests only. Time in seconds from the start of the contest to the last submission that added some points to the total score of the party. Can be absent.
}

type RatingChange

type RatingChange struct {
	ContestID               int64  `json:"contestId"`               // .
	ContestName             string `json:"contestName"`             // . Localized.
	Handle                  string `json:"handle"`                  // . Codeforces user handle.
	Rank                    int64  `json:"rank"`                    // . Place of the user in the contest. This field contains user rank on the moment of rating update. If afterwards rank changes (e.g. someone get disqualified), this field will not be update and will contain old rank.
	RatingUpdateTimeSeconds int64  `json:"ratingUpdateTimeSeconds"` // . Time, when rating for the contest was update, in unix-format.
	OldRating               int64  `json:"oldRating"`               // . User rating before the contest.
	NewRating               int64  `json:"newRating"`               // . User rating after the contest.
}

func RatingChanges

func RatingChanges(cli *client.Client, id int64) ([]RatingChange, error)

type StandingsPar

type StandingsPar struct {
	ContestID        int64                      `json:"contestId"`        // (Required) 	Id of the contest. It is not the round number. It can be seen in contest URL. For example: /contest/566/status
	AsManager        bool                       `json:"asManager"`        // Boolean. If set to true, the response will contain information available to contest managers. Otherwise, the response will contain only the information available to the participants. You must be a contest manager to use it.
	From             int64                      `json:"from"`             // 1-based index of the standings row to start the ranklist.
	Count            int64                      `json:"count"`            // Number of standing rows to return.
	Handles          string                     `json:"handles"`          // Semicolon-separated list of handles. No more than 10000 handles is accepted.
	Room             string                     `json:"room"`             // If specified, than only participants from this room will be shown in the result. If not — all the participants will be shown.
	ShowUnofficial   bool                       `json:"showUnofficial"`   // If true than all participants (virtual, out of competition) are shown. Otherwise, only official contestants are shown.
	ParticipantTypes problemset.ParticipantType `json:"participantTypes"` // Comma-separated list of participant types without spaces. Possible values: CONTESTANT, PRACTICE, VIRTUAL, MANAGER, OUT_OF_COMPETITION. Only participants with the specified types will be displayed.
}

func (StandingsPar) ParseToCFPar

func (sp StandingsPar) ParseToCFPar() (map[string][]string, error)

type StandingsResult

type StandingsResult struct {
	Contest  *Contest             `json:"contest"`
	Problems []problemset.Problem `json:"problems"`
	Rows     []RanklistRow        `json:"rows"`
}

func Standings

func Standings(cli *client.Client, standingsPar StandingsPar) (*StandingsResult, error)

type StatusPar

type StatusPar struct {
	ContestID int64  `json:"contestId"` // . Id of the contest. It is not the round number. It can be seen in contest URL. For example: /contest/566/status
	AsManager bool   `json:"asManager"` // . If set to true, the response will contain information available to contest managers. Otherwise, the response will contain only the information available to the participants. You must be a contest manager to use it.
	Handle    string `json:"handle"`    // . Codeforces user handle.
	From      int64  `json:"from"`      // . 1-based index of the first submission to return.
	Count     int64  `json:"count"`     // . Number of returned submissions.
}

func (StatusPar) ParseToCFPar

func (sp StatusPar) ParseToCFPar() (map[string][]string, error)

type StatusResult

type StatusResult struct {
	ID                  int64               `json:"id"`                  // . ID
	ContestID           int64               `json:"contestId"`           // . Can be absent.
	CreationTimeSeconds int64               `json:"creationTimeSeconds"` // . Time, when submission was created, in unix-format.
	RelativeTimeSeconds int64               `json:"relativeTimeSeconds"` // . Number of seconds, passed after the start of the contest (or a virtual start for virtual parties), before the submission.
	Problem             *problemset.Problem `json:"problem"`             // . object.
	Author              problemset.Party    `json:"author"`              // . object.
	ProgrammingLanguage string              `json:"programmingLanguage"` // . Programming Language
	Verdict             problemset.Verdict  `json:"verdict"`             // : FAILED, OK, PARTIAL, COMPILATION_ERROR, RUNTIME_ERROR, WRONG_ANSWER, PRESENTATION_ERROR, TIME_LIMIT_EXCEEDED, MEMORY_LIMIT_EXCEEDED, IDLENESS_LIMIT_EXCEEDED, SECURITY_VIOLATED, CRASHED, INPUT_PREPARATION_CRASHED, CHALLENGED, SKIPPED, TESTING, REJECTED. Can be absent.
	Testset             problemset.Testset  `json:"testset"`             // : SAMPLES, PRETESTS, TESTS, CHALLENGES, TESTS1, ..., TESTS10. Testset used for judging the submission.
	PassedTestCount     int64               `json:"passedTestCount"`     // . Number of passed tests.
	TimeConsumedMillis  int64               `json:"timeConsumedMillis"`  // . Maximum time in milliseconds, consumed by solution for one test.
	MemoryConsumedBytes int64               `json:"memoryConsumedBytes"` // . Maximum memory in bytes, consumed by solution for one test.
	Points              float64             `json:"points"`              // . point number. Can be absent. Number of scored points for IOI-like contests.

}

func Status

func Status(cli *client.Client, statusPar StatusPar) ([]StatusResult, error)

Jump to

Keyboard shortcuts

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