CSES - Aalto Competitive Programming 2024 - wk4 - Mon - Results
Submission details
Task:Moon landing
Sender:odanobunaga8199
Submission time:2024-09-23 17:22:25 +0300
Language:C++ (C++20)
Status:READY
Result:
Test results
testverdicttime
#10.00 sdetails
#20.00 sdetails
#30.00 sdetails
#40.00 sdetails
#50.00 sdetails
#60.00 sdetails
#70.00 sdetails
#80.00 sdetails
#90.00 sdetails
#100.00 sdetails
#110.00 sdetails
#120.00 sdetails
#130.00 sdetails
#140.00 sdetails
#150.00 sdetails
#160.00 sdetails
#170.00 sdetails
#180.00 sdetails
#190.00 sdetails
#200.00 sdetails
#210.00 sdetails
#220.00 sdetails
#230.00 sdetails
#240.00 sdetails
#250.00 sdetails
#260.00 sdetails
#270.00 sdetails
#280.00 sdetails
#290.00 sdetails
#300.00 sdetails
#310.00 sdetails
#320.00 sdetails
#330.00 sdetails
#340.00 sdetails
#350.00 sdetails
#360.00 sdetails
#370.00 sdetails
#380.00 sdetails
#390.00 sdetails
#400.00 sdetails
#410.00 sdetails
#420.00 sdetails
#430.00 sdetails
#440.00 sdetails
#450.00 sdetails
#460.00 sdetails
#470.00 sdetails
#480.00 sdetails
#490.00 sdetails
#500.01 sdetails
#510.01 sdetails
#520.01 sdetails
#530.30 sdetails
#540.30 sdetails
#550.30 sdetails
#560.39 sdetails
#570.39 sdetails
#580.39 sdetails
#590.39 sdetails
#600.39 sdetails
#610.40 sdetails
#620.40 sdetails
#630.40 sdetails
#640.40 sdetails

Code

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, q;
    cin >> n >> q;

    vector<vector<int>> S(n + 1, vector<int>(n + 1, 0));

    for(int i = 1; i <= n; ++i){
        string row;
        cin >> row;
        for(int j = 1; j <= n; ++j){
            int tree = (row[j-1] == '*') ? 1 : 0;
            S[i][j] = S[i-1][j] + S[i][j-1] - S[i-1][j-1] + tree;
        }
    }

    string output = "";
    for(int q_num = 0; q_num < q; ++q_num){
        int y1, x1, y2, x2;
        cin >> y1 >> x1 >> y2 >> x2;
        int count = S[y2][x2] - S[y1 - 1][x2] - S[y2][x1 - 1] + S[y1 - 1][x1 - 1];
        output += to_string(count) + "\n";
    }

    cout << output;
}

Test details

Test 1

Verdict:

input
1 1

correct output
1 1

user output
(empty)

Test 2

Verdict:

input
2 10
0 2 

correct output
1 2

user output
(empty)

Test 3

Verdict:

input
2 4
7 7 

correct output
1 2

user output
(empty)

Test 4

Verdict:

input
3 8
5 10 5 

correct output
1 3

user output
(empty)

Test 5

Verdict:

input
3 10
3 6 7 

correct output
1 3

user output
(empty)

Test 6

Verdict:

input
3 0
6 9 5 

correct output
1 1

user output
(empty)

Test 7

Verdict:

input
4 3
8 5 1 10 

correct output
1 2

user output
(empty)

Test 8

Verdict:

input
4 9
6 3 8 7 

correct output
1 4

user output
(empty)

Test 9

Verdict:

input
4 10
1 9 6 8 

correct output
1 4

user output
(empty)

Test 10

Verdict:

input
5 6
6 7 9 6 9 

correct output
1 5

user output
(empty)

Test 11

Verdict:

input
5 4
10 7 10 0 1 

correct output
1 3

user output
(empty)

Test 12

Verdict:

input
5 4
2 0 10 6 10 

correct output
3 3

user output
(empty)

Test 13

Verdict:

input
5 6
0 7 9 3 1 

correct output
2 3

user output
(empty)

Test 14

Verdict:

input
5 10
9 6 1 10 9 

correct output
1 5

user output
(empty)

Test 15

Verdict:

input
5 2
0 9 9 2 4 

correct output
2 2

user output
(empty)

Test 16

Verdict:

input
5 9
10 3 2 9 0 

correct output
1 4

user output
(empty)

Test 17

Verdict:

input
5 0
2 8 3 4 10 

correct output
1 1

user output
(empty)

Test 18

Verdict:

input
5 9
0 10 2 9 4 

correct output
2 4

user output
(empty)

Test 19

Verdict:

input
5 0
4 5 5 5 0 

correct output
2 3

user output
(empty)

Test 20

Verdict:

input
10 6
6 7 9 6 9 5 9 4 6 7 

correct output
1 10

user output
(empty)

Test 21

Verdict:

input
10 4
10 7 10 0 1 3 10 1 2 1 

correct output
1 3

user output
(empty)

Test 22

Verdict:

input
10 4
2 0 10 6 10 4 5 4 3 3 

correct output
6 5

user output
(empty)

Test 23

Verdict:

input
10 6
0 7 9 3 1 5 6 9 4 9 

correct output
6 5

user output
(empty)

