# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
589882 | boris_mihov | Bitaro the Brave (JOI19_ho_t1) | C++14 | 84 ms | 88572 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 <iostream>
typedef long long llong;
const int MAXN = 3000 + 10;
int n, m;
char t[MAXN][MAXN];
int countO[MAXN][MAXN];
int countI[MAXN][MAXN];
void solve()
{
llong ans = 0;
for (int i = n ; i >= 1 ; --i)
{
for (int j = m ; j >= 1 ; --j)
{
countI[i][j] = countI[i + 1][j] + (t[i][j] == 'I');
countO[i][j] = countO[i][j + 1] + (t[i][j] == 'O');
if (t[i][j] == 'J')
{
ans += countI[i][j] * countO[i][j];
}
}
}
std::cout << ans << '\n';
}
void read()
{
std::cin >> n >> m;
for (int i = 1 ; i <= n ; ++i)
{
std::cin >> t[i] + 1;
}
}
void fastIO()
{
std::ios_base :: sync_with_stdio(0);
std::cout.tie(nullptr);
std::cin.tie(nullptr);
}
int main ()
{
fastIO();
read();
solve();
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... |