#include<bits/stdc++.h>
#define N 3010
using namespace std;
int n, m;
char c[N][N];
int dir[N][N], bai[N][N];
int main(){
cin >> n >> m;
for(int i = 1;i <= n;i++){
for(int j = 1;j <= m;j++){
cin >> c[i][j];
}
}
for(int i = 1;i <= n;i++){
for(int j = m;j > 0;j--){
dir[i][j] = dir[i][j+1] + (c[i][j] == 'O' ? 1 : 0);
}
}
for(int j = 1;j <= m;j++){
for(int i = n;i > 0;i--){
bai[i][j] = bai[i+1][j] + (c[i][j] == 'I' ? 1 : 0);
}
}
int res = 0;
for(int i = 1;i <= n;i++){
for(int j = 1;j <= m;j++){
if(c[i][j] == 'J'){
res += dir[i][j]*bai[i][j];
}
}
}
cout << res << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
1472 KB |
Output is correct |
6 |
Correct |
2 ms |
1460 KB |
Output is correct |
7 |
Correct |
2 ms |
1368 KB |
Output is correct |
8 |
Correct |
2 ms |
1468 KB |
Output is correct |
9 |
Correct |
2 ms |
1364 KB |
Output is correct |
10 |
Correct |
2 ms |
1364 KB |
Output is correct |
11 |
Correct |
2 ms |
1492 KB |
Output is correct |
12 |
Correct |
1 ms |
1364 KB |
Output is correct |
13 |
Correct |
1 ms |
1340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
1472 KB |
Output is correct |
6 |
Correct |
2 ms |
1460 KB |
Output is correct |
7 |
Correct |
2 ms |
1368 KB |
Output is correct |
8 |
Correct |
2 ms |
1468 KB |
Output is correct |
9 |
Correct |
2 ms |
1364 KB |
Output is correct |
10 |
Correct |
2 ms |
1364 KB |
Output is correct |
11 |
Correct |
2 ms |
1492 KB |
Output is correct |
12 |
Correct |
1 ms |
1364 KB |
Output is correct |
13 |
Correct |
1 ms |
1340 KB |
Output is correct |
14 |
Correct |
15 ms |
7380 KB |
Output is correct |
15 |
Correct |
3 ms |
4920 KB |
Output is correct |
16 |
Correct |
10 ms |
4308 KB |
Output is correct |
17 |
Correct |
1 ms |
468 KB |
Output is correct |
18 |
Correct |
20 ms |
7932 KB |
Output is correct |
19 |
Correct |
18 ms |
7828 KB |
Output is correct |
20 |
Incorrect |
18 ms |
7784 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
1472 KB |
Output is correct |
6 |
Correct |
2 ms |
1460 KB |
Output is correct |
7 |
Correct |
2 ms |
1368 KB |
Output is correct |
8 |
Correct |
2 ms |
1468 KB |
Output is correct |
9 |
Correct |
2 ms |
1364 KB |
Output is correct |
10 |
Correct |
2 ms |
1364 KB |
Output is correct |
11 |
Correct |
2 ms |
1492 KB |
Output is correct |
12 |
Correct |
1 ms |
1364 KB |
Output is correct |
13 |
Correct |
1 ms |
1340 KB |
Output is correct |
14 |
Correct |
15 ms |
7380 KB |
Output is correct |
15 |
Correct |
3 ms |
4920 KB |
Output is correct |
16 |
Correct |
10 ms |
4308 KB |
Output is correct |
17 |
Correct |
1 ms |
468 KB |
Output is correct |
18 |
Correct |
20 ms |
7932 KB |
Output is correct |
19 |
Correct |
18 ms |
7828 KB |
Output is correct |
20 |
Incorrect |
18 ms |
7784 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |