Introduction to CPLib — Modern C++ Library for Test Data in CP

Правка en2, от tiger2005, 2024-01-21 13:11:29

CPLib is a library written in C++ for processing test data of competitive programming problems. It helps you write clear and efficient checkers, interactors, validators, and generators. CPLib uses "variable input template" as its major feature, provides friendly feedback for humans and backends, and is working hard to reach better compatibility and efficiency.

You can get CPLib from Github Repository. The "single-header-snapshot" branch automatically updates single-header version of CPLib which is easy to use. Also, you can visit cplib.vercel.app for more information. For regex-related questions, please relate to the FAQ page.

Here is a basic example of a checker using CPLib. For more examples, visit the links above.

#include "cplib.hpp"
 
using namespace cplib;
 
CPLIB_REGISTER_CHECKER(chk);
 
void checker_main() {
  auto var_ans = var::i32("ans", -2000, 2000);
 
  int ouf_output = chk.ouf.read(var_ans);
  int ans_output = chk.ans.read(var_ans);
 
  if (ouf_output != ans_output) {
    chk.quit_wa(format("Expected %d, got %d", ans_output, ouf_output));
  }
 
  chk.quit_ac();
}

The project is mainly written by yzy1, and I, tiger2005, work on syntax designs and some tiny stuffs. The project is still under development, so feel free to make suggestions!

Теги cplib, test data, checker, generator, validator, interactor

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский tiger2005 2024-01-21 13:35:05 5 Tiny change: ' please relate to the [F' -> ' please refer to the [F'
en2 Английский tiger2005 2024-01-21 13:11:29 2
en1 Английский tiger2005 2024-01-21 13:09:02 1521 Initial revision (published)