Submission #717230

# Submission time Handle Problem Language Result Execution time Memory
717230 2023-04-01T15:28:31 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
328 ms 87992 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 3001;

int m,n;
char s[N][N];
int ao[N][N],ai[N][N];
long long ans;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> m >> n;
    for(int i = 1;i <= m;i++) for(int j = 1;j <= n;j++)
    {
        cin >> s[i][j];
        if(s[i][j]=='O') ao[i][j]++;
        else if(s[i][j]=='I') ai[i][j]++;
    }
    for(int i = m;i >= 1;i--) for(int j = n;j >= 1;j--) ao[i][j]+=ao[i][j+1],ai[i][j]+=ai[i+1][j];
    for(int i = 1;i <= m;i++) for(int j = 1;j <= n;j++) if(s[i][j]=='J') ans+=(long long)ao[i][j]*(long long)ai[i][j];
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 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 1360 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1488 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 2 ms 1492 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 328 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 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 1360 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1488 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 8 ms 7480 KB Output is correct
15 Correct 2 ms 4896 KB Output is correct
16 Correct 5 ms 4312 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 11 ms 8020 KB Output is correct
19 Correct 8 ms 7892 KB Output is correct
20 Correct 8 ms 7764 KB Output is correct
21 Correct 11 ms 8028 KB Output is correct
22 Correct 9 ms 7860 KB Output is correct
23 Correct 8 ms 7756 KB Output is correct
24 Correct 13 ms 8004 KB Output is correct
25 Correct 11 ms 7828 KB Output is correct
26 Correct 8 ms 7764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 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 1360 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1488 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1492 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 8 ms 7480 KB Output is correct
15 Correct 2 ms 4896 KB Output is correct
16 Correct 5 ms 4312 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 11 ms 8020 KB Output is correct
19 Correct 8 ms 7892 KB Output is correct
20 Correct 8 ms 7764 KB Output is correct
21 Correct 11 ms 8028 KB Output is correct
22 Correct 9 ms 7860 KB Output is correct
23 Correct 8 ms 7756 KB Output is correct
24 Correct 13 ms 8004 KB Output is correct
25 Correct 11 ms 7828 KB Output is correct
26 Correct 8 ms 7764 KB Output is correct
27 Correct 277 ms 87992 KB Output is correct
28 Correct 14 ms 25940 KB Output is correct
29 Correct 16 ms 7764 KB Output is correct
30 Correct 2 ms 596 KB Output is correct
31 Correct 216 ms 72504 KB Output is correct
32 Correct 232 ms 87920 KB Output is correct
33 Correct 187 ms 87748 KB Output is correct
34 Correct 241 ms 84040 KB Output is correct
35 Correct 268 ms 87972 KB Output is correct
36 Correct 179 ms 87628 KB Output is correct
37 Correct 328 ms 87884 KB Output is correct
38 Correct 163 ms 72520 KB Output is correct
39 Correct 131 ms 72148 KB Output is correct