Submission details
Task:Island
Sender:Daniel_1997
Submission time:2026-04-16 12:10:12 +0300
Language:C++ (C++17)
Status:READY
Result:0
Feedback
subtaskverdictscore
#10
#20
#30
#40
#50
Test results
testverdicttimesubtask
#10.00 s1, 5details
#2ACCEPTED0.00 s1, 2, 3, 4, 5details
#30.01 s1, 5details
#40.01 s1, 5details
#50.00 s1, 3, 5details
#60.01 s1, 2, 4, 5details
#70.01 s1, 2, 4, 5details
#80.01 s1, 5details
#90.00 s1, 5details
#100.01 s1, 3, 4, 5details
#110.01 s1, 3, 5details
#120.01 s1, 4, 5details
#130.00 s1, 3, 4, 5details
#140.00 s1, 4, 5details
#150.00 s1, 5details
#160.01 s1, 5details
#170.01 s1, 5details
#180.01 s1, 5details
#190.18 s2, 4, 5details
#200.18 s2, 4, 5details
#210.18 s2, 4, 5details
#220.18 s2, 4, 5details
#230.18 s3, 5details
#240.18 s3, 5details
#250.18 s3, 5details
#260.19 s3, 5details
#270.18 s3, 4, 5details
#280.19 s3, 4, 5details
#290.19 s4, 5details
#300.18 s4, 5details
#310.18 s4, 5details
#320.19 s4, 5details
#330.18 s4, 5details
#340.19 s4, 5details
#350.19 s5details
#360.19 s5details
#370.19 s5details
#380.19 s5details
#390.18 s5details
#400.19 s5details
#410.20 s5details
#420.19 s5details
#430.19 s5details
#440.18 s5details

Code

#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define pb push_back
#define int long long
#define all(x) x.begin(), x.end()
#define ios ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0)
 
const int oo = 1e18;
const int mod = 1e8 + 7;
const int my[8]={0, 0, 1, -1, 1, 1, -1, -1};
const int mx[8]={1, -1, 0, 0, 1, -1, -1, 1};

 
void solve() {
    
    int n, q;
    cin >> n >> q;

    vector<string> v(n + 1);

    for(int i = 1; i <= n; i++)
    {
        cin >> v[i];
        v[i] = '0' + v[i];
    }


    while(q--)
    {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        
        cout << (x1 - x2) + (y1 - y2) << endl;
    }


    
}
 
int32_t main() {
    ios;
    int t = 1;
    //cin >> t;
    while(t--)solve();
}

Test details

Test 1

Subtask: 1, 5

Verdict:

input
8 4
........
..####..
.##.###.
.##.###.
...

correct output
5
0
17
3

user output
-5
0
-3
3

Feedback: Incorrect character on line 1 col 1: expected "5", got "-5"

Test 2

Subtask: 1, 2, 3, 4, 5

Verdict: ACCEPTED

input
3 1
...
.#.
...
2 2 2 2

correct output
0

user output
0

Test 3

Subtask: 1, 5

Verdict:

input
199 196
.................................

correct output
468
605
825
532
496
...

user output
124
151
-7
-46
78
...

Feedback: Incorrect character on line 1 col 1: expected "468", got "124"

Test 4

Subtask: 1, 5

Verdict:

input
200 200
.................................

correct output
112
347
142
459
239
...

user output
30
119
-76
-61
-175
...

Feedback: Incorrect character on line 1 col 1: expected "112", got "30"

Test 5

Subtask: 1, 3, 5

Verdict:

input
200 200
.................................

correct output
381
544
94
532
98
...

user output
139
-82
-42
-170
-42
...

Feedback: Incorrect character on line 1 col 1: expected "381", got "139"

Test 6

Subtask: 1, 2, 4, 5

Verdict:

input
200 200
.................................

correct output
133
73
81
82
53
...

user output
53
73
-79
-14
-9
...

Feedback: Incorrect character on line 1 col 1: expected "133", got "53"

Test 7

Subtask: 1, 2, 4, 5

Verdict:

input
200 200
.................................

correct output
139
52
101
14
144
...

user output
-113
-46
7
0
-38
...

Feedback: Incorrect character on line 1 col 1: expected "139", got "-113"

Test 8

Subtask: 1, 5

Verdict:

input
200 200
.................................

correct output
236
555
878
632
829
...

user output
110
89
-58
-216
-95
...

Feedback: Incorrect character on line 1 col 1: expected "236", got "110"

Test 9

Subtask: 1, 5

Verdict:

input
200 200
.................................

correct output
425
296
698
577
422
...

