@@ -399,6 +399,41 @@ public function addOptions(ConfigurationSpecification $item): ConfigurationSpeci
399399 return $ item ;
400400 }
401401
402+ /**
403+ * Returns all possible judgement (run) verdicts, both internally
404+ * hardcoded and from configured judgement types. Depending on the
405+ * requirements of the context, the following groups of verdicts can be
406+ * requests:
407+ * - final: final verdicts supported by the system
408+ * - error: error states that must be resolved by an admin
409+ * - in_progress: states reported when a judging is pending a final verdict
410+ * - external: configured verdicts when importing from an external system
411+ *
412+ * Verdicts are returned as an associative array of name/2-3 letter
413+ * identifier key/value pairs. The identifiers try to adhere to
414+ * https://ccs-specs.icpc.io/draft/contest_api#known-judgement-types
415+ *
416+ * @return array<string, string>
417+ */
418+ public function getVerdicts (array $ groups = ['final ' ]): array
419+ {
420+ $ verdictsConfig = $ this ->etcDir . '/verdicts.php ' ;
421+ $ verdictGroups = include $ verdictsConfig ;
422+
423+ $ verdicts = [];
424+ foreach ( $ groups as $ group ) {
425+ if ( $ group === 'external ' ) {
426+ foreach ($ this ->get ('external_judgement_types ' ) as $ id => $ name ) {
427+ $ verdicts [$ name ] = $ id ;
428+ }
429+ } else {
430+ $ verdicts = array_merge ($ verdicts , $ verdictGroups [$ group ]);
431+ }
432+ }
433+
434+ return $ verdicts ;
435+ }
436+
402437 public function getRunConfig (ContestProblem $ problem , Submission $ submission , int $ overshoot = 0 ): string
403438 {
404439 $ memoryLimit = $ problem ->getProblem ()->getMemlimit ();
0 commit comments