이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
using namespace std;
#define ll long long
const int MAX = 3007;
char s[MAX][MAX];
int ingot[MAX][MAX];
int orb[MAX][MAX];
int main()
{
ios :: sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= m; ++j)
{
cin >> s[i][j];
ingot[i][j] = (s[i][j] == 'I');
orb[i][j] = (s[i][j] == 'O');
ingot[i][j] += ingot[i-1][j];
orb[i][j] += orb[i][j-1];
}
}
ll res = 0;
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= m; ++j)
{
if (s[i][j] == 'J')
{
res += 1LL * (orb[i][m] - orb[i][j-1]) * (ingot[n][j] - ingot[i-1][j]);
}
}
}
cout << res << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |