CSES - Datatähti 2024 loppu - Results
Submission details
Task:Retkeily
Sender:EeliH
Submission time:2024-01-20 16:02:31 +0200
Language:C++20
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
#40
Test results
testverdicttimegroup
#1ACCEPTED0.08 s1, 2, 3, 4details
#2ACCEPTED0.08 s1, 2, 3, 4details
#3ACCEPTED0.08 s1, 2, 3, 4details
#40.08 s1, 2, 3, 4details
#5--1, 2, 3, 4details
#6--1, 2, 4details
#7--1, 2, 4details
#80.08 s1, 2, 3, 4details
#9--1, 2, 4details
#100.10 s1, 2, 3, 4details
#11--1, 2, 4details
#12--1, 2, 4details
#13--1, 2, 4details
#14--1, 2, 4details
#15--1, 2, 4details
#16--2, 4details
#17--2, 4details
#18--2, 4details
#190.39 s2, 3, 4details
#20--2, 4details
#21--2, 3, 4details
#22--1, 3, 4details
#23--1, 3, 4details
#24--3, 4details
#250.51 s3, 4details
#26--3, 4details
#27--3, 4details
#28--3, 4details
#29--1, 4details
#30--1, 4details
#31--1, 4details
#32--1, 4details
#33--1, 4details
#34--1, 4details
#35--1, 4details
#36--1, 4details
#37--4details
#38--4details
#39--4details
#400.90 s4details
#410.22 s4details

Code

#include <bits/stdc++.h>
using namespace std;

#define MAGIC 22

int n, m;
vector<pair<int, int>> varatutxy;
vector<pair<int, int>> vapaatxy;
vector<pair<int, int>> varatutyx;
vector<pair<int, int>> vapaatyx;
set<int> takencols[1000039];
set<int> takenrows[1000093];

bool is_dist_free(int x, int y, int n)
{
    cerr << x << " " << y << " " << n << endl;
    //assert(n <= 10);
    
    for (int i = 0; i < n + 1; i++) {
        if (takencols[x - n + i + MAGIC].contains(y + i)) {
            return false;
        }
    }

    for (int i = 0; i < n + 1; i++) {
        if (takencols[x + i + MAGIC].contains(y + n - i)) {
            return false;
        }
    }

    for (int i = 0; i < n + 1; i++) {
        if (takencols[x + n - i + MAGIC].contains(y - i)) {
            return false;
        }
    }

    for (int i = 0; i < n + 1; i++) {
        if (takencols[x - i + MAGIC].contains(y - n + i)) {
            return false;
        }
    }

    return true;
}

int main()
{
    cin >> n >> m;
    
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        varatutxy.push_back(make_pair(x, y));
        takencols[x + MAGIC].insert(y);
    }

    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        vapaatxy.push_back(make_pair(x, y));
    }

    int maxd = 1;
    for (int i = 0; i < m; i++) {
        cerr << "checking " << vapaatxy[i].first << ", " << vapaatxy[i].second << endl;
        for (int j = maxd;; j++) {
            if (!is_dist_free(vapaatxy[i].first, vapaatxy[i].second, j)) {
                cerr << "found " << j << endl;
                maxd = max(maxd, j);
                break;
            }
        }
    }

    cout << maxd << endl;
}

Test details

Test 1

Group: 1, 2, 3, 4

Verdict: ACCEPTED

input
1 1
6 6
8 9

correct output
5

user output
5

Error:
checking 8, 9
8 9 1
8 9 2
8 9 3
8 9 4
8 9 5
found 5

Test 2

Group: 1, 2, 3, 4

Verdict: ACCEPTED

input
5 5
5 10
8 10
1 2
4 10
...

correct output
4

user output
4

Error:
checking 1, 4
1 4 1
1 4 2
found 2
checking 2, 4
2 4 2
2 4 3
found 3
checking 4, 7
4 7 3
found 3
checking 6, 9
6 9 3
found 3
checking 5, 4
5 4 3
5 4 4
found 4

Test 3

Group: 1, 2, 3, 4

Verdict: ACCEPTED

input
10 10
5 2
1 10
6 10
5 5
...

correct output
5

user output
5

Error:
checking 6, 7
6 7 1
6 7 2
6 7 3
found 3
checking 2, 5
2 5 3
found 3
checking 6, 6
6 6 3
found 3
checking 2, 8
2 8 3
found 3
checking 8, 3
8 3 3
8 3 4
found 4
checking 9, 6
9 6 4
9 6 5
found 5
checking 9, 2
9 2 5
found 5
checking 6, 3
6 3 5
found 5
checking 1, 3
1 3 5
found 5
checking 1, 2
1 2 5
found 5

