#include <bits/stdc++.h>
using namespace std;
#define N 3005
#define pii pair<int,int>
int h, w, ans;
char c;
int o[N][N], i[N][N];
vector<pii> j;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> h >> w;
for (int x=1; x<=h; x++)
for (int y=1; y<=w; y++)
{
cin >> c;
if (c=='J') j.push_back({x,y});
o[x][y]=o[x][y-1]+(c=='O');
i[x][y]=i[x-1][y]+(c=='I');
}
ans=0;
for (auto now:j)
{
int a=now.first, b=now.second;
ans+=(o[a][w]-o[a][b])*(i[h][b]-i[a][b]);
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
464 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
2904 KB |
Output is correct |
6 |
Correct |
2 ms |
2908 KB |
Output is correct |
7 |
Correct |
1 ms |
2908 KB |
Output is correct |
8 |
Correct |
1 ms |
2908 KB |
Output is correct |
9 |
Correct |
1 ms |
2908 KB |
Output is correct |
10 |
Correct |
1 ms |
2908 KB |
Output is correct |
11 |
Correct |
2 ms |
2904 KB |
Output is correct |
12 |
Correct |
1 ms |
2908 KB |
Output is correct |
13 |
Correct |
1 ms |
2908 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
464 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
2904 KB |
Output is correct |
6 |
Correct |
2 ms |
2908 KB |
Output is correct |
7 |
Correct |
1 ms |
2908 KB |
Output is correct |
8 |
Correct |
1 ms |
2908 KB |
Output is correct |
9 |
Correct |
1 ms |
2908 KB |
Output is correct |
10 |
Correct |
1 ms |
2908 KB |
Output is correct |
11 |
Correct |
2 ms |
2904 KB |
Output is correct |
12 |
Correct |
1 ms |
2908 KB |
Output is correct |
13 |
Correct |
1 ms |
2908 KB |
Output is correct |
14 |
Correct |
12 ms |
11228 KB |
Output is correct |
15 |
Correct |
3 ms |
8284 KB |
Output is correct |
16 |
Correct |
10 ms |
8152 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
12 ms |
11484 KB |
Output is correct |
19 |
Correct |
6 ms |
11100 KB |
Output is correct |
20 |
Incorrect |
9 ms |
11476 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
464 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
2904 KB |
Output is correct |
6 |
Correct |
2 ms |
2908 KB |
Output is correct |
7 |
Correct |
1 ms |
2908 KB |
Output is correct |
8 |
Correct |
1 ms |
2908 KB |
Output is correct |
9 |
Correct |
1 ms |
2908 KB |
Output is correct |
10 |
Correct |
1 ms |
2908 KB |
Output is correct |
11 |
Correct |
2 ms |
2904 KB |
Output is correct |
12 |
Correct |
1 ms |
2908 KB |
Output is correct |
13 |
Correct |
1 ms |
2908 KB |
Output is correct |
14 |
Correct |
12 ms |
11228 KB |
Output is correct |
15 |
Correct |
3 ms |
8284 KB |
Output is correct |
16 |
Correct |
10 ms |
8152 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
12 ms |
11484 KB |
Output is correct |
19 |
Correct |
6 ms |
11100 KB |
Output is correct |
20 |
Incorrect |
9 ms |
11476 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |