Submission #679481

# Submission time Handle Problem Language Result Execution time Memory
679481 2023-01-08T12:02:07 Z ethening Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 212 KB
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	int n, m;
	cin >> n >> m;
	vector<string> s(n);
	for (auto &o: s) {
		cin >> o;
	}
	vector oki(n, vector<int>(m, 0));
	vector oko(n, vector<int>(m, 0));
	for (int i = 0; i < m; i++) {
		int cnti = 0;
		for (int j = n - 1; j >= 0; j--) {
			if (s[j][i] == 'I') ++cnti;
			else if (s[j][i] == 'J') oki[j][i] = cnti;
		}
	}
	for (int i = 0; i < n; i++) {
		int cnto = 0;
		for (int j = m - 1; j >= 0; j--) {
			if (s[i][j] == 'O') ++cnto;
			else if (s[i][j] == 'J') oko[i][j] = cnto;
		}
	}

	ll ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			ans += oki[i][j] * oko[i][j];
		}
	}
	cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -