#include<bits/stdc++.h>
using namespace std;
vector<string> tb;
const int N=3e3+10;
int o[N][N];
int e[N][N];
int main(){
int h,w;
cin>>h >>w;
tb.resize(h);
for(int i=0;i<h;i++){
cin>>tb[i];
}
//cout<<1;
for(int i=0;i<h;i++){
for(int j=w-1;j>=0;j--){
o[i][j]=o[i][j+1];
if(tb[i][j]=='O') o[i][j]++;
}
}
//cout<<2;
for(int i=h-1;i>=0;i--){
//cout<<4;
for(int j=0;j<w;j++){
//cout<<5;
e[i][j]=e[i+1][j];
if(tb[i][j]=='I') e[i][j]++;
}
}
//cout<<3;
int sum=0;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(tb[i][j]=='J') sum+=(o[i][j+1]*e[i+1][j]);
}
}
cout<<sum;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
444 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
1116 KB |
Output is correct |
6 |
Correct |
1 ms |
1220 KB |
Output is correct |
7 |
Correct |
1 ms |
1116 KB |
Output is correct |
8 |
Correct |
1 ms |
1372 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
1 ms |
1116 KB |
Output is correct |
11 |
Correct |
1 ms |
1116 KB |
Output is correct |
12 |
Correct |
1 ms |
1116 KB |
Output is correct |
13 |
Correct |
1 ms |
1224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
444 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
1116 KB |
Output is correct |
6 |
Correct |
1 ms |
1220 KB |
Output is correct |
7 |
Correct |
1 ms |
1116 KB |
Output is correct |
8 |
Correct |
1 ms |
1372 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
1 ms |
1116 KB |
Output is correct |
11 |
Correct |
1 ms |
1116 KB |
Output is correct |
12 |
Correct |
1 ms |
1116 KB |
Output is correct |
13 |
Correct |
1 ms |
1224 KB |
Output is correct |
14 |
Correct |
7 ms |
8396 KB |
Output is correct |
15 |
Correct |
2 ms |
6492 KB |
Output is correct |
16 |
Correct |
5 ms |
4700 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
9 ms |
9052 KB |
Output is correct |
19 |
Correct |
7 ms |
8792 KB |
Output is correct |
20 |
Incorrect |
8 ms |
9052 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
444 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
1116 KB |
Output is correct |
6 |
Correct |
1 ms |
1220 KB |
Output is correct |
7 |
Correct |
1 ms |
1116 KB |
Output is correct |
8 |
Correct |
1 ms |
1372 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
1 ms |
1116 KB |
Output is correct |
11 |
Correct |
1 ms |
1116 KB |
Output is correct |
12 |
Correct |
1 ms |
1116 KB |
Output is correct |
13 |
Correct |
1 ms |
1224 KB |
Output is correct |
14 |
Correct |
7 ms |
8396 KB |
Output is correct |
15 |
Correct |
2 ms |
6492 KB |
Output is correct |
16 |
Correct |
5 ms |
4700 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
9 ms |
9052 KB |
Output is correct |
19 |
Correct |
7 ms |
8792 KB |
Output is correct |
20 |
Incorrect |
8 ms |
9052 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |