이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |