Submission #898223

# Submission time Handle Problem Language Result Execution time Memory
898223 2024-01-04T11:45:29 Z andrei_iorgulescu Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
454 ms 150448 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

int n,m;
char a[3005][3005];
int flin[3005][3005],fcol[3005][3005];

signed main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            cin >> a[i][j];
    for (int i = 1; i <= n; i++)
    {
        for (int j = m; j >= 1; j--)
        {
            flin[i][j] = flin[i][j + 1];
            if (a[i][j] == 'O')
                flin[i][j]++;
        }
    }
    for (int j = 1; j <= m; j++)
    {
        for (int i = n; i >= 1; i--)
        {
            fcol[i][j] = fcol[i + 1][j];
            if (a[i][j] == 'I')
                fcol[i][j]++;
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            if (a[i][j] == 'J')
                ans += flin[i][j] * fcol[i][j];
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 4956 KB Output is correct
6 Correct 1 ms 4956 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 2 ms 4956 KB Output is correct
9 Correct 1 ms 4956 KB Output is correct
10 Correct 1 ms 3164 KB Output is correct
11 Correct 1 ms 4956 KB Output is correct
12 Correct 1 ms 4956 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 4956 KB Output is correct
6 Correct 1 ms 4956 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 2 ms 4956 KB Output is correct
9 Correct 1 ms 4956 KB Output is correct
10 Correct 1 ms 3164 KB Output is correct
11 Correct 1 ms 4956 KB Output is correct
12 Correct 1 ms 4956 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 14 ms 18524 KB Output is correct
15 Correct 2 ms 14684 KB Output is correct
16 Correct 10 ms 11356 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 15 ms 19292 KB Output is correct
19 Correct 13 ms 19036 KB Output is correct
20 Correct 14 ms 19036 KB Output is correct
21 Correct 14 ms 19092 KB Output is correct
22 Correct 18 ms 19028 KB Output is correct
23 Correct 13 ms 19036 KB Output is correct
24 Correct 15 ms 19284 KB Output is correct
25 Correct 18 ms 19136 KB Output is correct
26 Correct 13 ms 19036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 4956 KB Output is correct
6 Correct 1 ms 4956 KB Output is correct
7 Correct 1 ms 3164 KB Output is correct
8 Correct 2 ms 4956 KB Output is correct
9 Correct 1 ms 4956 KB Output is correct
10 Correct 1 ms 3164 KB Output is correct
11 Correct 1 ms 4956 KB Output is correct
12 Correct 1 ms 4956 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 14 ms 18524 KB Output is correct
15 Correct 2 ms 14684 KB Output is correct
16 Correct 10 ms 11356 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 15 ms 19292 KB Output is correct
19 Correct 13 ms 19036 KB Output is correct
20 Correct 14 ms 19036 KB Output is correct
21 Correct 14 ms 19092 KB Output is correct
22 Correct 18 ms 19028 KB Output is correct
23 Correct 13 ms 19036 KB Output is correct
24 Correct 15 ms 19284 KB Output is correct
25 Correct 18 ms 19136 KB Output is correct
26 Correct 13 ms 19036 KB Output is correct
27 Correct 453 ms 150448 KB Output is correct
28 Correct 12 ms 73820 KB Output is correct
29 Correct 31 ms 16568 KB Output is correct
30 Correct 2 ms 2908 KB Output is correct
31 Correct 337 ms 128176 KB Output is correct
32 Correct 410 ms 150356 KB Output is correct
33 Correct 411 ms 150184 KB Output is correct
34 Correct 373 ms 147028 KB Output is correct
35 Correct 415 ms 150364 KB Output is correct
36 Correct 403 ms 150188 KB Output is correct
37 Correct 454 ms 150444 KB Output is correct
38 Correct 310 ms 127828 KB Output is correct
39 Correct 299 ms 127664 KB Output is correct