답안 #209196

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
209196 2020-03-13T11:13:41 Z kostia244 Bitaro the Brave (JOI19_ho_t1) C++17
0 / 100
5 ms 504 KB
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
const int maxn= 3030;
int n, m;
char mat[maxn][maxn];
int J[maxn][maxn], I[maxn][maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			cin >> mat[i][j];
	for(int i = 1; i <= n; i++) {
		for(int j = m; j; j--) {
			J[i][j] = J[i][j+1] + (mat[i][j] == 'O');
		}
	}
	for(int i = n; i; i--) {
		for(int j = 1; j <= m; j++) {
			I[i][j] = I[i+1][j] + (mat[i][j] == 'I');
		}
	}
	ll ans = 0;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) {
			if(mat[i][j] != 'J') continue;
			ans += J[i][j] * I[j][j];
		}
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Incorrect 5 ms 504 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Incorrect 5 ms 504 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Incorrect 5 ms 504 KB Output isn't correct
5 Halted 0 ms 0 KB -