| Task: | Ruudukko |
| Sender: | hltk |
| Submission time: | 2025-11-28 19:47:16 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | 58 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 16 |
| #2 | ACCEPTED | 42 |
| #3 | TIME LIMIT EXCEEDED | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
| #2 | ACCEPTED | 0.16 s | 2, 3 | details |
| #3 | ACCEPTED | 0.16 s | 2, 3 | details |
| #4 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #5 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
#include <iostream>
using namespace std;
const int N = 1 << 11;
int t[N * 2][N * 2];
void seg_t(int k, int l, int r) {
l += N;
r += N;
while (l <= r) {
if (l % 2 == 1) t[k][l++] ^= 1;
if (r % 2 == 0) t[k][r--] ^= 1;
l /= 2;
r /= 2;
}
}
void seg_t(int i1, int j1, int i2, int j2) {
i1 += N;
i2 += N;
while (i1 <= i2) {
if (i1 % 2 == 1) seg_t(i1++, j1, j2);
if (i2 % 2 == 0) seg_t(i2--, j1, j2);
i1 /= 2;
i2 /= 2;
}
}
int seg_r2(int i, int j) {
int r = 0;
while (j) {
r ^= t[i][j];
j /= 2;
}
return r;
}
int seg_r(int i, int j) {
int r = 0;
while (i) {
r ^= seg_r2(i, j);
i /= 2;
}
return r;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
for (int qi = 0; qi < q; ++qi) {
int i1, j1, i2, j2;
cin >> i1 >> j1 >> i2 >> j2;
i1--; j1--; i2--; j2--;
seg_t(i1, j1, i2, j2);
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
cout << (seg_r(i + N, j + N) ? '#' : '.');
}
cout << '\n';
}
}
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: TIME LIMIT EXCEEDED
| 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: TIME LIMIT EXCEEDED
| input |
|---|
| 2000 100000 55 51 1842 1905 47 60 1997 1890 117 45 1920 1840 48 175 1987 1852 ... |
| correct output |
|---|
| #.#...#...###.#...#####..####.... |
| user output |
|---|
| (empty) |