user output
187
-142
54
-113
120
...

Feedback: Incorrect character on line 1 col 1: expected "425", got "187"

Test 10

Subtask: 1, 3, 4, 5

Verdict:

input
200 200
.................................

correct output
1365
7284
11808
6136
9283
...

user output
-49
-114
22
-8
-169
...

Feedback: Incorrect character on line 1 col 1: expected "1365", got "-49"

Test 11

Subtask: 1, 3, 5

Verdict:

input
200 200
.................................

correct output
6292
17954
16728
8938
1335
...

user output
28
98
168
106
-87
...

Feedback: Incorrect character on line 1 col 1: expected "6292", got "28"

Test 12

Subtask: 1, 4, 5

Verdict:

input
200 200
.................................

correct output
27
141
269
127
61
...

user output
17
41
107
-13
51
...

Feedback: Incorrect character on line 1 col 1: expected "27", got "17"

Test 13

Subtask: 1, 3, 4, 5

Verdict:

input
200 200
.................................

correct output
19552
19544
19478
19402
19456
...

user output
246
238
172
-96
150
...

Feedback: Incorrect character on line 1 col 1: expected "19552", got "246"

Test 14

Subtask: 1, 4, 5

Verdict:

input
200 200
.................................

correct output
17624
17515
17468
17689
17510
...

user output
212
103
56
-277
98
...

Feedback: Incorrect character on line 1 col 1: expected "17624", got "212"

Test 15

Subtask: 1, 5

Verdict:

input
200 200
.................................

correct output
1584
1433
567
2248
1030
...

user output
56
59
79
-44
-58
...

Feedback: Incorrect character on line 1 col 1: expected "1584", got "56"

Test 16

Subtask: 1, 5

Verdict:

input
200 200
.................................

correct output
5872
6374
60
323
5311
...

user output
162
-18
-30
77
101
...

Feedback: Incorrect character on line 1 col 1: expected "5872", got "162"

Test 17

Subtask: 1, 5

Verdict:

input
200 200
.................................

correct output
1852
213
252
3861
1835
...

user output
-114
-143
116
-153
37
...

Feedback: Incorrect character on line 1 col 1: expected "1852", got "-114"

Test 18

Subtask: 1, 5

Verdict:

input
200 200
.................................

correct output
1564
2709
866
1318
1758
...

user output
-26
11
-124
-228
-214
...

Feedback: Incorrect character on line 1 col 1: expected "1564", got "-26"

Test 19

Subtask: 2, 4, 5

Verdict:

input
997 100000
.................................

correct output
150
531
370
518
508
...

user output
-80
531
-370
142
-508
...

Feedback: Incorrect character on line 1 col 1: expected "150", got "-80"

Test 20

Subtask: 2, 4, 5

Verdict:

input
1000 100000
.................................

correct output
390
278
783
1269
249
...

user output
-352
-34
-783
-1269
249
...

Feedback: Incorrect character on line 1 col 1: expected "390", got "-352"

Test 21

Subtask: 2, 4, 5

Verdict:

input
1000 100000
.................................

correct output
63
142
813
683
731
...

user output
63
50
813
-683
731
...

Feedback: Incorrect character on line 2 col 1: expected "142", got "50"

Test 22

Subtask: 2, 4, 5

Verdict:

input
1000 100000
.................................

correct output
949
876
1209
494
1033
...

user output
393
-876
-211
494
-1033
...

Feedback: Incorrect character on line 1 col 1: expected "949", got "393"

Test 23

Subtask: 3, 5

Verdict:

input
997 100000
.................................

correct output
714
2683
3699
2085
7850
...

user output
166
353
-505
-409
226
...

Feedback: Incorrect character on line 1 col 1: expected "714", got "166"

Test 24

Subtask: 3, 5

Verdict:

input
1000 100000
.................................

correct output
5081
1819
1050
4610
528
...

user output
-21
-699
378
-806
-252
...

Feedback: Incorrect character on line 1 col 1: expected "5081", got "-21"

Test 25

Subtask: 3, 5

Verdict:

input
1000 100000
.................................

correct output
3554
6322
6648
2882
1490
...

user output
-498
422
-174
60
-306
...

Feedback: Incorrect character on line 1 col 1: expected "3554", got "-498"

Test 26

Subtask: 3, 5

Verdict:

input
1000 100000
.................................

correct output
433976
81646
87810
48080
110879
...

user output
56
1280
950
320
-207
...

Feedback: Incorrect character on line 1 col 1: expected "433976", got "56"

Test 27

Subtask: 3, 4, 5

Verdict:

