# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
98771 | bogdan10bos | Bitaro the Brave (JOI19_ho_t1) | C++14 | 83 ms | 18040 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>
using namespace std;
//#define FILE_IO
int N, M;
int dwn[3005], rgt[3005];
char a[3005][3005];
int main()
{
#ifdef FILE_IO
freopen("1.in", "r", stdin);
//freopen("1.out", "w", stdout);
#endif
scanf("%d%d\n", &N, &M);
for(int i = 1; i <= N; i++)
scanf("%s\n", a[i] + 1);
long long ans = 0;
for(int i = N; i >= 1; i--)
for(int j = M; j >= 1; j--)
{
rgt[j] = rgt[j + 1] + (a[i][j] == 'O');
dwn[j] += (a[i][j] == 'I');
if(a[i][j] == 'J')
ans += 1LL * rgt[j] * dwn[j];
}
cout << ans;
return 0;
}
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... |