Test 4

Group: 1, 2, 3, 4

Verdict:

input
10 5
6 1
8 9
3 2
6 6
...

correct output
3

user output
4

Error:
checking 1, 2
1 2 1
found 1
checking 5, 5
5 5 1
5 5 2
found 2
checking 7, 3
7 3 2
7 3 3
found 3
checking 3, 4
3 4 3
3 4 4
found 4
checking 7, 5
7 5 4
found 4

Test 5

Group: 1, 2, 3, 4

Verdict:

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

correct output
7

user output
(empty)

Test 6

Group: 1, 2, 4

Verdict:

input
1 1
55 68
28 42

correct output
53

user output
(empty)

Test 7

Group: 1, 2, 4

Verdict:

input
100 100
52 56
58 96
3 99
18 1
...

correct output
20

user output
(empty)

Test 8

Group: 1, 2, 3, 4

Verdict:

input
1000 100
60 40
68 47
30 32
74 52
...

correct output
5

user output
8

Error:
checking 51, 96
51 96 1
51 96 2
51 96 3
found 3
checking 63, 15
63 15 3
found 3
checking 82, 88
82 88 3
found 3
checking 88, 9
88 9 3
found 3
checking 90, 43
90 43 3
found 3
checking 75, 4
75 4 3
found 3
checking 76, 7
76 7 3
found 3
checking 100, 96
100 96 3
found 3
checking 34, 89
34 89 3
34 89 4
found 4
checking 84, 100
84 100 4
84 100 5
found 5
checking 45, 44
45 44 5
found 5
checking 56, 5
56 5 5
56 5 6
found 6
checking 45, 17
45 17 6
found 6
checking 97, 93
97 93 6
found 6
checking 24, 9
24 9 6
found 6
checking 37, 13
37 13 6
found 6
checking 4, 31
4 31 6
found 6
checking 22, 72
22 72 6
found 6
checking 50, 67
50 67 6
found 6
checking 28, 82
28 82 6
found 6
checking 39, 56
39 56 6
found 6
checking 14, 28
14 28 6
found 6
checking 77, 75
77 75 6
77 75 7
found 7
checking 74, 62
74 62 7
found 7
checking 89, 40
89 40 7
found 7
checking 86, 31
86 31 7
found 7
checking 60, 35
60 35 7
found 7
checking 5, 49
5 49 7
found 7
checking 71, 27
71 27 7
found 7
checking 72, 88
72 88 7
found 7
ch...

Test 9

Group: 1, 2, 4

Verdict:

input
100 1000
44 26
18 81
18 6
83 90
...

correct output
20

user output
(empty)

Test 10

Group: 1, 2, 3, 4

Verdict:

input
1000 1000
15 13
23 79
81 43
30 40
...

correct output
7

user output
20

Error:
checking 14, 5
14 5 1
found 1
checking 18, 60
18 60 1
18 60 2
18 60 3
18 60 4
18 60 5
18 60 6
found 6
checking 45, 49
45 49 6
45 49 7
found 7
checking 39, 6
39 6 7
found 7
checking 83, 78
83 78 7
found 7
checking 45, 92
45 92 7
found 7
checking 52, 68
52 68 7
52 68 8
found 8
checking 52, 13
52 13 8
found 8
checking 90, 87
90 87 8
found 8
checking 89, 32
89 32 8
89 32 9
found 9
checking 67, 36
67 36 9
found 9
checking 93, 23
93 23 9
found 9
checking 68, 38
68 38 9
found 9
checking 68, 2
68 2 9
found 9
checking 17, 59
17 59 9
found 9
checking 89, 50
89 50 9
found 9
checking 23, 61
23 61 9
found 9
checking 31, 5
31 5 9
found 9
checking 85, 7
85 7 9
found 9
checking 59, 60
59 60 9
found 9
checking 79, 13
79 13 9
found 9
checking 68, 35
68 35 9
found 9
checking 65, 4
65 4 9
found 9
checking 91, 31
91 31 9
found 9
checking 77, 85
77 85 9
found 9
checking 28, 76
28 76 9
found 9
checking 46, 82
46 82 9
found 9
checking 58, 3
58 3 9
found 9
checking 56, 61
56 61 9
found 9
checking 65, 84
65 84...

Test 11

Group: 1, 2, 4

Verdict:

input
1 1
948 495
227 149

correct output
1067

user output
(empty)

Test 12

Group: 1, 2, 4

