#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define pii pair<ll,ll>
int main(){
ll ans=0;
ll n, m;
cin >> n >> m;
char c[n+1][m+1];
vector <pii> pos;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cin >> c[i][j];
if(c[i][j] == 'J') pos.pb({i,j});
}
}
for(auto x:pos){
ll a=x.ff, b=x.ss, I=0, O=0;
for(int i=a; i<n; i++){
if(c[i][b] == 'I') I++;
}
for(int i=b; i<m; i++){
if(c[a][i] == 'O') O++;
}
ans+=I*O;
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
548 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
496 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
548 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
496 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
30 ms |
1608 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
19 ms |
1488 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
39 ms |
2844 KB |
Output is correct |
19 |
Correct |
16 ms |
1240 KB |
Output is correct |
20 |
Correct |
51 ms |
2768 KB |
Output is correct |
21 |
Correct |
39 ms |
2768 KB |
Output is correct |
22 |
Correct |
39 ms |
2768 KB |
Output is correct |
23 |
Correct |
44 ms |
2768 KB |
Output is correct |
24 |
Correct |
55 ms |
2768 KB |
Output is correct |
25 |
Correct |
20 ms |
1240 KB |
Output is correct |
26 |
Correct |
45 ms |
2768 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 |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
548 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
496 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
30 ms |
1608 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
19 ms |
1488 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
39 ms |
2844 KB |
Output is correct |
19 |
Correct |
16 ms |
1240 KB |
Output is correct |
20 |
Correct |
51 ms |
2768 KB |
Output is correct |
21 |
Correct |
39 ms |
2768 KB |
Output is correct |
22 |
Correct |
39 ms |
2768 KB |
Output is correct |
23 |
Correct |
44 ms |
2768 KB |
Output is correct |
24 |
Correct |
55 ms |
2768 KB |
Output is correct |
25 |
Correct |
20 ms |
1240 KB |
Output is correct |
26 |
Correct |
45 ms |
2768 KB |
Output is correct |
27 |
Execution timed out |
1025 ms |
74640 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |