# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1105154 | salmon | Bitaro the Brave (JOI19_ho_t1) | C++14 | 382 ms | 93528 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;
int H,W;
char lst[3100][3100];
int I[3100][3100];
int O[3100][3100];
long long int ans = 0;
int main(){
scanf(" %d",&H);
scanf(" %d",&W);
for(int i = 0; i < H; i++){
for(int j = 0; j < W; j++){
scanf(" %c",&lst[i][j]);
}
}
for(int i = 0; i < H; i++){
O[i][W - 1] = 0;
if(lst[i][W - 1] == 'O'){
O[i][W - 1]++;
}
for(int j = W - 2; j >= 0; j--){
O[i][j] = O[i][j + 1];
if(lst[i][j] == 'O') O[i][j]++;
}
}
for(int j = 0; j < W; j++){
I[H - 1][j] = 0;
if(lst[H - 1][j] == 'I'){
I[H - 1][j]++;
}
for(int i = H - 2; i >= 0; i--){
I[i][j] = I[i + 1][j];
if(lst[i][j] == 'I') I[i][j]++;
}
}
for(int i = 0; i < H; i++){
for(int j = 0; j < W; j++){
if(lst[i][j] == 'J') ans += I[i][j] * O[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... |