Submission details
Task:Ruudukko
Sender:Gomhog
Submission time:2025-11-28 23:07:16 +0200
Language:C++ (C++11)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED16
#2ACCEPTED42
#3ACCEPTED42
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 2, 3details
#2ACCEPTED0.09 s2, 3details
#3ACCEPTED0.09 s2, 3details
#4ACCEPTED0.46 s3details
#5ACCEPTED0.46 s3details

Code

#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;

const int N=1<<11;
pair<int,pair<int,int>> eve[201010];
int stree[2*N];

void add(int ind) {
    ind+=N;
    while (ind>0) {
        stree[ind]++;
        ind/=2;
    }
}

int get(int ind) {
    int a=N;
    int b=ind+N;
    int su=0;
    while (a<=b) {
        if (a%2==1) su+=stree[a++];
        if (b%2==0) su+=stree[b--];
        a/=2;
        b/=2;
    }
    return su%2;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    for (int i=0;i<m;i++) {
        int y1,x1,y2,x2;
        cin>>y1>>x1>>y2>>x2;
        eve[2*i]={y1,{x1,x2+1}};
        eve[2*i+1]={y2+1,{x1,x2+1}};
    }
    sort(eve,eve+2*m);
    int pt=0;
    for (int i=1;i<=n;i++) {
        while (pt<2*m && eve[pt].F == i) {
            add(eve[pt].S.F);
            add(eve[pt].S.S);
            pt++;
        }
        for (int j=1;j<=n;j++) {
            if (get(j)==0) cout<<'.';
            else cout<<'#';
        }
        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: ACCEPTED

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

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

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

Test 5

Group: 3

Verdict: ACCEPTED

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

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

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