Submission #208067

# Submission time Handle Problem Language Result Execution time Memory
208067 2020-03-10T00:36:44 Z w4123 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
774 ms 82424 KB

#include <iostream>
#include <vector>
#include <string>
using namespace std;
int Orb_Count[3005][3005];
int Ingot_Count[3005][3005];
int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> vs(H);
    for (int i = 0; i != H; i++)
    {
        cin >> vs[i];
        if (vs[i][0] == 'O')Orb_Count[i][0] = 1;
        for (int j = 1; j != W; j++)
        {
            if (vs[i][j] == 'O')
            {
                Orb_Count[i][j] = Orb_Count[i][j - 1] + 1;
            }
            else
            {
                Orb_Count[i][j] = Orb_Count[i][j - 1];
            }
        }
    }

    for (int i = 0; i != W; i++)
    {
        if (vs[0][i] == 'I')Ingot_Count[0][i] = 1;
        for (int j = 1; j != H; j++)
        {
            if (vs[j][i] == 'I')Ingot_Count[j][i] = Ingot_Count[j - 1][i] + 1;
            else Ingot_Count[j][i] = Ingot_Count[j - 1][i];
        }
    }
    long long Ans = 0;
    for (int i = 0; i != H; i++)
    {
        for (int j = 0; j != W; j++)
        {
            if (vs[i][j] == 'J')
            {
                Ans += (Orb_Count[i][W - 1] - Orb_Count[i][j]) * (Ingot_Count[H - 1][j] - Ingot_Count[i][j]);
                //cout << "I: " << i << " J: " << j << " ORB_COUNT: " << Ingot_Count[i][j] << " " << Ingot_Count[i][W - 1];
            }
        }
    }
    cout << Ans;


}

# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 6 ms 1144 KB Output is correct
6 Correct 6 ms 1144 KB Output is correct
7 Correct 5 ms 1144 KB Output is correct
8 Correct 6 ms 1144 KB Output is correct
9 Correct 6 ms 1144 KB Output is correct
10 Correct 6 ms 1144 KB Output is correct
11 Correct 7 ms 1272 KB Output is correct
12 Correct 6 ms 1400 KB Output is correct
13 Correct 6 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 6 ms 1144 KB Output is correct
6 Correct 6 ms 1144 KB Output is correct
7 Correct 5 ms 1144 KB Output is correct
8 Correct 6 ms 1144 KB Output is correct
9 Correct 6 ms 1144 KB Output is correct
10 Correct 6 ms 1144 KB Output is correct
11 Correct 7 ms 1272 KB Output is correct
12 Correct 6 ms 1400 KB Output is correct
13 Correct 6 ms 1144 KB Output is correct
14 Correct 20 ms 6136 KB Output is correct
15 Correct 7 ms 3708 KB Output is correct
16 Correct 14 ms 3704 KB Output is correct
17 Correct 6 ms 380 KB Output is correct
18 Correct 24 ms 6780 KB Output is correct
19 Correct 21 ms 6520 KB Output is correct
20 Correct 22 ms 6648 KB Output is correct
21 Correct 24 ms 6776 KB Output is correct
22 Correct 22 ms 6396 KB Output is correct
23 Correct 22 ms 6648 KB Output is correct
24 Correct 24 ms 6776 KB Output is correct
25 Correct 21 ms 6520 KB Output is correct
26 Correct 22 ms 6648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 6 ms 1144 KB Output is correct
6 Correct 6 ms 1144 KB Output is correct
7 Correct 5 ms 1144 KB Output is correct
8 Correct 6 ms 1144 KB Output is correct
9 Correct 6 ms 1144 KB Output is correct
10 Correct 6 ms 1144 KB Output is correct
11 Correct 7 ms 1272 KB Output is correct
12 Correct 6 ms 1400 KB Output is correct
13 Correct 6 ms 1144 KB Output is correct
14 Correct 20 ms 6136 KB Output is correct
15 Correct 7 ms 3708 KB Output is correct
16 Correct 14 ms 3704 KB Output is correct
17 Correct 6 ms 380 KB Output is correct
18 Correct 24 ms 6780 KB Output is correct
19 Correct 21 ms 6520 KB Output is correct
20 Correct 22 ms 6648 KB Output is correct
21 Correct 24 ms 6776 KB Output is correct
22 Correct 22 ms 6396 KB Output is correct
23 Correct 22 ms 6648 KB Output is correct
24 Correct 24 ms 6776 KB Output is correct
25 Correct 21 ms 6520 KB Output is correct
26 Correct 22 ms 6648 KB Output is correct
27 Correct 728 ms 82344 KB Output is correct
28 Correct 17 ms 19192 KB Output is correct
29 Correct 43 ms 7416 KB Output is correct
30 Correct 6 ms 632 KB Output is correct
31 Correct 533 ms 68604 KB Output is correct
32 Correct 709 ms 82424 KB Output is correct
33 Correct 711 ms 82168 KB Output is correct
34 Correct 622 ms 79608 KB Output is correct
35 Correct 711 ms 82288 KB Output is correct
36 Correct 707 ms 82040 KB Output is correct
37 Correct 774 ms 82424 KB Output is correct
38 Correct 509 ms 68728 KB Output is correct
39 Correct 500 ms 68344 KB Output is correct