Submission #307318

# Submission time Handle Problem Language Result Execution time Memory
307318 2020-09-27T18:41:32 Z Temmie Bitaro the Brave (JOI19_ho_t1) C++17
0 / 100
162 ms 274432 KB
#include <bits/stdc++.h>

typedef long long ll;

int main() {
	std::ios::sync_with_stdio(0);
	
	int h, w; std::cin >> h >> w;
	std::vector <std::string> g(h);
	std::vector <std::vector <ll>> a(4269, std::vector <ll> (4269, 0)), b(a);
	for (auto& x : g) std::cin >> x;
	for (int i = 0; i < w; i++)
		for (int j = h - 1; j >= 0; j--)
			b[i][j] = (j != h - 1 ? b[i][j + 1] : 0) + (g[j][i] == 'I');
	for (int i = 0; i < h; i++)
		for (int j = w - 1; j >= 0; j--)
			a[i][j] = (j != w - 1 ? a[i][j + 1] : 0) + (g[i][j] == 'O');
	ll ans = 0;
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++)
			ans += (g[i][j] == 'J') * a[i][j] * b[j][i];
	std::cout << ans << "\n";
	
}
# Verdict Execution time Memory Grader output
1 Runtime error 162 ms 274432 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 162 ms 274432 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 162 ms 274432 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -