#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e3 + 10;
int numO[maxn];
int main()
{
char tab[maxn][maxn];
int H, W;
cin >> H >> W;
for(int i = 0; i < H; i++)
{
for(int j = 0; j < W; j++)
{
cin >> tab[i][j];
}
}
for(int i = 0; i < H; i++)
{
for(int j = 0; j < W; j++)
{
if(tab[i][i] == 'O') numO[i]++;
}
}
int cont = 0;
for(int i = 0; i < H - 1; i++)
{
for(int k = i + 1; k < H; k++)
{
for(int j = 0; j < W - 1; j++)
{
if(tab[i][j] == 'J' and tab[k][j] == 'I')
cont += numO[i];
}
}
}
cout << cont << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |