#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define pii pair<int,int>
int main(){
ll ans=0;
int 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){
int 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 |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
436 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 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 |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
436 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
34 ms |
1240 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
18 ms |
1308 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
42 ms |
2032 KB |
Output is correct |
19 |
Correct |
16 ms |
1116 KB |
Output is correct |
20 |
Correct |
53 ms |
2004 KB |
Output is correct |
21 |
Correct |
42 ms |
2000 KB |
Output is correct |
22 |
Correct |
42 ms |
2004 KB |
Output is correct |
23 |
Correct |
50 ms |
2004 KB |
Output is correct |
24 |
Correct |
51 ms |
2000 KB |
Output is correct |
25 |
Correct |
16 ms |
1112 KB |
Output is correct |
26 |
Correct |
50 ms |
2124 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 |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
436 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
34 ms |
1240 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
18 ms |
1308 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
42 ms |
2032 KB |
Output is correct |
19 |
Correct |
16 ms |
1116 KB |
Output is correct |
20 |
Correct |
53 ms |
2004 KB |
Output is correct |
21 |
Correct |
42 ms |
2000 KB |
Output is correct |
22 |
Correct |
42 ms |
2004 KB |
Output is correct |
23 |
Correct |
50 ms |
2004 KB |
Output is correct |
24 |
Correct |
51 ms |
2000 KB |
Output is correct |
25 |
Correct |
16 ms |
1112 KB |
Output is correct |
26 |
Correct |
50 ms |
2124 KB |
Output is correct |
27 |
Execution timed out |
1045 ms |
48840 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |