Submission details
Task:Ruudukko
Sender:pupukani
Submission time:2025-11-30 04:35:13 +0200
Language:C++ (C++17)
Status:READY
Result:58
Feedback
groupverdictscore
#1ACCEPTED16
#2ACCEPTED42
#30
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 2, 3details
#2ACCEPTED0.14 s2, 3details
#3ACCEPTED0.23 s2, 3details
#40.04 s3details
#5--3details

Code

#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <bitset>

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

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

		for (int y = y1; y <= y2; ++y)
		{
			int index1 = y * n + x1;
			int index2 = y * n + x2 + 1;
			bits.flip(index1);
			bits.flip(index2);
		}
	}

	std::string printtaus;
	char merkki = '.';
	for (int i = 0; i < n * n; ++i)
	{
		if (bits.test(i) == 1)
			merkki = merkki == '.' ? '#' : '.';
		printtaus += merkki;
	}

	for (int i = 1; i < n; ++i)
		printtaus.insert(i * n + i - 1, 1, '\n');

	std::cout << printtaus << 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: ACCEPTED

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

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

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

Test 3

Group: 2, 3

Verdict: ACCEPTED

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

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

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

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)

Error:
terminate called after throwing an instance of 'std::out_of_range'
  what():  bitset::flip: __position (which is 4000000) >= _Nb (which is 4000000)

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)