A fast input reading and validating template, primarily developed for use with the DMOJ (github).
Input.h
can be included as a separate file in the program configuration directory to allow checker and interactor programs to access it.
The main appeal of using this over other existing input validation templates is performance. All functions were written with execution speed in mind. Characters are read and stored into a buffer and parsed manually, providing a significant performance increase for problems with a large amount of input or output over using built-in methods.
C++ version at least 20 is required.
Time taken to read -O2
optimization level.
Method | |||
---|---|---|---|
fread |
|
|
|
cin with cin.sync_with_stdio(0); cin.tie(0);
|
|
|
|
scanf("%u") |
|
|
|
Balint's IdenticalReader
|
|
|
|
Balint's StandardReader
|
|
|
|
Balint's IdenticalInteractor
|
|
|
|
riolku's IdenticalCheckerReader
|
|
|
|
wesley-a-leung's IdenticalReader with cin.sync_with_stdio(0); cin.tie(0);
|
|
|
|