Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jvmusin committed Feb 29, 2024
1 parent 198558d commit ecdf106
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

package io.github.jvmusin.polybacs.polygon.api

import kotlinx.serialization.Serializable

@Serializable
data class Problem(
val id: Int,
val owner: String,
Expand All @@ -16,7 +13,6 @@ data class Problem(
val latestPackage: Int? = null,
val modified: Boolean,
) {
@Serializable
enum class AccessType {
READ,
WRITE,
Expand All @@ -33,7 +29,6 @@ data class Problem(
* @property timeLimit Time limit in milliseconds.
* @property memoryLimit Memory limit in megabytes.
*/
@Serializable
data class ProblemInfo(
val inputFile: String,
val outputFile: String,
Expand All @@ -42,7 +37,6 @@ data class ProblemInfo(
val memoryLimit: Int,
)

@Serializable
data class Statement(
val encoding: String,
val name: String,
Expand All @@ -54,7 +48,6 @@ data class Statement(
val tutorial: String,
)

@Serializable
data class File(
val name: String,
val modificationTimeSeconds: Long,
Expand All @@ -71,20 +64,17 @@ data class File(
}
}

@Serializable
data class ResourceAdvancedProperties(
val forTypes: String,
val main: String,
val stages: List<StageType>,
val assets: List<AssetType>,
) {
@Serializable
enum class StageType {
COMPILE,
RUN
}

@Serializable
enum class AssetType {
VALIDATOR,
INTERACTOR,
Expand All @@ -93,7 +83,6 @@ data class ResourceAdvancedProperties(
}
}

@Serializable
data class Solution(
val name: String,
val modificationTimeSeconds: Int,
Expand All @@ -104,7 +93,6 @@ data class Solution(
val isMain get() = tag == "MA"
}

@Serializable
data class PolygonTest(
val index: Int,
val manual: Boolean,
Expand All @@ -119,21 +107,18 @@ data class PolygonTest(
val verifyInputOutputForStatements: Boolean? = null,
)

@Serializable
data class TestGroup(
val name: String,
val pointsPolicy: PointsPolicyType,
val feedbackPolicy: String, // add enums
val dependencies: List<String>,
) {
@Serializable
enum class PointsPolicyType {
COMPLETE_GROUP,
EACH_TEST
}
}

@Serializable
data class Package(
val id: Int,
val creationTimeSeconds: Long,
Expand All @@ -142,7 +127,6 @@ data class Package(
val revision: Int,
val type: String, // https://github.com/Codeforces/polygon-issue-tracking/issues/498
) {
@Serializable
enum class State {
PENDING,
RUNNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import kotlinx.serialization.Serializable
* @property result The result of the request or *null* if request failed.
* @property comment The reason of failure or *null* if request succeeded.
*/
@Serializable
data class PolygonResponse<T>(
val status: String,
val result: T? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@

package io.github.jvmusin.polybacs.sybon.api

import kotlinx.serialization.Serializable

@Serializable
data class SybonCollection(
val id: Int,
val name: String,
val description: String,
val problems: List<SybonProblem>,
val problemsCount: Int
val problemsCount: Int,
)

@Serializable
data class SybonProblem(
val id: Int,
val name: String,
Expand All @@ -26,23 +22,20 @@ data class SybonProblem(
val inputFileName: String,
val outputFileName: String,
val internalProblemId: String,
val resourceLimits: ResourceLimits
val resourceLimits: ResourceLimits,
)

@Serializable
data class Test(
val id: String,
val input: String,
val output: String
val output: String,
)

@Serializable
data class ResourceLimits(
val timeLimitMillis: Int,
val memoryLimitBytes: Int
val memoryLimitBytes: Int,
)

@Serializable
data class SybonCompiler(
val id: Int,
val type: Type,
Expand All @@ -53,10 +46,9 @@ data class SybonCompiler(
val memoryLimitBytes: Int,
val numberOfProcesses: Int,
val outputLimitBytes: Int,
val realTimeLimitMillis: Int
val realTimeLimitMillis: Int,
) {
@Suppress("EnumEntryName")
@Serializable
enum class Type {
gcc,
mono,
Expand All @@ -66,41 +58,35 @@ data class SybonCompiler(
}
}

@Serializable
data class SybonSubmitSolution(
val compilerId: Int,
val problemId: Int,
val solution: String,
val solutionFileType: FileType = FileType.Text,
val pretestsOnly: Boolean = false,
val continueCondition: ContinueCondition = ContinueCondition.WhileOk
val continueCondition: ContinueCondition = ContinueCondition.WhileOk,
) {
@Serializable
enum class FileType {
Text,
Zip
}

@Serializable
enum class ContinueCondition {
Default,
WhileOk,
Always
}
}

@Serializable
data class SybonSubmissionResult(
val id: Int,
val buildResult: BuildResult,
val testGroupResults: List<TestGroupResult>
val testGroupResults: List<TestGroupResult>,
) {
@Serializable
data class BuildResult(
val status: Status,
val output: String
val output: String,
) {
@Serializable
enum class Status {
OK,
FAILED,
Expand All @@ -109,22 +95,19 @@ data class SybonSubmissionResult(
}
}

@Serializable
data class TestGroupResult(
val internalId: String,
val executed: Boolean,
val testResults: List<TestResult>
val testResults: List<TestResult>,
) {
@Serializable
data class TestResult(
val status: Status,
val judgeMessage: String? = null,
val resourceUsage: ResourceUsage,
val input: String? = null,
val actualResult: String? = null,
val expectedResult: String? = null
val expectedResult: String? = null,
) {
@Serializable
enum class Status {
OK,
WRONG_ANSWER,
Expand All @@ -146,10 +129,9 @@ data class SybonSubmissionResult(
SKIPPED
}

@Serializable
data class ResourceUsage(
val timeUsageMillis: Int,
val memoryUsageBytes: Int
val memoryUsageBytes: Int,
)
}
}
Expand Down

0 comments on commit ecdf106

Please sign in to comment.