Skip to content

Commit

Permalink
Docs: add missing global constraints (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar committed May 22, 2017
1 parent d078f71 commit 072a4d9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/topic-guides/subtasks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,38 @@ Thus, the above example can be implemented as:

----

Global constraints
------------------

It is possible to specify a set of constraints that apply to every subtask, via the ``Constraints()`` method. For example, we can extract common constraints in the above example as follows:

.. sourcecode:: cpp

void Constraints() {
CONS(1 <= N && N <= 100);
CONS(1 <= K && K <= 100);
}

void Subtask1() {
Points(20);

CONS(N == 1);
}

void Subtask2() {
Points(20);

CONS(K == 1);
}

void Subtask3() {
Points(60);

// no additional constraints
}

----

Test groups
-----------

Expand Down

0 comments on commit 072a4d9

Please sign in to comment.