Submission #546038

# Submission time Handle Problem Language Result Execution time Memory
546038 2022-04-06T06:06:23 Z andrei_boaca Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
722 ms 88508 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
int n,m;
char v[3005][3005];
int nrO[3005][3005],nrI[3005][3005];
ll ans;
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            cin>>v[i][j];
    for(int i=1;i<=n;i++)
        for(int j=m;j>=1;j--)
            nrO[i][j]=nrO[i][j+1]+(v[i][j]=='O');
    for(int j=1;j<=m;j++)
        for(int i=n;i>=1;i--)
            nrI[i][j]=nrI[i+1][j]+(v[i][j]=='I');
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(v[i][j]=='J')
            {
                ll val=1LL*nrO[i][j]*nrI[i][j];
                ans+=val;
            }
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1364 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1364 KB Output is correct
13 Correct 2 ms 1344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1364 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1364 KB Output is correct
13 Correct 2 ms 1344 KB Output is correct
14 Correct 16 ms 7380 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 10 ms 4308 KB Output is correct
17 Correct 1 ms 444 KB Output is correct
18 Correct 22 ms 7892 KB Output is correct
19 Correct 20 ms 7844 KB Output is correct
20 Correct 19 ms 7776 KB Output is correct
21 Correct 21 ms 8008 KB Output is correct
22 Correct 19 ms 7872 KB Output is correct
23 Correct 19 ms 7780 KB Output is correct
24 Correct 23 ms 7948 KB Output is correct
25 Correct 18 ms 7892 KB Output is correct
26 Correct 18 ms 7796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 1492 KB Output is correct
6 Correct 2 ms 1492 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1364 KB Output is correct
10 Correct 2 ms 1364 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1364 KB Output is correct
13 Correct 2 ms 1344 KB Output is correct
14 Correct 16 ms 7380 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 10 ms 4308 KB Output is correct
17 Correct 1 ms 444 KB Output is correct
18 Correct 22 ms 7892 KB Output is correct
19 Correct 20 ms 7844 KB Output is correct
20 Correct 19 ms 7776 KB Output is correct
21 Correct 21 ms 8008 KB Output is correct
22 Correct 19 ms 7872 KB Output is correct
23 Correct 19 ms 7780 KB Output is correct
24 Correct 23 ms 7948 KB Output is correct
25 Correct 18 ms 7892 KB Output is correct
26 Correct 18 ms 7796 KB Output is correct
27 Correct 689 ms 88092 KB Output is correct
28 Correct 14 ms 25940 KB Output is correct
29 Correct 43 ms 7720 KB Output is correct
30 Correct 3 ms 596 KB Output is correct
31 Correct 496 ms 72460 KB Output is correct
32 Correct 691 ms 88508 KB Output is correct
33 Correct 707 ms 88332 KB Output is correct
34 Correct 578 ms 84128 KB Output is correct
35 Correct 674 ms 88480 KB Output is correct
36 Correct 681 ms 88336 KB Output is correct
37 Correct 722 ms 88428 KB Output is correct
38 Correct 479 ms 72504 KB Output is correct
39 Correct 470 ms 72252 KB Output is correct