Submission #1226683

#TimeUsernameProblemLanguageResultExecution timeMemory
1226683wedonttalkanymoreBitaro the Brave (JOI19_ho_t1)C++20
20 / 100
1095 ms3144 KiB
#include <bits/stdc++.h>

using namespace std;

int h, w;
int a[3005][3005];

signed main() {
	cin >> h >> w;
	for (int i = 1; i <= h; i++) {
		string s;
		cin >> s;
		for (int j = 1; j <= w; j++) {
			if (s[j - 1] == 'J') a[i][j] = 0;
			else if (s[j - 1] == 'O') a[i][j] = 1;
			else a[i][j] = 2;
		}
	}
	int ans = 0;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			for (int k = i + 1; k <= h; k++) {
				for (int l = j + 1; l <= w; l++) {
					if (a[i][j] == 0 && a[i][l] == 1 && a[k][j] == 2) ans++;
//					int mask = 0;
//					mask |= (1 << a[i][j]);
//					mask |= (1 << a[i][l]);
//					mask |= (1 << a[k][j]);
//					int tmp = __builtin_popcount(mask);
//					if (tmp == 3) {
//						ans++;
//						cout << i << ' ' << j << ' ' << k << ' ' << l << '\n';
//					}
				}
			}
		}
	}
	cout << ans;
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...