Submission #702672

# Submission time Handle Problem Language Result Execution time Memory
702672 2023-02-24T18:24:09 Z speedyArda Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
363 ms 157944 KB
#include "bits/stdc++.h"

using namespace std;
const int MAXN = 3005;
char board[MAXN][MAXN];
long long pref_orb[MAXN][MAXN];
long long pref_ingot[MAXN][MAXN];
int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int h, w;
    cin >> h >> w;
    for(int i = 1; i <= h; i++)
    {
        pref_orb[i][0] = 0;
        for(int a = 1; a <= w; a++) {
            cin >> board[i][a];
            pref_orb[i][a] = pref_orb[i][a-1] + (board[i][a] == 'O' ? 1 : 0);
        }
    }
    for(int col = 1; col <= w; col++)
    {
        for(int row = 1; row <= h; row++)
        {
            pref_ingot[row][col] = pref_ingot[row-1][col] + (board[row][col] == 'I' ? 1 : 0);
        }
    }

    long long ans = 0;
    for(int row = 1; row <= h; row++)
    {
        for(int col = 1; col <= w; col++)
        {
            if(board[row][col] == 'J')
            {
                ans += (pref_orb[row][w] - pref_orb[row][col]) * (pref_ingot[h][col] - pref_ingot[row][col]);
            }
            //cout << row << " " << col << " " << ans << "\n";
        }
    }
    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 7 ms 8916 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 5 ms 5236 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 14 ms 10020 KB Output is correct
19 Correct 8 ms 9812 KB Output is correct
20 Correct 8 ms 9804 KB Output is correct
21 Correct 9 ms 9904 KB Output is correct
22 Correct 8 ms 9812 KB Output is correct
23 Correct 8 ms 9684 KB Output is correct
24 Correct 10 ms 9940 KB Output is correct
25 Correct 9 ms 9724 KB Output is correct
26 Correct 8 ms 9792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 7 ms 8916 KB Output is correct
15 Correct 2 ms 4948 KB Output is correct
16 Correct 5 ms 5236 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 14 ms 10020 KB Output is correct
19 Correct 8 ms 9812 KB Output is correct
20 Correct 8 ms 9804 KB Output is correct
21 Correct 9 ms 9904 KB Output is correct
22 Correct 8 ms 9812 KB Output is correct
23 Correct 8 ms 9684 KB Output is correct
24 Correct 10 ms 9940 KB Output is correct
25 Correct 9 ms 9724 KB Output is correct
26 Correct 8 ms 9792 KB Output is correct
27 Correct 316 ms 157944 KB Output is correct
28 Correct 11 ms 26312 KB Output is correct
29 Correct 21 ms 13796 KB Output is correct
30 Correct 2 ms 724 KB Output is correct
31 Correct 250 ms 131276 KB Output is correct
32 Correct 296 ms 157456 KB Output is correct
33 Correct 308 ms 156944 KB Output is correct
34 Correct 271 ms 152364 KB Output is correct
35 Correct 298 ms 157584 KB Output is correct
36 Correct 311 ms 156928 KB Output is correct
37 Correct 363 ms 157380 KB Output is correct
38 Correct 212 ms 130764 KB Output is correct
39 Correct 210 ms 130840 KB Output is correct