# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
111951 | Lawliet | Bitaro the Brave (JOI19_ho_t1) | C++14 | 741 ms | 159532 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define MAX 3010
using namespace std;
typedef long long int lli;
int n, m;
lli ans;
lli sO[MAX][MAX];
lli sI[MAX][MAX];
char v[MAX][MAX];
int main()
{
scanf("%d %d",&n,&m);
for(int g = 1 ; g <= n ; g++)
for(int h = 1 ; h <= m ; h++)
scanf(" %c",&v[g][h]);
for(int g = 1 ; g <= n ; g++)
for(int h = m ; h > 0 ; h--)
sO[g][h] = sO[g][h + 1] + ((v[g][h] == 'O') ? 1 : 0);
for(int g = n ; g > 0 ; g--)
for(int h = 1 ; h <= m ; h++)
sI[g][h] = sI[g + 1][h] + ((v[g][h] == 'I') ? 1 : 0);
for(int g = 1 ; g <= n ; g++)
for(int h = 1 ; h <= m ; h++)
if(v[g][h] == 'J')
ans += sO[g][h] * sI[g][h];
printf("%lld\n",ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |