#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(), x.end()
#define size(x) (int)x.size()
template<class S, class T>
bool chmin(S &a, const T &b) {
return a > b && (a = b) == b;
}
template<class S, class T>
bool chmax(S &a, const T &b) {
return a < b && (a = b) == b;
}
const int inf = 1e9 + 7;
const int INF = 1e18 + 7;
const int mod = 1e9 + 7;
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, m; cin >> n >> m;
string s[n];
for (int i = 0; i < n; ++i) cin >> s[i];
int res = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
for (int k = i + 1; k < n; ++k) {
for (int l = j + 1; l < m; ++l) {
if (s[i][j] == 'J' && s[i][l] == 'O' && s[k][j] == 'I') {
res++;
}
}
}
}
}
cout << res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
18 ms |
348 KB |
Output is correct |
6 |
Correct |
8 ms |
348 KB |
Output is correct |
7 |
Correct |
15 ms |
624 KB |
Output is correct |
8 |
Correct |
19 ms |
348 KB |
Output is correct |
9 |
Correct |
10 ms |
348 KB |
Output is correct |
10 |
Correct |
15 ms |
348 KB |
Output is correct |
11 |
Correct |
20 ms |
348 KB |
Output is correct |
12 |
Correct |
9 ms |
348 KB |
Output is correct |
13 |
Correct |
14 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
18 ms |
348 KB |
Output is correct |
6 |
Correct |
8 ms |
348 KB |
Output is correct |
7 |
Correct |
15 ms |
624 KB |
Output is correct |
8 |
Correct |
19 ms |
348 KB |
Output is correct |
9 |
Correct |
10 ms |
348 KB |
Output is correct |
10 |
Correct |
15 ms |
348 KB |
Output is correct |
11 |
Correct |
20 ms |
348 KB |
Output is correct |
12 |
Correct |
9 ms |
348 KB |
Output is correct |
13 |
Correct |
14 ms |
348 KB |
Output is correct |
14 |
Execution timed out |
1063 ms |
604 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
18 ms |
348 KB |
Output is correct |
6 |
Correct |
8 ms |
348 KB |
Output is correct |
7 |
Correct |
15 ms |
624 KB |
Output is correct |
8 |
Correct |
19 ms |
348 KB |
Output is correct |
9 |
Correct |
10 ms |
348 KB |
Output is correct |
10 |
Correct |
15 ms |
348 KB |
Output is correct |
11 |
Correct |
20 ms |
348 KB |
Output is correct |
12 |
Correct |
9 ms |
348 KB |
Output is correct |
13 |
Correct |
14 ms |
348 KB |
Output is correct |
14 |
Execution timed out |
1063 ms |
604 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |