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>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
int h, w;
char board[3005][3005];
int countorb[3005][3005], countingot[3005][3005];
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
std::cout.tie(0);
std::cin >> h >> w;
for(int i = 1; i <= h; i++)
{
for(int j = 1; j <= w; j++)
{
std::cin >> board[i][j];
countorb[i][j] = countorb[i][j - 1] + (board[i][j] == 'O');
countingot[i][j] = countingot[i - 1][j] + (board[i][j] == 'I');
}
}
long long ans = 0;
for(int i = 1; i <= h; i++)
{
for(int j = 1; j <= w; j++)
{
if(board[i][j] == 'J')
{
ans += 1ll * (countorb[i][w] - countorb[i][j]) * (countingot[h][j] - countingot[i][j]);
}
}
}
std::cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |