#include <bits/stdc++.h>
using namespace std;
int os[3003][3003], is[3003][3003];
int main()
{
int H, W;
cin>>H>>W;
string rows[3003];
for(int i=0; i<H; i++)cin>>rows[i];
for(int i=0; i<H; i++)
{
int cnt=0;
for(int j=W-1; j>=0; j--)
{
os[i][j]=cnt;
if(rows[i][j]=='O')cnt++;
}
}
for(int i=0; i<W; i++)
{
int cnt=0;
for(int j=H-1; j>=0; j--)
{
is[j][i]=cnt;
if(rows[j][i]=='I')cnt++;
}
}
int rezz=0;
for(int i=0; i<H; i++)
{
for(int j=0; j<W; j++)
{
if(rows[i][j]=='J')rezz+=os[i][j]*is[i][j];
//cout<<os[i][j]<<" ";
}
//cout<<endl;
}
cout<<rezz;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
404 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
1304 KB |
Output is correct |
6 |
Correct |
2 ms |
1176 KB |
Output is correct |
7 |
Correct |
2 ms |
1108 KB |
Output is correct |
8 |
Correct |
1 ms |
1236 KB |
Output is correct |
9 |
Correct |
1 ms |
1236 KB |
Output is correct |
10 |
Correct |
1 ms |
1180 KB |
Output is correct |
11 |
Correct |
1 ms |
1236 KB |
Output is correct |
12 |
Correct |
1 ms |
1236 KB |
Output is correct |
13 |
Correct |
1 ms |
1180 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
404 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
1304 KB |
Output is correct |
6 |
Correct |
2 ms |
1176 KB |
Output is correct |
7 |
Correct |
2 ms |
1108 KB |
Output is correct |
8 |
Correct |
1 ms |
1236 KB |
Output is correct |
9 |
Correct |
1 ms |
1236 KB |
Output is correct |
10 |
Correct |
1 ms |
1180 KB |
Output is correct |
11 |
Correct |
1 ms |
1236 KB |
Output is correct |
12 |
Correct |
1 ms |
1236 KB |
Output is correct |
13 |
Correct |
1 ms |
1180 KB |
Output is correct |
14 |
Correct |
8 ms |
6300 KB |
Output is correct |
15 |
Correct |
2 ms |
3736 KB |
Output is correct |
16 |
Correct |
6 ms |
3772 KB |
Output is correct |
17 |
Correct |
1 ms |
468 KB |
Output is correct |
18 |
Correct |
12 ms |
7000 KB |
Output is correct |
19 |
Correct |
9 ms |
6740 KB |
Output is correct |
20 |
Incorrect |
9 ms |
6868 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
404 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
1304 KB |
Output is correct |
6 |
Correct |
2 ms |
1176 KB |
Output is correct |
7 |
Correct |
2 ms |
1108 KB |
Output is correct |
8 |
Correct |
1 ms |
1236 KB |
Output is correct |
9 |
Correct |
1 ms |
1236 KB |
Output is correct |
10 |
Correct |
1 ms |
1180 KB |
Output is correct |
11 |
Correct |
1 ms |
1236 KB |
Output is correct |
12 |
Correct |
1 ms |
1236 KB |
Output is correct |
13 |
Correct |
1 ms |
1180 KB |
Output is correct |
14 |
Correct |
8 ms |
6300 KB |
Output is correct |
15 |
Correct |
2 ms |
3736 KB |
Output is correct |
16 |
Correct |
6 ms |
3772 KB |
Output is correct |
17 |
Correct |
1 ms |
468 KB |
Output is correct |
18 |
Correct |
12 ms |
7000 KB |
Output is correct |
19 |
Correct |
9 ms |
6740 KB |
Output is correct |
20 |
Incorrect |
9 ms |
6868 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |