Submission #520896

# Submission time Handle Problem Language Result Execution time Memory
520896 2022-01-31T12:09:20 Z emon_2007 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
710 ms 158832 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll h, w, cnt, a[3001][3001], b[3001][3001], k, l;
char c[3001][3001];

int main()
{
    cin >> h >> w;
    for(int i = 1; i <= h; i++)
    {
        for(int j = 1; j <= w; j++)
        {
            cin >> c[i][j];
        }
    }
    for(int j = w; j >= 1; j--)
    {
        for(int i = h; i >= 1; i--)
        {
            if(c[i][j] == 'I')
            {
                k++;
            }
            a[i][j] = k;
        }
        k = 0;
    }
    for(int i = h; i >= 1; i--)
    {
        for(int j = w; j >= 1; j--)
        {
            if(c[i][j] == 'O')
            {
                l++;
            }
            b[i][j] = l;
        }
        l = 0;
    }
    for(int i = 1; i <= h; i++)
    {
        for(int j = 1; j <= w; j++)
        {
            if(c[i][j] == 'J')
            {
                cnt += a[i][j] * b[i][j];
            }
        }
    }
    cout << cnt;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 292 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 2 ms 1356 KB Output is correct
8 Correct 2 ms 1460 KB Output is correct
9 Correct 2 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 2 ms 1484 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 292 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 2 ms 1356 KB Output is correct
8 Correct 2 ms 1460 KB Output is correct
9 Correct 2 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 2 ms 1484 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
14 Correct 14 ms 8908 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 10 ms 5312 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 19 ms 9924 KB Output is correct
19 Correct 22 ms 9772 KB Output is correct
20 Correct 17 ms 9652 KB Output is correct
21 Correct 20 ms 9912 KB Output is correct
22 Correct 18 ms 9684 KB Output is correct
23 Correct 17 ms 9712 KB Output is correct
24 Correct 23 ms 9872 KB Output is correct
25 Correct 19 ms 9728 KB Output is correct
26 Correct 18 ms 9676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 292 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 2 ms 1356 KB Output is correct
8 Correct 2 ms 1460 KB Output is correct
9 Correct 2 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 2 ms 1484 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
14 Correct 14 ms 8908 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 10 ms 5312 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 19 ms 9924 KB Output is correct
19 Correct 22 ms 9772 KB Output is correct
20 Correct 17 ms 9652 KB Output is correct
21 Correct 20 ms 9912 KB Output is correct
22 Correct 18 ms 9684 KB Output is correct
23 Correct 17 ms 9712 KB Output is correct
24 Correct 23 ms 9872 KB Output is correct
25 Correct 19 ms 9728 KB Output is correct
26 Correct 18 ms 9676 KB Output is correct
27 Correct 666 ms 158264 KB Output is correct
28 Correct 12 ms 26316 KB Output is correct
29 Correct 42 ms 13864 KB Output is correct
30 Correct 2 ms 716 KB Output is correct
31 Correct 503 ms 131204 KB Output is correct
32 Correct 670 ms 158764 KB Output is correct
33 Correct 692 ms 158276 KB Output is correct
34 Correct 603 ms 152248 KB Output is correct
35 Correct 683 ms 158832 KB Output is correct
36 Correct 656 ms 158344 KB Output is correct
37 Correct 710 ms 158760 KB Output is correct
38 Correct 470 ms 130740 KB Output is correct
39 Correct 504 ms 130664 KB Output is correct