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
andtestlib.h.gch
fromtestlib-master
to/usr/local/include
Windows:
- You should copy to
testlib.h
andtestlib.h.gch
fromtestlib-master
toinclude
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
orLower Case
and in any range you want with your length
- generate a string
-
gen_string_u_and_l
- generate a string
Upper Case
andLower Case
and in any range you want with your length
- generate a string
-
gen_int
- generate a integer number in the range you want from
L
toR
- generate a integer number in the range you want from
-
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
orincreasing
ordecreasing
- generate an array with your size and in range you want, you can make the array
-
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
- generate an array with a permutation of
-
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 orstar
like tree
- generate a tree or
-
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>