#include<iostream>
#define endl '\n'
using namespace std;
int red,col,bro[3005][3005],bri[3005][3005],br=0;
char c[3005][3005];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>red>>col;
for(int i=0;i<red;i++)
{
for(int j=0;j<col;j++)
{
cin>>c[i][j];
}
}
for(int i=0;i<red;i++)
{
for(int j=col-1;j>=0;j--)
{
if(c[i][j]=='O') bro[i][j]++;
bro[i][j]+=bro[i][j+1];
}
}
for(int i=0;i<col;i++)
{
for(int j=red-1;j>=0;j--)
{
if(c[j][i]=='I') bri[j][i]++;
bri[j][i]+=bri[j+1][i];
}
}
for(int i=0;i<red;i++)
{
for(int j=0;j<col;j++)
{
if(c[i][j]=='J') br+=(bro[i][j+1]*bri[i+1][j]);
}
}
cout<<br<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
320 KB |
Output is correct |
2 |
Correct |
0 ms |
324 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
1480 KB |
Output is correct |
6 |
Correct |
1 ms |
1484 KB |
Output is correct |
7 |
Correct |
1 ms |
1356 KB |
Output is correct |
8 |
Correct |
1 ms |
1484 KB |
Output is correct |
9 |
Correct |
1 ms |
1484 KB |
Output is correct |
10 |
Correct |
2 ms |
1356 KB |
Output is correct |
11 |
Correct |
1 ms |
1484 KB |
Output is correct |
12 |
Correct |
1 ms |
1484 KB |
Output is correct |
13 |
Correct |
1 ms |
1356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
320 KB |
Output is correct |
2 |
Correct |
0 ms |
324 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
1480 KB |
Output is correct |
6 |
Correct |
1 ms |
1484 KB |
Output is correct |
7 |
Correct |
1 ms |
1356 KB |
Output is correct |
8 |
Correct |
1 ms |
1484 KB |
Output is correct |
9 |
Correct |
1 ms |
1484 KB |
Output is correct |
10 |
Correct |
2 ms |
1356 KB |
Output is correct |
11 |
Correct |
1 ms |
1484 KB |
Output is correct |
12 |
Correct |
1 ms |
1484 KB |
Output is correct |
13 |
Correct |
1 ms |
1356 KB |
Output is correct |
14 |
Correct |
8 ms |
7472 KB |
Output is correct |
15 |
Correct |
3 ms |
4936 KB |
Output is correct |
16 |
Correct |
6 ms |
4192 KB |
Output is correct |
17 |
Correct |
1 ms |
460 KB |
Output is correct |
18 |
Correct |
12 ms |
7876 KB |
Output is correct |
19 |
Correct |
8 ms |
7876 KB |
Output is correct |
20 |
Incorrect |
8 ms |
7760 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
320 KB |
Output is correct |
2 |
Correct |
0 ms |
324 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
1480 KB |
Output is correct |
6 |
Correct |
1 ms |
1484 KB |
Output is correct |
7 |
Correct |
1 ms |
1356 KB |
Output is correct |
8 |
Correct |
1 ms |
1484 KB |
Output is correct |
9 |
Correct |
1 ms |
1484 KB |
Output is correct |
10 |
Correct |
2 ms |
1356 KB |
Output is correct |
11 |
Correct |
1 ms |
1484 KB |
Output is correct |
12 |
Correct |
1 ms |
1484 KB |
Output is correct |
13 |
Correct |
1 ms |
1356 KB |
Output is correct |
14 |
Correct |
8 ms |
7472 KB |
Output is correct |
15 |
Correct |
3 ms |
4936 KB |
Output is correct |
16 |
Correct |
6 ms |
4192 KB |
Output is correct |
17 |
Correct |
1 ms |
460 KB |
Output is correct |
18 |
Correct |
12 ms |
7876 KB |
Output is correct |
19 |
Correct |
8 ms |
7876 KB |
Output is correct |
20 |
Incorrect |
8 ms |
7760 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |