Skip to content

Latest commit

 

History

History
50 lines (32 loc) · 1.75 KB

README.md

File metadata and controls

50 lines (32 loc) · 1.75 KB

CPLib

header std license docs

Getting Started

Visit the documentation home page to learn more.

Introduction

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.

Here is a basic example of a checker using CPLib:

#include "cplib.hpp"

using namespace cplib;

CPLIB_REGISTER_CHECKER(chk);

void checker_main() {
  auto var_ans = var::i32(-2000, 2000, "ans");

  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 above example demonstrates a core logic of CPLib: "variable input template". Using the "variable input template", you can save and reuse the logic of reading variables with the same restrictions. At the same time, based on the hierarchy of variable input, CPLib generates concise input stack information in case of errors.

License

LGPL-3.0-or-later

Copyright (c) 2023-present, rindag-devs