제출 #1290155

#제출 시각아이디문제언어결과실행 시간메모리
1290155AbdullahIshfaqBitaro the Brave (JOI19_ho_t1)C++20
20 / 100
3 ms656 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 998244353
void solve()
{
	int h, w;
	cin >> h >> w;
	string v[h];
	for (int i = 0; i < h; i++)
		cin >> v[i];
	int cnt[w] = {0}, ans = 0, k = 0;
	for (int i = h - 1; i >= 0; i--)
	{
		k = 0;
		for (int j = w - 1; j >= 0; j--)
		{
			if (v[i][j] == 'J')
				ans += cnt[j] * k;
			else if (v[i][j] == 'O')
				k++;
			else
				cnt[j]++;
		}
	}
	cout << ans << endl;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t = 1;
	// cin >> t;
	for (ll i = 1; i <= t; i++)
	{
		solve();
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...