input
1000 100000
.................................

correct output
207982
140036
208364
51912
56826
...

user output
-308
-104
-988
68
178
...

Feedback: Incorrect character on line 1 col 1: expected "207982", got "-308"

Test 28

Subtask: 3, 4, 5

Verdict:

input
1000 100000
.................................

correct output
497525
497563
498000
496804
497335
...

user output
-1019
1057
-1494
298
829
...

Feedback: Incorrect character on line 1 col 1: expected "497525", got "-1019"

Test 29

Subtask: 4, 5

Verdict:

input
1000 100000
.................................

correct output
38580
2097
9795
38033
1639
...

user output
796
-605
-539
1221
-647
...

Feedback: Incorrect character on line 1 col 1: expected "38580", got "796"

Test 30

Subtask: 4, 5

Verdict:

input
1000 100000
.................................

correct output
33
20900
25028
1782
13599
...

user output
33
-448
-94
-398
641
...

Feedback: Incorrect character on line 2 col 1: expected "20900", got "-448"

Test 31

Subtask: 4, 5

Verdict:

input
1000 100000
.................................

correct output
1421
1122
1840
834
443
...

user output
449
1122
92
-330
443
...

Feedback: Incorrect character on line 1 col 1: expected "1421", got "449"

Test 32

Subtask: 4, 5

Verdict:

input
1000 100000
.................................

correct output
1378
1751
2274
250
811
...

user output
-1378
483
-600
-250
-811
...

Feedback: Incorrect character on line 1 col 1: expected "1378", got "-1378"

Test 33

Subtask: 4, 5

Verdict:

input
1000 100000
.................................

correct output
1126
886
544
223
272
...

user output
480
240
544
223
272
...

Feedback: Incorrect character on line 1 col 1: expected "1126", got "480"

Test 34

Subtask: 4, 5

Verdict:

input
1000 100000
.................................

correct output
327286
447779
447534
448307
446997
...

user output
-572
-1085
-840
1613
-303
...

Feedback: Incorrect character on line 1 col 1: expected "327286", got "-572"

Test 35

Subtask: 5

Verdict:

input
1000 100000
.................................

correct output
2597
1473
1933
2691
1837
...

user output
-893
529
103
-707
-439
...

Feedback: Incorrect character on line 1 col 1: expected "2597", got "-893"

Test 36

Subtask: 5

Verdict:

input
1000 100000
.................................

correct output
553
4357
3147
6951
1573
...

user output
-221
683
-247
-1165
-449
...

Feedback: Incorrect character on line 1 col 1: expected "553", got "-221"

Test 37

Subtask: 5

Verdict:

input
1000 100000
.................................

correct output
1723
2039
1871
5638
4256
...

user output
-21
297
299
364
-58
...

Feedback: Incorrect character on line 1 col 1: expected "1723", got "-21"

Test 38

Subtask: 5

Verdict:

input
1000 100000
.................................

correct output
1546
704
2796
3802
1870
...

user output
932
366
6
-928
332
...

Feedback: Incorrect character on line 1 col 1: expected "1546", got "932"

Test 39

Subtask: 5

Verdict:

input
1000 100000
.................................

correct output
3115
2042
2083
3227
740
...

user output
503
80
-39
275
230
...

Feedback: Incorrect character on line 1 col 1: expected "3115", got "503"

Test 40

Subtask: 5

Verdict:

input
1000 100000
.................................

correct output
5222
3211
5230
1772
2310
...

user output
868
229
510
-42
408
...

Feedback: Incorrect character on line 1 col 1: expected "5222", got "868"

Test 41

Subtask: 5

Verdict:

input
1000 100000
.................................

correct output
159214
68851
200821
141404
145704
...

user output
128
195
1007
-392
-142
...

Feedback: Incorrect character on line 1 col 2: expected "159214", got "128"

Test 42

Subtask: 5

Verdict:

input
1000 100000
.................................

correct output
1843
25028
124430
84542
131339
...

user output
113
-354
-492
-66
-411
...

Feedback: Incorrect character on line 1 col 2: expected "1843", got "113"

Test 43

Subtask: 5

Verdict:

input
1000 100000
.................................

correct output
111206
75799
12026
142133
20483
...

user output
976
-339
368
-839
7
...

Feedback: Incorrect character on line 1 col 1: expected "111206", got "976"

Test 44

Subtask: 5

Verdict:

input
1000 100000
.................................

correct output
20360
9075
12187
54923
54574
...

user output
80
149
65
-23
822
...

Feedback: Incorrect character on line 1 col 1: expected "20360", got "80"