# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1258736 | hanguyen | Bitaro the Brave (JOI19_ho_t1) | C++20 | 164 ms | 150392 KiB |
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 3005;
int row[maxn][maxn] , col[maxn][maxn];
char a[maxn][maxn];
int n ,m;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
if (fopen(".inp", "r")) {
freopen(".inp", "r", stdin);
freopen(".out", "w", stdout);
}
int res = 0;
cin >> n >> m;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
cin >> a[i][j];
}
}
for(int i = n; i >= 1; i--) {
for(int j = m; j >= 1; j--) {
row[i][j] = row[i][j + 1] + (a[i][j] == 'O');
col[i][j] = col[i + 1][j] + (a[i][j] == 'I');
}
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
if(a[i][j] == 'J') {
res += row[i][j + 1] * col[i + 1][j];
}
}
}
cout << res;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |