EZCP
A Rust framework to easily create tasks for competitive programming.
Features:
- Generate test inputs and save them into files.
- Generate correct outputs.
- Optionally have a test input checker.
- [TODO] Make a solution checker if there are multiple valid solutions.
- Subtask dependencies.
- Graph generator.
- Array generator.
- [TODO] Automatically generate some parts of the statement (time/memory limit, subtasks, samples...) and save it to latex.
- Add a partial solution and specify which subtasks it should pass.
- Automatically archive all test files into a zip.
Suggestions and bug reports: jakob@zorz.si
You can also open a pull request.
Minimal example: (see examples/ for more complete examples)
use rand::Rng;
use std::path::PathBuf;
fn main() {
let mut task = ezcp::Task::new("Coupon", &PathBuf::from("coupon"));
let mut subtask1 = ezcp::Subtask::new(20);
subtask1.add_test(5, ezcp::array_generator_custom(1, 1, |rng| rng.gen_range(0..=500_000_000) * 2));
let mut subtask2 = ezcp::Subtask::new(50);
subtask2.add_test(5, ezcp::array_generator_custom(1, 200_000, |rng| rng.gen_range(0..=500_000_000) * 2));
subtask2.add_test(5, ezcp::array_generator_custom(200_000, 200_000, |rng| rng.gen_range(0..=500_000_000) * 2));
let subtask1 = task.add_subtask(subtask1);
let subtask2 = task.add_subtask(subtask2);
task.add_subtask_dependency(subtask2, subtask1);
task.create_tests();
}
And coupon/solution.cpp:
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
long long sum=0;
int big=0;
while(n--){
int a;
cin>>a;
big=max(big,a);
sum+=a;
}
cout<<sum-big/2<<"\n";
}