#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
ll h,w,rw[3001][3001],cl[3001][3001],tong;
char a[3001][3001];
main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin>>h>>w;
for (int i=1;i<=h;++i)
{
for (int j=1;j<=w;++j)
{
cin>>a[i][j];
rw[i][j]=rw[i][j-1];
if (a[i][j]=='O') rw[i][j]++;
cl[i][j]=cl[i-1][j];
if (a[i][j]=='I') cl[i][j]++;
}
}
for (int i=1;i<=h;++i)
{
for (int j=1;j<=w;++j)
{
if (a[i][j]=='J')
{
tong+=(rw[i][w]-rw[i][j])*(cl[h][j]-cl[i][j]);
}
}
}
cout<<tong;
}
Compilation message
joi2019_ho_t1.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
8 | main()
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
5468 KB |
Output is correct |
6 |
Correct |
2 ms |
5468 KB |
Output is correct |
7 |
Correct |
1 ms |
5468 KB |
Output is correct |
8 |
Correct |
1 ms |
5468 KB |
Output is correct |
9 |
Correct |
1 ms |
5468 KB |
Output is correct |
10 |
Correct |
1 ms |
5352 KB |
Output is correct |
11 |
Correct |
1 ms |
5468 KB |
Output is correct |
12 |
Correct |
1 ms |
5468 KB |
Output is correct |
13 |
Correct |
1 ms |
5468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
5468 KB |
Output is correct |
6 |
Correct |
2 ms |
5468 KB |
Output is correct |
7 |
Correct |
1 ms |
5468 KB |
Output is correct |
8 |
Correct |
1 ms |
5468 KB |
Output is correct |
9 |
Correct |
1 ms |
5468 KB |
Output is correct |
10 |
Correct |
1 ms |
5352 KB |
Output is correct |
11 |
Correct |
1 ms |
5468 KB |
Output is correct |
12 |
Correct |
1 ms |
5468 KB |
Output is correct |
13 |
Correct |
1 ms |
5468 KB |
Output is correct |
14 |
Correct |
9 ms |
18268 KB |
Output is correct |
15 |
Correct |
2 ms |
14952 KB |
Output is correct |
16 |
Correct |
4 ms |
13148 KB |
Output is correct |
17 |
Correct |
0 ms |
604 KB |
Output is correct |
18 |
Correct |
8 ms |
20580 KB |
Output is correct |
19 |
Correct |
6 ms |
20572 KB |
Output is correct |
20 |
Correct |
10 ms |
20684 KB |
Output is correct |
21 |
Correct |
11 ms |
20572 KB |
Output is correct |
22 |
Correct |
6 ms |
20440 KB |
Output is correct |
23 |
Correct |
6 ms |
20568 KB |
Output is correct |
24 |
Correct |
9 ms |
20476 KB |
Output is correct |
25 |
Correct |
7 ms |
20572 KB |
Output is correct |
26 |
Correct |
5 ms |
20576 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
5468 KB |
Output is correct |
6 |
Correct |
2 ms |
5468 KB |
Output is correct |
7 |
Correct |
1 ms |
5468 KB |
Output is correct |
8 |
Correct |
1 ms |
5468 KB |
Output is correct |
9 |
Correct |
1 ms |
5468 KB |
Output is correct |
10 |
Correct |
1 ms |
5352 KB |
Output is correct |
11 |
Correct |
1 ms |
5468 KB |
Output is correct |
12 |
Correct |
1 ms |
5468 KB |
Output is correct |
13 |
Correct |
1 ms |
5468 KB |
Output is correct |
14 |
Correct |
9 ms |
18268 KB |
Output is correct |
15 |
Correct |
2 ms |
14952 KB |
Output is correct |
16 |
Correct |
4 ms |
13148 KB |
Output is correct |
17 |
Correct |
0 ms |
604 KB |
Output is correct |
18 |
Correct |
8 ms |
20580 KB |
Output is correct |
19 |
Correct |
6 ms |
20572 KB |
Output is correct |
20 |
Correct |
10 ms |
20684 KB |
Output is correct |
21 |
Correct |
11 ms |
20572 KB |
Output is correct |
22 |
Correct |
6 ms |
20440 KB |
Output is correct |
23 |
Correct |
6 ms |
20568 KB |
Output is correct |
24 |
Correct |
9 ms |
20476 KB |
Output is correct |
25 |
Correct |
7 ms |
20572 KB |
Output is correct |
26 |
Correct |
5 ms |
20576 KB |
Output is correct |
27 |
Correct |
253 ms |
150396 KB |
Output is correct |
28 |
Correct |
11 ms |
43352 KB |
Output is correct |
29 |
Correct |
9 ms |
17500 KB |
Output is correct |
30 |
Correct |
2 ms |
860 KB |
Output is correct |
31 |
Correct |
179 ms |
125192 KB |
Output is correct |
32 |
Correct |
157 ms |
150100 KB |
Output is correct |
33 |
Correct |
151 ms |
149584 KB |
Output is correct |
34 |
Correct |
212 ms |
145036 KB |
Output is correct |
35 |
Correct |
144 ms |
150096 KB |
Output is correct |
36 |
Correct |
146 ms |
149588 KB |
Output is correct |
37 |
Correct |
246 ms |
150084 KB |
Output is correct |
38 |
Correct |
116 ms |
124756 KB |
Output is correct |
39 |
Correct |
107 ms |
124536 KB |
Output is correct |