Test 24

Verdict:

input
10 10
9 6 1 10 9 7 6 7 6 2 

correct output
1 10

user output
(empty)

Test 25

Verdict:

input
10 2
0 9 9 2 4 10 10 5 0 6 

correct output
2 2

user output
(empty)

Test 26

Verdict:

input
10 9
10 3 2 9 0 0 4 1 10 6 

correct output
2 7

user output
(empty)

Test 27

Verdict:

input
10 0
2 8 3 4 10 7 5 10 3 5 

correct output
1 1

user output
(empty)

Test 28

Verdict:

input
10 9
0 10 2 9 4 5 8 2 4 0 

correct output
2 8

user output
(empty)

Test 29

Verdict:

input
10 0
4 5 5 5 0 1 3 1 0 2 

correct output
2 3

user output
(empty)

Test 30

Verdict:

input
100 589284011
636562059 767928733 906523440 ...

correct output
1 12

user output
(empty)

Test 31

Verdict:

input
100 447773961
773442531 122815 137572578 324...

correct output
2 10

user output
(empty)

Test 32

Verdict:

input
100 468145962
198730371 27838075 590195589 4...

correct output
60 11

user output
(empty)

Test 33

Verdict:

input
100 591414746
75940262 760367934 901888416 3...

correct output
34 14

user output
(empty)

Test 34

Verdict:

input
100 967034923
587586157 185430193 918715994 ...

correct output
37 64

user output
(empty)

Test 35

Verdict:

input
100 238363352
59249203 934941691 892631471 2...

correct output
34 5

user output
(empty)

Test 36

Verdict:

input
100 958701282
356460600 224848373 881788058 ...

correct output
1 100

user output
(empty)

Test 37

Verdict:

input
100 81935403
244103473 837431430 342493821 ...

correct output
21 3

user output
(empty)

Test 38

Verdict:

input
100 937837680
11934037 257096282 933290529 4...

correct output
29 54

user output
(empty)

Test 39

Verdict:

input
100 11139167
391337047 538883743 535937149 ...

correct output
2 3

user output
(empty)

Test 40

Verdict:

input
200 589284011
636562059 767928733 906523440 ...

correct output
99 15

user output
(empty)

Test 41

Verdict:

input
200 447773961
773442531 122815 137572578 324...

correct output
2 10

user output
(empty)

Test 42

Verdict:

input
200 468145962
198730371 27838075 590195589 4...

correct output
60 11

user output
(empty)

Test 43

Verdict:

input
200 591414746
75940262 760367934 901888416 3...

correct output
104 24

user output
(empty)

Test 44

Verdict:

input
200 967034923
587586157 185430193 918715994 ...

correct output
37 111

user output
(empty)

Test 45

Verdict:

input
200 238363352
59249203 934941691 892631471 2...

correct output
34 5

user output
(empty)

Test 46

Verdict:

input
200 958701282
356460600 224848373 881788058 ...

correct output
1 138

user output
(empty)

Test 47

Verdict:

input
200 81935403
244103473 837431430 342493821 ...

correct output
21 3

user output
(empty)

Test 48

Verdict:

input
200 937837680
11934037 257096282 933290529 4...

correct output
84 66

user output
(empty)

Test 49

Verdict:

input
200 11139167
391337047 538883743 535937149 ...

correct output
2 3

user output
(empty)

Test 50

Verdict:

input
1000 589284011
636562059 767928733 906523440 ...

correct output
99 15

user output
(empty)

Test 51

Verdict:

input
1000 447773961
773442531 122815 137572578 324...

correct output
2 10

user output
(empty)

Test 52

Verdict:

input
1000 468145962
198730371 27838075 590195589 4...

correct output
60 11

user output
(empty)

Test 53

Verdict:

input
10000 591414746
75940262 760367934 901888416 3...

correct output
104 24

user output
(empty)

Test 54

Verdict:

input
10000 967034923
587586157 185430193 918715994 ...

correct output
3660 279

user output
(empty)

Test 55

Verdict:

input
10000 238363352
59249203 934941691 892631471 2...

correct output
325 9

user output
(empty)

Test 56

Verdict:

input
100000 958701282
356460600 224848373 881788058 ...

correct output
66493 302

user output
(empty)

Test 57

Verdict:

input
100000 81935403
244103473 837431430 342493821 ...

correct output
28066 7

user output
(empty)

Test 58

Verdict:

input
100000 937837680
11934037 257096282 933290529 4...

correct output
91851 177

user output
(empty)

Test 59

Verdict:

input
100000 11139167
391337047 538883743 535937149 ...

correct output
84138 4

user output
(empty)

Test 60

Verdict:

input
100000 239756970
350744379 561742366 59793553 5...

correct output
94284 12

user output
(empty)

Test 61

Verdict:

input
100000 316394139
195182396 569713187 906489185 ...

correct output
12844 13

user output
(empty)

Test 62

Verdict:

input
100000 698334026
81615940 542726430 464528081 9...

correct output
28811 40

user output
(empty)

Test 63

Verdict:

input
100000 104725911
462211739 817385661 443179352 ...

correct output
46788 9

user output
(empty)

Test 64

Verdict:

input
100000 20
13 15 11 10 13 16 17 18 15 18 ...

correct output
1 100000

user output
(empty)