Submission #654007

# Submission time Handle Problem Language Result Execution time Memory
654007 2022-10-29T10:36:40 Z sofija6 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
400 ms 159260 KB
#include <bits/stdc++.h>
#define ll long long
#define MAXH 3010
using namespace std;
char c[MAXH][MAXH];
ll cnto[MAXH][MAXH],cnti[MAXH][MAXH];
int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll h,w,ans=0;
    cin >> h >> w;
    for (ll i=1;i<=h;i++)
    {
        for (ll j=1;j<=w;j++)
            cin >> c[i][j];
    }
    for (ll i=1;i<=h;i++)
    {
        for (ll j=w;j>=1;j--)
            cnto[i][j]=cnto[i][j+1]+(c[i][j]=='O');
    }
    for (ll j=1;j<=w;j++)
    {
        for (ll i=h;i>=1;i--)
        {
            cnti[i][j]=cnti[i+1][j]+(c[i][j]=='I');
            if (c[i][j]=='J')
                ans+=cnto[i][j]*cnti[i][j];
        }
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 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 324 KB Output is correct
5 Correct 1 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 1544 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1488 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 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 324 KB Output is correct
5 Correct 1 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 1544 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1488 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 10 ms 8936 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 5 ms 5332 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 11 ms 10004 KB Output is correct
19 Correct 10 ms 9800 KB Output is correct
20 Correct 11 ms 9772 KB Output is correct
21 Correct 11 ms 9940 KB Output is correct
22 Correct 12 ms 9796 KB Output is correct
23 Correct 10 ms 9684 KB Output is correct
24 Correct 12 ms 9940 KB Output is correct
25 Correct 11 ms 9812 KB Output is correct
26 Correct 10 ms 9684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 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 324 KB Output is correct
5 Correct 1 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 1544 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1488 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 10 ms 8936 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 5 ms 5332 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 11 ms 10004 KB Output is correct
19 Correct 10 ms 9800 KB Output is correct
20 Correct 11 ms 9772 KB Output is correct
21 Correct 11 ms 9940 KB Output is correct
22 Correct 12 ms 9796 KB Output is correct
23 Correct 10 ms 9684 KB Output is correct
24 Correct 12 ms 9940 KB Output is correct
25 Correct 11 ms 9812 KB Output is correct
26 Correct 10 ms 9684 KB Output is correct
27 Correct 356 ms 158792 KB Output is correct
28 Correct 14 ms 26324 KB Output is correct
29 Correct 24 ms 13888 KB Output is correct
30 Correct 2 ms 724 KB Output is correct
31 Correct 274 ms 131644 KB Output is correct
32 Correct 347 ms 159256 KB Output is correct
33 Correct 357 ms 158896 KB Output is correct
34 Correct 335 ms 152660 KB Output is correct
35 Correct 348 ms 159200 KB Output is correct
36 Correct 370 ms 158712 KB Output is correct
37 Correct 400 ms 159260 KB Output is correct
38 Correct 256 ms 130780 KB Output is correct
39 Correct 277 ms 131004 KB Output is correct