/Codeforces-Polygon-Template

Template for codeforces contest preperation on polygon

Primary LanguageC++

Codeforces Polygon Template

Template for codeforces contest preperation on polygon


There are 4 files to use

  • Validator.cpp

    • to make validator for the problem to check the validation of the test case
  • Checker.cpp

    • to make special checker for your problem when there a lot of valid solutions
  • Solution.cpp

    • to put your solution in it and upload it
  • Generator.cpp

    • to generate the test cases that you need in your problem

input.txt and output.txt we use them with Solution.cpp file but you can ignore them and use your terminal instead of files


There is folder testlib-master in it there are a lot of examples of checkers, generators, validators, and there is the header file that we include it in validator.cpp and checker.cpp testlib.h

Linux:

  • You should copy to testlib.h and testlib.h.gch from testlib-master to /usr/local/include

Windows:

  • You should copy to testlib.h and testlib.h.gch from testlib-master to include folder in your compiler folder

You can read information about testlib.h from here.

You can see these tutorial, they will help you to write a good problem


There are generator builtin-functions you can use from testlib.h, and you can use Generator.cpp file.

If you will use Generator.cpp file, these information will help you to use it.

  • Choose number of file you want to print in line 134
  • Choose number of test cases in each file from line 131
  • If your problem has a single test case uncomment line 130

there are many functions to help you to generate test like:

  • gen_string

    • generate a string Upper Case or Lower Case and in any range you want with your length
  • gen_string_u_and_l

    • generate a string Upper Case and Lower Case and in any range you want with your length
  • gen_int

    • generate a integer number in the range you want from L to R
  • gen_palindrome

    • generate a palindrome string with your length in the range that you want
  • gen_array

    • generate an array with your size and in range you want, you can make the array normal or increasing or decreasing
  • gen_array_2D

    • generate an array_2D with your size and in range you want.
  • gen_permutation

    • generate an array with a permutation of N
  • gen_bit_int

    • generate a string with your length consit of digit in the range that you want
  • gen_array_of_pairs

    • generate an array of pairs with your length in the range that you want, you can choose if the pair is interval or not.
  • gen_char

    • gen character in range that you want
  • gen_tree

    • generate a tree or bamboo like tree or star like tree
  • gen_graph

    • generate a simple graph

You can appload the generator to polygon in your problem and use to generate tests with this command.

<#list begin..end as s>
	Name_of_Generator_file ${s} > $
</#list>

You can see tutorial video for polygon site, how to use it and write a problem live from Here

Another Part for the last update in Polygon from here


This a tutorial for polygon and how to use it Here