이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 2;
int h , w , dpo[N][N] , dpi[N][N];
char c[N][N];
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);  cout.tie(0);
	cin >> h >> w;
	for(int i = 0 ; i < h ; i++)  for(int j = 0 ; j < w ; j++)
		cin >> c[i][j];
	long long ans = 0;
	for(int i = h - 1 ; i >= 0 ; i--)  for(int j = w - 1 ; j >= 0 ; j--)
	{
		dpi[i][j] = (i == h - 1 ? 0 : dpi[i + 1][j]);
		if(c[i][j] == 'I')
			dpi[i][j]++;
		dpo[i][j] = (j == w - 1 ? 0 : dpo[i][j + 1]);
		if(c[i][j] == 'O')
			dpo[i][j]++;
		if(c[i][j] == 'J')
			ans += dpi[i][j] * dpo[i][j];
	}
	cout << ans << '\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... |