Verdict:

input
100 100
114 530
748 841
612 709
810 232
...

correct output
203

user output
(empty)

Test 13

Group: 1, 2, 4

Verdict:

input
1000 100
225 82
265 691
978 367
993 396
...

correct output
50

user output
(empty)

Test 14

Group: 1, 2, 4

Verdict:

input
100 1000
848 668
189 716
451 80
626 973
...

correct output
192

user output
(empty)

Test 15

Group: 1, 2, 4

Verdict:

input
1000 1000
931 656
382 809
666 609
1000 923
...

correct output
66

user output
(empty)

Test 16

Group: 2, 4

Verdict:

input
10000 1000
961 158
561 313
991 125
821 964
...

correct output
18

user output
(empty)

Test 17

Group: 2, 4

Verdict:

input
1000 10000
428 1000
485 958
46 915
582 127
...

correct output
67

user output
(empty)

Test 18

Group: 2, 4

Verdict:

input
10000 10000
503 849
367 829
448 926
362 512
...

correct output
22

user output
(empty)

Test 19

Group: 2, 3, 4

Verdict:

input
100000 10000
111 705
808 24
69 858
961 122
...

correct output
7

user output
21

Error:
checking 174, 739
174 739 1
174 739 2
found 2
checking 720, 340
720 340 2
720 340 3
720 340 4
found 4
checking 116, 523
116 523 4
found 4
checking 159, 382
159 382 4
found 4
checking 596, 920
596 920 4
found 4
checking 821, 663
821 663 4
821 663 5
found 5
checking 55, 494
55 494 5
found 5
checking 191, 737
191 737 5
found 5
checking 336, 328
336 328 5
336 328 6
found 6
checking 950, 339
950 339 6
found 6
checking 655, 525
655 525 6
found 6
checking 329, 545
329 545 6
found 6
checking 103, 134
103 134 6
found 6
checking 359, 962
359 962 6
found 6
checking 143, 375
143 375 6
found 6
checking 295, 172
295 172 6
295 172 7
found 7
checking 253, 396
253 396 7
found 7
checking 672, 130
672 130 7
found 7
checking 463, 557
463 557 7
found 7
checking 768, 975
768 975 7
found 7
checking 442, 333
442 333 7
found 7
checking 197, 702
197 702 7
found 7
checking 273, 688
273 688 7
found 7
checking 285, 944
285 944 7
found 7
checking 335, 943
335 943 7
found 7
checking 712, 742
712 742 7
found 7
checki...

Test 20

Group: 2, 4

Verdict:

input
10000 100000
844 874
339 315
819 918
627 936
...

correct output
27

user output
(empty)

Test 21

Group: 2, 3, 4

Verdict:

input
100000 100000
100 468
303 899
784 458
505 54
...

correct output
8

user output
(empty)

Test 22

Group: 1, 3, 4

Verdict:

input
10 10
451219 220496
369161 161920
241139 700531
811276 993633
...

correct output
10

user output
(empty)

Test 23

Group: 1, 3, 4

Verdict:

input
1000 1000
337358 113599
674585 852084
717817 983395
895431 391144
...

correct output
10

user output
(empty)

Test 24

Group: 3, 4

Verdict:

input
10000 10000
636432 664736
341727 37864
469264 360610
545785 879043
...

correct output
10

user output
(empty)

Test 25

Group: 3, 4

Verdict:

input
100000 100000
750315 55215
550921 465416
435380 742666
288479 495099
...

correct output
7

user output
(empty)

Error:
checking 750318, 55211
750318 55211 1
750318 55211 2
750318 55211 3
750318 55211 4
750318 55211 5
750318 55211 6
750318 55211 7
found 7
checking 550919, 465413
550919 465413 7
550919 465413 8
550919 465413 9
550919 465413 10
550919 465413 11
550919 465413 12
550919 465413 13
550919 465413 14
550919 465413 15
550919 465413 16
550919 465413 17
550919 465413 18
550919 465413 19
550919 465413 20
550919 465413 21
550919 465413 22
550919 465413 23
550919 465413 24
550919 465413 25
550919 465413 26
550919 465413 27
550919 465413 28
550919 465413 29
550919 465413 30
550919 465413 31
550919 465413 32
550919 465413 33
550919 465413 34
550919 465413 35
550919 465413 36
550919 465413 37
550919 465413 38
550919 465413 39
550919 465413 40
550919 465413 41
550919 465413 42
550919 465413 43
550919 465413 44
550919 465413 45
550919 465413 46
550919 465413 47
550919 465413 48
550919 465413 49
550919 465413 50
550919 465413 51
550919 465413 52
550919 465413 53
550919 465413 54
550919 465413 55
550919 465...

