Canadian Computing Competition: 2021 Stage 1, Junior #5, Senior #2
A new and upcoming artist has a unique way to create checkered patterns. The idea is to
use an
Input Specification
The first line of input will be a positive integer R
followed
by a single space and then an integer which is a row number, or C
followed by a single space
and then an integer which is a column number. Rows are numbered top down from
The following table shows how the available
Subtask | Description | |||
---|---|---|---|---|
only one cell, and up to | ||||
only one row, and up to | ||||
up to up to | ||||
up to up to |
Output Specification
Output one non-negative integer which is equal to the number of cells that are gold in the pattern determined by the artist's choices.
Sample Input 1
3
3
2
R 1
C 1
Output for Sample Input 1
4
Explanation of Output for Sample Input 1
After running the brush along the first row, the canvas looks like this:
GGG
BBB
BBB
Then after running the brush along the first column, four cells are gold in the final pattern determined by the artist's choices:
BGG
GBB
GBB
Sample Input 2
4
5
7
R 3
C 1
C 2
R 2
R 2
C 1
R 4
Output for Sample Input 2
10
Explanation of Output for Sample Input 2
Ten cells are gold in the final pattern determined by the artist's choices:
BGBBB
BGBBB
GBGGG
GBGGG
Comments
Small hint that i think people may need, for the last cases you would need to think outside the box to make it in the time limit, instead of changing the graph think about the amount of changes you need to make this.
R 1
R 1
=
R 0
think about that as a hint so for time don't think 2d array think 2 arrays.
really useful and thank u. I've been thinking about this problem for a long time. lol
Is this possible in python ?
Yes https://dmoj.ca/problem/ccc21s2/rank/?language=PY2&language=PY3&language=PYPY&language=PYPY3