You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/2023-07-draft.md
+30-39Lines changed: 30 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -655,8 +655,7 @@ Sample test cases can be used in three places:
655
655
656
656
By default the sample data for all three cases is taken from the `.in` and `.ans` file pairs under `data/sample`.
657
657
Some problems require (slightly) different data in each of these cases.
658
-
We allow customizing which data is used for each purpose using the subdirectories `data/sample/statement` and `data/sample/download`.
659
-
In this case it is recommended to symlink identical files from these subdirectories to those in `data/sample`.
658
+
We allow customizing which data is used for each purpose with the additional extensions `.statement` and `.download`.
660
659
661
660
#### Samples For Judging Team Submissions
662
661
@@ -670,9 +669,10 @@ It may be missing (for problems with no samples) or empty.
670
669
#### Samples Shown in the Problem Statement
671
670
672
671
By default, the `.in` and `.ans` pairs from `data/sample` are shown in the problem statement.
673
-
This behavior can be customized by creating the `data/sample/statement` directory.
674
-
If this directory exists, its contents replaces that of `data/sample` for purposes of the problem statement.
675
-
Interactive problems with sample test cases should almost always make use of this directory, since the `.in` and `.ans` pairs do not meaningfully capture how users are expected to interact with the output validator in such problems.
672
+
If a `.out` file exists the `.out` file is shown instead of the `.ans` file in the problem statement.
673
+
This behavior can be customized by creating files with extension `.in.statement` and `.ans.statement`.
674
+
If one of these files exists, its contents replaces that of the file with the same name -- except the `.statement` extension -- for purposes of the problem statement.
675
+
Note that it is an error to provide both a `.out` and a `.ans.statement` file.
676
676
677
677
##### Interactive Problems
678
678
@@ -681,51 +681,48 @@ The validator gets access to the `.in` and `.ans` files for each test case and c
681
681
Standard in of the output validator corresponds to standard out of the submission, and standard out of the output validator corresponds to standard in of the submission.
682
682
Therefore, the output validator can control what information from the `.in` and `.ans` files is provided to the submission.
683
683
684
-
For interactive problems, sample data in `data/sample/statement` must have one of the following forms:
685
-
- An `.in` and `.out` file, which are both shown, and neither of which is validated.
686
-
- An `.interaction` file that contains lines starting with `<` and `>`,
687
-
containing an interaction log with output from the output validator starting with `<` and output from the submission starting with `>`.
684
+
For interactive problems displaying two files is typically not meaningfully to capture how users are expected to interact with the output validator.
685
+
Therefore, it is advised to instead provide samples for the problem statement in the form of a `.interaction` file.
686
+
This file contains lines starting with `<` and `>`, containing an interaction log with output from the output validator starting with `<` and output from the submission starting with `>`.
688
687
689
-
Note that an `.interaction` file does **not** need to be accompanied by corresponding `.in` and `.out` files. If both an `.interaction` file and corresponding `.in` and`.out`files are present, only the interaction log in the `.interaction`file is shown in the problem statement.
688
+
Note that if you are using a `.interaction` file you must not provide a `.in.statement`, `.ans.statement`, or`.out` file.
690
689
691
-
If you want to make testing tools available for download, you can use [attachments](#attachments).
690
+
##### Multi-Pass Problems
692
691
693
-
##### Other Problem Types
692
+
Multi-pass problems require a custom output validator, which interacts with the submission see [multi-pass](#multi-pass-validation).
694
693
695
-
For each test case, `data/sample/statement` must contain one of the following:
696
-
- An `.in` and `.ans` file, which are both shown.
697
-
- An `.in`, `.ans`, and `.out` file, of which the `.in` and `.out` file are shown, and the `.ans` file is used for validation (see below).
694
+
For multi-pass problems displaying two files is typically not meaningfully to capture how users are expected to interact with the output validator.
695
+
Therefore, it is advised to instead provide samples for the problem statement in the form of a `.interaction` file.
696
+
This file contains lines starting with `<` and `>`, like for interactive problems.
697
+
Passes are separated by a line containing `---` (three dashes).
698
+
When the problem is not interactive, simply start each pass by a number of lines starting with `<`, containing the sample input, followed by some lines starting with `>`, containing the sample output.
698
699
700
+
Note that if you are using a `.interaction` file you must not provide a `.in.statement`, `.ans.statement`, or `.out` file.
699
701
700
702
#### Samples Available for Download
701
703
702
-
When `data/sample/download` exists, the files in there are available for download.
703
-
If this directory does not exist, the contents of `data/sample/statement` are available for download,
704
-
with any `.out` files renamed to `.ans` (replacing existing `.ans` files) and all `.interaction` files removed.
705
-
When that also does not exist, the test cases in `data/sample` are available for download.
704
+
By default, the `.in`, `.ans`, and `.files` files in `data/sample` are available for download.
705
+
Note that the content of `.in.statement` replaces that of `.in` and that the content of `.out` or `.ans.statement` replace that of `.ans` for the download.
706
+
This behavior can be further customized by providing files with the extension `in.download` or `ans.download`.
707
+
If one of these files exists, its contents replaces that of the file with the same name -- except the `.download` extension -- for the problem download.
708
+
Additionally, any other file or directory with the extension `.download` is also available for download (without the `.download` extension).
706
709
707
-
The `data/sample/download` directory may contain anything, and none of its contents are validated.
708
-
We recommend placing test-case-specific files in this directory, and using [attachments](#attachments) for testing tools and other downloads not associated with any particular test case.
709
-
Testing tools may warn when test cases that are listed in `data/sample` or `data/sample/statement` do not appear in `data/sample/download`,
710
-
or when `data/sample/download` contains test cases that do not appear in one of the two other locations.
710
+
If you want to make other files -- like testing tools -- available for download, you can use [attachments](#attachments).
711
711
712
712
#### Validation
713
713
714
-
All `data/sample/*.in` files are input-validated. For problems that are not interactive, all `data/sample/statement/*.in` are also input-validated.
714
+
All `data/sample/*.in` files are input-validated.
715
+
For non interactive and non multi-pass problems the `.out` files must pass the output validator.
716
+
For non interactive and non multi-pass problems the `.ans` files must pass the output validator if they are not overriden in any way, i.e., if they are shown in the statement.
717
+
All other files are not validated in any way.
715
718
716
-
When `data/sample/statement/` does not exist, all test cases in `data/sample` must be accepted by the output validator, with the `.ans` file used as both the `answer_file` and `team_output`.
717
-
718
-
When `data/sample/statement/` does exists, and the problem is not interactive, all test cases in `data/sample/statement/` must be accepted by the output validator.
719
-
The `.ans` is used as the `answer_file`.
720
-
The `.out` file is used as the `team_output`, if it exists.
721
-
Otherwise the `.ans` is used as the `team_output`.
722
-
723
-
Files in `data/sample/download` are never validated,
724
-
although tooling may warn when there are inconsistencies between `download`, `statement`, and `data/sample/` itself.
719
+
Note that `.ans.statement` and `.out` can both be used to change what is shown in the statement.
720
+
However, since only the `.out` files are validated it is advised to use these if possible.
725
721
726
722
Validation can be customized by specifying `input_validator_args` and `output_validator_args` in `data/sample/test_group.yaml`.
727
723
These arguments are used when validating test cases in both `/data/sample` and `/data/sample/statement`.
728
724
725
+
729
726
## Generators
730
727
731
728
If any generator scripts were used to automate writing test cases,
@@ -1129,12 +1126,6 @@ It is a judge error to run more passes than specified by the `limits.validation_
1129
1126
All other files inside the feedback directory are guaranteed to persist between passes.
1130
1127
In particular, the validator should only append text to the `judgemessage.txt` to provide combined feedback for all passes.
1131
1128
1132
-
Samples for multi-pass problems must be provided in a `.interaction` file,
1133
-
like for interactive problems. Passes are separated by a line containing `---` (three dashes).
1134
-
When the problem is not interactive,
1135
-
simply start each pass by a number of lines starting with `<`, containing the sample input,
1136
-
followed by some lines starting with `>`, containing the sample answer.
0 commit comments