# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
743422 | mickey080929 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 702 ms | 88608 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char a[3010][3010];
int c[3010][3010];
int r[3010][3010];
int main() {
int n, m;
scanf("%d %d", &n, &m);
for (int i=1; i<=n; i++) {
for (int j=1; j<=m; j++) {
scanf(" %c", &a[i][j]);
}
}
for (int i=1; i<=n; i++) {
for (int j=m; j>=1; j--) {
c[i][j] = c[i][j+1] + (a[i][j] == 'O');
}
}
for (int j=1; j<=m; j++) {
for (int i=n; i>=1; i--) {
r[i][j] = r[i+1][j] + (a[i][j] == 'I');
}
}
ll ans = 0;
for (int i=1; i<=n; i++) {
for (int j=1; j<=m; j++) {
if (a[i][j] != 'J') continue;
ans += (ll)c[i][j] * r[i][j];
}
}
printf("%lld", ans);
}
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... |