Submission #946304

# Submission time Handle Problem Language Result Execution time Memory
946304 2024-03-14T13:34:17 Z attky Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
379 ms 158924 KB
#include <bits/stdc++.h> 

using namespace std;

struct squarePower {
    long long int I = 0, O = 0;
    long long int result() {
        return I*O;
    }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int h, w;
    cin >> h >> w;
    char grid[h][w];
    squarePower puissance[h][w];
    for(int loop = 0; loop < h; ++loop) {
        for(int looping = 0; looping < w; ++looping) {
            cin >> grid[loop][looping];
        }
    }
    for(int loop = 0; loop < w; ++loop) {
        int nbI = 0;
        for(int looping = h-1; looping >= 0; --looping) {
            if(grid[looping][loop] == 'I') {
                nbI++;
            }
            else if(grid[looping][loop] == 'J') {
                puissance[looping][loop].I = nbI;
            }
        }
    }
    for(int loop = 0; loop < h; ++loop) {
        int nbO = 0;
        for(int looping = w-1; looping >= 0; --looping) {
            if(grid[loop][looping] == 'O') {
                nbO++;
            }
            else if(grid[loop][looping] == 'J') {
                puissance[loop][looping].O = nbO;
            }
        }
    }
    long long int somme = 0;
    for(int loop = 0; loop < h; ++loop) {
        for(int looping = 0; looping < w; ++looping) {
            somme += puissance[loop][looping].result();
        }
    }
    cout << somme;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 856 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 856 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 8 ms 3824 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 3 ms 2652 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 8 ms 4696 KB Output is correct
19 Correct 5 ms 4444 KB Output is correct
20 Correct 7 ms 4768 KB Output is correct
21 Correct 11 ms 4816 KB Output is correct
22 Correct 5 ms 4444 KB Output is correct
23 Correct 5 ms 4700 KB Output is correct
24 Correct 8 ms 4860 KB Output is correct
25 Correct 5 ms 4444 KB Output is correct
26 Correct 5 ms 4700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 856 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 8 ms 3824 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 3 ms 2652 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 8 ms 4696 KB Output is correct
19 Correct 5 ms 4444 KB Output is correct
20 Correct 7 ms 4768 KB Output is correct
21 Correct 11 ms 4816 KB Output is correct
22 Correct 5 ms 4444 KB Output is correct
23 Correct 5 ms 4700 KB Output is correct
24 Correct 8 ms 4860 KB Output is correct
25 Correct 5 ms 4444 KB Output is correct
26 Correct 5 ms 4700 KB Output is correct
27 Correct 364 ms 150096 KB Output is correct
28 Correct 1 ms 904 KB Output is correct
29 Correct 13 ms 11844 KB Output is correct
30 Correct 1 ms 860 KB Output is correct
31 Correct 247 ms 110504 KB Output is correct
32 Correct 281 ms 157776 KB Output is correct
33 Correct 266 ms 158368 KB Output is correct
34 Correct 279 ms 128108 KB Output is correct
35 Correct 285 ms 157872 KB Output is correct
36 Correct 257 ms 158288 KB Output is correct
37 Correct 379 ms 158924 KB Output is correct
38 Correct 158 ms 109392 KB Output is correct
39 Correct 174 ms 109880 KB Output is correct