# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1258728 | hanguyen | Bitaro the Brave (JOI19_ho_t1) | C++20 | 0 ms | 328 KiB |
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 3005;
int row[maxn] , col[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--) {
if(a[i][j] == 'O') row[i]++;
if(a[i][j] == 'I') col[j]++;
}
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
if(a[i][j] == 'J') res += row[i] * col[j];
}
}
cout << res;
}
Compilation message (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... |