#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define inf 1e15
#define endl '\n';
using pii = pair<int,int>;
using piii = pair<int,pii>;
using piiii = pair<pii,pii>;
int mod = 1e9+7;
int32_t main()
{
//freopen("file.in" , "r" , stdin);freopen("file.out" , "w" , stdout);
ios_base::sync_with_stdio(0);cin.tie(0);
int H, W;
cin >> H >> W;
vector<vector<char>> grid(H, vector<char>(W));
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
cin >> grid[i][j];
int cnt = 0;
for (int i = 0; i < H; i++)
{
for (int j = 0; j < W; j++)
{
if (grid[i][j] == 'J')
{
for (int k = i + 1; k < H; k++)
{
for (int l = j + 1; l < W; l++)
{
if (grid[i][l] == 'O' && grid[k][j] == 'I')
{
cnt++;
}
}
}
}
}
}
cout << cnt << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
12 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
14 ms |
332 KB |
Output is correct |
8 |
Correct |
13 ms |
324 KB |
Output is correct |
9 |
Correct |
7 ms |
332 KB |
Output is correct |
10 |
Correct |
15 ms |
212 KB |
Output is correct |
11 |
Correct |
14 ms |
212 KB |
Output is correct |
12 |
Correct |
4 ms |
212 KB |
Output is correct |
13 |
Correct |
14 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
12 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
14 ms |
332 KB |
Output is correct |
8 |
Correct |
13 ms |
324 KB |
Output is correct |
9 |
Correct |
7 ms |
332 KB |
Output is correct |
10 |
Correct |
15 ms |
212 KB |
Output is correct |
11 |
Correct |
14 ms |
212 KB |
Output is correct |
12 |
Correct |
4 ms |
212 KB |
Output is correct |
13 |
Correct |
14 ms |
328 KB |
Output is correct |
14 |
Execution timed out |
1078 ms |
468 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
12 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
14 ms |
332 KB |
Output is correct |
8 |
Correct |
13 ms |
324 KB |
Output is correct |
9 |
Correct |
7 ms |
332 KB |
Output is correct |
10 |
Correct |
15 ms |
212 KB |
Output is correct |
11 |
Correct |
14 ms |
212 KB |
Output is correct |
12 |
Correct |
4 ms |
212 KB |
Output is correct |
13 |
Correct |
14 ms |
328 KB |
Output is correct |
14 |
Execution timed out |
1078 ms |
468 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |