#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;
#define FOR(i, j, k) for (ll i = j; i < (ll) k; ++i)
#define FORD(i, j, k) for (ll i = j; i >= (ll) k; --i)
#define nl "\n"
#define sp " "
#define all(x) (x).begin(), (x).end()
#define sc second
#define fr first
#define pb emplace_back
void solve()
{
ll n, m;
cin >> n >> m;
string a[n];
FOR(i, 0, n) {
cin >> a[i];
}
ll ans = 0;
FOR(i, 0, n) {
FOR(j, 0, m) {
if(a[i][j] != 'J')
continue;
ll O = 0, I = 0;
FOR(l, j + 1, m) {
if(a[i][l] == 'O')
++O;
}
FOR(l, i + 1, n) {
if(a[l][j] == 'I')
++I;
}
ans += (O * I);
}
}
cout << ans << nl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t = 1;
// cin >> t;
while (t--)
{
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
328 KB |
Output is correct |
14 |
Correct |
26 ms |
596 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
17 ms |
580 KB |
Output is correct |
17 |
Correct |
1 ms |
320 KB |
Output is correct |
18 |
Correct |
37 ms |
824 KB |
Output is correct |
19 |
Correct |
10 ms |
724 KB |
Output is correct |
20 |
Correct |
50 ms |
808 KB |
Output is correct |
21 |
Correct |
42 ms |
824 KB |
Output is correct |
22 |
Correct |
47 ms |
808 KB |
Output is correct |
23 |
Correct |
47 ms |
804 KB |
Output is correct |
24 |
Correct |
44 ms |
724 KB |
Output is correct |
25 |
Correct |
11 ms |
808 KB |
Output is correct |
26 |
Correct |
46 ms |
724 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
328 KB |
Output is correct |
14 |
Correct |
26 ms |
596 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
17 ms |
580 KB |
Output is correct |
17 |
Correct |
1 ms |
320 KB |
Output is correct |
18 |
Correct |
37 ms |
824 KB |
Output is correct |
19 |
Correct |
10 ms |
724 KB |
Output is correct |
20 |
Correct |
50 ms |
808 KB |
Output is correct |
21 |
Correct |
42 ms |
824 KB |
Output is correct |
22 |
Correct |
47 ms |
808 KB |
Output is correct |
23 |
Correct |
47 ms |
804 KB |
Output is correct |
24 |
Correct |
44 ms |
724 KB |
Output is correct |
25 |
Correct |
11 ms |
808 KB |
Output is correct |
26 |
Correct |
46 ms |
724 KB |
Output is correct |
27 |
Execution timed out |
1028 ms |
17732 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |