#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]){
int h, w;
cin >> h >> w;
char grid[h][w];
for(int i = 0; i < h; i++){
for(int k = 0; k < w; k++)
cin >> grid[i][k];
}
int ingot[h][w] = {0}, orb[h][w] = {0};
for(int i = 0; i < w; i++){
int counter = 0;
for(int k = h - 1; k >= 0; k--){
if(grid[k][i] == 'I')
counter++;
ingot[k][i] = counter;
}
}
for(int i = 0; i < h; i++){
int counter = 0;
for(int k = w - 1; k >= 0; k--){
if(grid[i][k] == 'O')
counter++;
orb[i][k] = counter;
}
}
int res = 0;
for(int i = 0; i < h; i++){
for(int k = 0; k < w; k++){
if(grid[i][k] == 'J')
res += orb[i][k] * ingot[i][k];
}
}
cout << res;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
6 ms |
424 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
6 ms |
380 KB |
Output is correct |
9 |
Correct |
6 ms |
376 KB |
Output is correct |
10 |
Correct |
6 ms |
376 KB |
Output is correct |
11 |
Correct |
6 ms |
376 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
6 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
6 ms |
424 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
6 ms |
380 KB |
Output is correct |
9 |
Correct |
6 ms |
376 KB |
Output is correct |
10 |
Correct |
6 ms |
376 KB |
Output is correct |
11 |
Correct |
6 ms |
376 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
6 ms |
376 KB |
Output is correct |
14 |
Correct |
22 ms |
2168 KB |
Output is correct |
15 |
Correct |
5 ms |
380 KB |
Output is correct |
16 |
Correct |
17 ms |
1660 KB |
Output is correct |
17 |
Correct |
9 ms |
376 KB |
Output is correct |
18 |
Correct |
28 ms |
2808 KB |
Output is correct |
19 |
Correct |
25 ms |
2680 KB |
Output is correct |
20 |
Incorrect |
26 ms |
2680 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
6 ms |
424 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
6 ms |
380 KB |
Output is correct |
9 |
Correct |
6 ms |
376 KB |
Output is correct |
10 |
Correct |
6 ms |
376 KB |
Output is correct |
11 |
Correct |
6 ms |
376 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
6 ms |
376 KB |
Output is correct |
14 |
Correct |
22 ms |
2168 KB |
Output is correct |
15 |
Correct |
5 ms |
380 KB |
Output is correct |
16 |
Correct |
17 ms |
1660 KB |
Output is correct |
17 |
Correct |
9 ms |
376 KB |
Output is correct |
18 |
Correct |
28 ms |
2808 KB |
Output is correct |
19 |
Correct |
25 ms |
2680 KB |
Output is correct |
20 |
Incorrect |
26 ms |
2680 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |