Tap here to switch tabs
Problem
Submissions

Problem: Count Total Number of Colored Cells

Try to solve the Count Total Number of Colored Cells problem.

Statement

An infinite two dimensional grid of unit cells starts completely uncolored. You are given a positive integer n.

During the first minute, exactly 11 arbitrary cell is colored.

Every subsequent minute, every uncolored cell that shares an edge with at least 11 already colored cell also becomes colored.

Return the total count of colored cells after n minutes have passed.

Constraints:

  • 1≤1 \leq n ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Total Number of Colored Cells

Try to solve the Count Total Number of Colored Cells problem.

Statement

An infinite two dimensional grid of unit cells starts completely uncolored. You are given a positive integer n.

During the first minute, exactly 11 arbitrary cell is colored.

Every subsequent minute, every uncolored cell that shares an edge with at least 11 already colored cell also becomes colored.

Return the total count of colored cells after n minutes have passed.

Constraints:

  • 1≤1 \leq n ≤105\leq 10^5