# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121269 | onjo0127 | Bitaro the Brave (JOI19_ho_t1) | C++11 | 558 ms | 85704 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;
char A[3009][3009];
int O[3009][3009], I[3009][3009];
int main() {
int H, W; scanf("%d%d",&H,&W);
for(int i=1; i<=H; i++) {
for(int j=1; j<=W; j++) {
scanf(" %c", &A[i][j]);
O[i][j] = O[i][j-1];
I[i][j] = I[i-1][j];
if(A[i][j] == 'O') ++O[i][j];
if(A[i][j] == 'I') ++I[i][j];
}
}
long long ans = 0;
for(int i=1; i<=H; i++) {
for(int j=1; j<=W; j++) {
if(A[i][j] == 'J') ans += 1LL * (O[i][W] - O[i][j]) * (I[H][j] - I[i][j]);
}
}
printf("%lld", ans);
return 0;
}
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... |