Package Util
Class Constants
java.lang.Object
Util.Constants
Constants provides a central location to keep commonly used constants and configurations
in competitive programming. This includes debug flags, modulo values
for mathematical operations, and predefined direction vectors for grid operations.
These public members are meant for the users, who are free to rewrite their values.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Sahasrad Chippa
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic boolean
A debug flag that checks whether the application is running in a competitive programming environment (like Codeforces or AtCoder).static int[][]
A two-dimensional array representing the four orthogonal directions on a two-dimensional grid.static int[][]
A three-dimensional array representing the six principal direction vectors in a three-dimensional space.static int
The most common modulo value used in competitive programming.static int
Alternative modulo constant used in competitive programming. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
debug
public static boolean debugA debug flag that checks whether the application is running in a competitive programming environment (like Codeforces or AtCoder). When set to false, like under an online judge, theOut
class will not automatically flush output after print statements. The user must write aOut.flush()
statement at the end of their code. This is meant to preserve runtime over standard inputSystem.out
by flushing only once. -
MOD
public static int MODThe most common modulo value used in competitive programming. Used in combinatorics and number theory to prevent overflow and maintain manageable number sizes. -
MOD2
public static int MOD2Alternative modulo constant used in competitive programming. Used when dealing with polynomial multiplications and transforms. -
dir2
public static int[][] dir2A two-dimensional array representing the four orthogonal directions on a two-dimensional grid. These directions are often used in algorithms related to grid exploration or manipulation, such as breadth-first search or depth-first search on a grid. The directions are: down, left, up, right. -
dir3
public static int[][] dir3A three-dimensional array representing the six principal direction vectors in a three-dimensional space. This is typically used for navigating or exploring grid-based 3D structures. The directions include movements along positive and negative x, y, and z axes.
-
-
Constructor Details
-
Constants
public Constants()
-