types.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. export enum Veredict{
  2. OK, // Accepted
  3. WA, // Wrong Answer
  4. TLE, // Time Limit Exceeded
  5. RTE, // Runtime Error
  6. CE, // Compilation Error
  7. }
  8. export class TestcaseResult{
  9. status: Veredict;
  10. spanTime?: number;
  11. constructor(status: Veredict, spanTime?: number){
  12. this.status = status;
  13. this.spanTime = spanTime;
  14. }
  15. }
  16. export class SolutionResult{
  17. status: Veredict;
  18. failTcId?: string;
  19. maxTime?: number;
  20. constructor(status: Veredict, failTcId?: string, maxTime?: number){
  21. this.status = status;
  22. this.failTcId = failTcId;
  23. this.maxTime = maxTime;
  24. }
  25. }
  26. export class Problem{
  27. // Identifier will be used as folder name
  28. identifier?: string;
  29. name?: string;
  30. inputs?: string[];
  31. outputs?: string[];
  32. constructor(identifier?: string, name?: string, inputs?: string[], outputs?: string[]){
  33. this.identifier = identifier;
  34. this.name = name;
  35. this.inputs = inputs;
  36. this.outputs = outputs;
  37. }
  38. }
  39. export class Contest{
  40. name: string;
  41. problems: Problem[];
  42. constructor(name: string, problems: Problem[]){
  43. this.name = name;
  44. this.problems = problems;
  45. }
  46. }
  47. export class SiteDescription{
  48. name: string;
  49. description: string;
  50. contestIdPlaceholder: string;
  51. problemIdPlaceholder: string;
  52. contestParser: (contestId: string) => Promise<Contest>;
  53. problemParser: (problemId: string) => Promise<Problem>;
  54. constructor(name: string, description: string,
  55. contestIdPlaceholder: string, problemIdPlaceholder: string,
  56. contestParser: (contestId: string) => Promise<Contest>,
  57. problemParser: (problemId: string) => Promise<Problem>){
  58. this.name = name;
  59. this.description = description;
  60. this.contestIdPlaceholder = contestIdPlaceholder;
  61. this.problemIdPlaceholder = problemIdPlaceholder;
  62. this.contestParser = contestParser;
  63. this.problemParser = problemParser;
  64. }
  65. }