Test 26

Group: 3, 4

Verdict:

input
100000 100000
416825 677767
347155 162523
602643 936386
181956 517732
...

correct output
8

user output
(empty)

Test 27

Group: 3, 4

Verdict:

input
100000 100000
155202 457283
421100 55104
604625 136495
841749 569346
...

correct output
9

user output
(empty)

Test 28

Group: 3, 4

Verdict:

input
100000 100000
290146 808578
489810 268578
956361 635214
939844 534435
...

correct output
10

user output
(empty)

Test 29

Group: 1, 4

Verdict:

input
10 10
668880 791821
226050 188133
859493 736633
290460 838926
...

correct output
342068

user output
(empty)

Test 30

Group: 1, 4

Verdict:

input
100 100
729367 697755
338457 742774
535371 701216
93743 555995
...

correct output
285526

user output
(empty)

Test 31

Group: 1, 4

Verdict:

input
100 1000
50870 539657
476809 462765
311713 355546
901838 829393
...

correct output
255789

user output
(empty)

Test 32

Group: 1, 4

Verdict:

input
1000 100
182415 659794
581623 510256
594984 525993
367726 938015
...

correct output
50501

user output
(empty)

Test 33

Group: 1, 4

Verdict:

input
1000 1000
668976 422918
350791 933024
893307 88057
278098 13847
...

correct output
57897

user output
(empty)

Test 34

Group: 1, 4

Verdict:

input
1000 1000
701742 116334
278337 368995
187245 133297
273083 369187
...

correct output
60537

user output
(empty)

Test 35

Group: 1, 4

Verdict:

input
10 10
693836 74759
61731 520849
666762 45364
559335 979511
...

correct output
417182

user output
(empty)

Test 36

Group: 1, 4

Verdict:

input
1000 1000
207572 43521
513003 683552
58800 253576
16541 558695
...

correct output
69609

user output
(empty)

Test 37

Group: 4

Verdict:

input
10000 10000
89066 605574
504488 66068
959128 348414
68004 849599
...

correct output
22936

user output
(empty)

Test 38

Group: 4

Verdict:

input
100000 100000
20824 214259
463783 904059
603615 769692
789080 399093
...

correct output
8070

user output
(empty)

Test 39

Group: 4

Verdict:

input
100000 100000
811424 464350
336948 946495
204883 914446
171888 431769
...

correct output
8240

user output
(empty)

Test 40

Group: 4

Verdict:

input
100000 100000
850810 902354
292608 63461
223139 188900
197760 995048
...

correct output
7769

user output
(empty)

Error:
checking 531536, 593188
531536 593188 1
531536 593188 2
531536 593188 3
531536 593188 4
531536 593188 5
531536 593188 6
531536 593188 7
531536 593188 8
531536 593188 9
531536 593188 10
531536 593188 11
531536 593188 12
531536 593188 13
531536 593188 14
531536 593188 15
531536 593188 16
531536 593188 17
531536 593188 18
531536 593188 19
531536 593188 20
531536 593188 21
531536 593188 22
531536 593188 23
531536 593188 24
531536 593188 25
531536 593188 26
531536 593188 27
531536 593188 28
531536 593188 29
531536 593188 30
531536 593188 31
531536 593188 32
531536 593188 33
531536 593188 34
531536 593188 35
531536 593188 36
531536 593188 37
531536 593188 38
531536 593188 39
531536 593188 40
531536 593188 41
531536 593188 42
531536 593188 43
531536 593188 44
531536 593188 45
531536 593188 46
531536 593188 47
531536 593188 48
531536 593188 49
531536 593188 50
531536 593188 51
531536 593188 52
531536 593188 53
531536 593188 54
531536 593188 55
531536 593188 56
531536 593188 57
531536 593188 58...

Test 41

Group: 4

Verdict:

input
100000 100000
1 1
1 2
1 3
1 4
...

correct output
1899999

user output
(empty)

Error:
checking 1000000, 1000000
1000000 1000000 1
1000000 1000000 2
1000000 1000000 3
1000000 1000000 4
1000000 1000000 5
1000000 1000000 6
1000000 1000000 7
1000000 1000000 8
1000000 1000000 9
1000000 1000000 10
1000000 1000000 11
1000000 1000000 12
1000000 1000000 13
1000000 1000000 14
1000000 1000000 15
1000000 1000000 16
1000000 1000000 17
1000000 1000000 18