Submission #1027164

#TimeUsernameProblemLanguageResultExecution timeMemory
1027164vjudge1Bitaro the Brave (JOI19_ho_t1)C++17
20 / 100
1097 ms2900 KiB
#include <bits/stdc++.h>
#define ll long long
#define nikah ios_base::sync_with_stdio(0); cin.tie(0);
const ll maxn = 1e4+7;
using namespace std;

ll t,n,m;
char a[3007][3007];

int main () {
	nikah
	cin>>n>>m;
	for (ll i=1; i<=n; i++) {
		for (ll j=1; j<=m; j++) {
			cin>>a[i][j];
		}
	}
	ll ans = 0;
	for (ll i=1; i<=n; i++) {
		for (ll j=1; j<=m; j++) {
			if (a[i][j] != 'J') continue;
			for (ll k=i+1; k<=n; k++) {
				if (a[k][j] != 'I') continue;
				for (ll l=j+1; l<=m; l++) {
					if (a[i][j] == 'J' && a[i][l] == 'O'&& a[k][j] == 'I') {
						ans++;
					//	cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl;
					}
				}
			}
		}
	}
	cout<<ans<<endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...