Submission details
Task:Ruudukko
Sender:pupukani
Submission time:2025-11-29 07:18:50 +0200
Language:C++ (C++17)
Status:READY
Result:16
Feedback
groupverdictscore
#1ACCEPTED16
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 2, 3details
#2--2, 3details
#3--2, 3details
#4--3details
#5--3details

Code

#include <iostream>
#include <vector>

int main(void)
{
	int n, m;
	std::cin >> n >> m;

	std::vector<char> ruudukko(n * n, '.');

	for (int i = 0; i < m; ++i)
	{
		int y1, x1, y2, x2;
		std::cin >> y1 >> x1 >> y2 >> x2;

		y1--; x1--; y2--; x2--;
		int index = y1 * n + x1;
		int rivit = y2 - y1 + 1;
		int sarakkeet = x2 - x1 + 1;

		for (int y = 0; y < rivit; ++y)
		{
			for (int x = 0; x < sarakkeet; ++x)
			{
				int idx = index + y * n + x;
				if (ruudukko[idx] == '.')
					ruudukko[idx] = '#';
				else
					ruudukko[idx] = '.';
			}
		}
	}

	for (int i = 0; i < n * n; ++i)
	{
		if (i % n == 0 && i != 0)
			std::cout << std::endl;
		std::cout << ruudukko[i];
	}
	std::cout << std::endl;

}

Test details

Test 1

Group: 1, 2, 3

Verdict: ACCEPTED

input
10 100
6 7 8 9
2 6 7 10
7 5 9 6
6 1 6 2
...

correct output
..##..##..
##....##.#
..####..##
##.##.....
####....##
...

user output
..##..##..
##....##.#
..####..##
##.##.....
####....##
...

Test 2

Group: 2, 3

Verdict:

input
500 100000
133 109 167 178
204 337 481 477
242 476 445 485
452 198 460 321
...

correct output
.##....####.####..##....#.##.#...

user output
(empty)

Test 3

Group: 2, 3

Verdict:

input
500 100000
33 7 485 482
50 38 456 459
34 20 479 493
13 6 479 485
...

correct output
.....#.####.#.#...####.##....#...

user output
(empty)

Test 4

Group: 3

Verdict:

input
2000 100000
126 95 1489 1619
1473 29 1697 78
1290 1031 1588 1047
1209 1794 1546 1818
...

correct output
..........................####...

user output
(empty)

Test 5

Group: 3

Verdict:

input
2000 100000
55 51 1842 1905
47 60 1997 1890
117 45 1920 1840
48 175 1987 1852
...

correct output
#.#...#...###.#...#####..####....

user output
(empty)