#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll t,n,a,b,cvp,dgr;
int dizi[3005][3005];
string s[3005];
int o,iler;
int main()
{
cin>>a>>b;
for (int i=1;i<=a;i++)
{
cin>>s[i];
o=0;
for (int j=b-1;j>=0;j--)
{
if (s[i][j]=='O')
o++;
if (s[i][j]=='J')
dizi[i][j]=o;
}
}
for (int i=0;i<b;i++)
{
iler=0;
for (int j=a;j>=0;j--)
{
if (s[j][i]=='I')
iler++;
if (s[j][i]=='J')
cvp+=dizi[j][i]*iler;
}
}
cout<<cvp;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
844 KB |
Output is correct |
6 |
Correct |
1 ms |
716 KB |
Output is correct |
7 |
Correct |
2 ms |
716 KB |
Output is correct |
8 |
Correct |
1 ms |
844 KB |
Output is correct |
9 |
Correct |
2 ms |
716 KB |
Output is correct |
10 |
Correct |
1 ms |
716 KB |
Output is correct |
11 |
Correct |
1 ms |
844 KB |
Output is correct |
12 |
Correct |
2 ms |
716 KB |
Output is correct |
13 |
Correct |
2 ms |
716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
844 KB |
Output is correct |
6 |
Correct |
1 ms |
716 KB |
Output is correct |
7 |
Correct |
2 ms |
716 KB |
Output is correct |
8 |
Correct |
1 ms |
844 KB |
Output is correct |
9 |
Correct |
2 ms |
716 KB |
Output is correct |
10 |
Correct |
1 ms |
716 KB |
Output is correct |
11 |
Correct |
1 ms |
844 KB |
Output is correct |
12 |
Correct |
2 ms |
716 KB |
Output is correct |
13 |
Correct |
2 ms |
716 KB |
Output is correct |
14 |
Correct |
9 ms |
3356 KB |
Output is correct |
15 |
Correct |
2 ms |
1924 KB |
Output is correct |
16 |
Correct |
4 ms |
1868 KB |
Output is correct |
17 |
Correct |
1 ms |
400 KB |
Output is correct |
18 |
Correct |
10 ms |
3744 KB |
Output is correct |
19 |
Correct |
8 ms |
3020 KB |
Output is correct |
20 |
Correct |
8 ms |
3144 KB |
Output is correct |
21 |
Correct |
11 ms |
4044 KB |
Output is correct |
22 |
Correct |
8 ms |
3404 KB |
Output is correct |
23 |
Correct |
8 ms |
3276 KB |
Output is correct |
24 |
Correct |
11 ms |
4044 KB |
Output is correct |
25 |
Correct |
8 ms |
3276 KB |
Output is correct |
26 |
Correct |
15 ms |
3380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
844 KB |
Output is correct |
6 |
Correct |
1 ms |
716 KB |
Output is correct |
7 |
Correct |
2 ms |
716 KB |
Output is correct |
8 |
Correct |
1 ms |
844 KB |
Output is correct |
9 |
Correct |
2 ms |
716 KB |
Output is correct |
10 |
Correct |
1 ms |
716 KB |
Output is correct |
11 |
Correct |
1 ms |
844 KB |
Output is correct |
12 |
Correct |
2 ms |
716 KB |
Output is correct |
13 |
Correct |
2 ms |
716 KB |
Output is correct |
14 |
Correct |
9 ms |
3356 KB |
Output is correct |
15 |
Correct |
2 ms |
1924 KB |
Output is correct |
16 |
Correct |
4 ms |
1868 KB |
Output is correct |
17 |
Correct |
1 ms |
400 KB |
Output is correct |
18 |
Correct |
10 ms |
3744 KB |
Output is correct |
19 |
Correct |
8 ms |
3020 KB |
Output is correct |
20 |
Correct |
8 ms |
3144 KB |
Output is correct |
21 |
Correct |
11 ms |
4044 KB |
Output is correct |
22 |
Correct |
8 ms |
3404 KB |
Output is correct |
23 |
Correct |
8 ms |
3276 KB |
Output is correct |
24 |
Correct |
11 ms |
4044 KB |
Output is correct |
25 |
Correct |
8 ms |
3276 KB |
Output is correct |
26 |
Correct |
15 ms |
3380 KB |
Output is correct |
27 |
Correct |
392 ms |
55280 KB |
Output is correct |
28 |
Correct |
5 ms |
9108 KB |
Output is correct |
29 |
Correct |
18 ms |
3800 KB |
Output is correct |
30 |
Correct |
2 ms |
528 KB |
Output is correct |
31 |
Correct |
279 ms |
45320 KB |
Output is correct |
32 |
Correct |
308 ms |
48736 KB |
Output is correct |
33 |
Correct |
296 ms |
44100 KB |
Output is correct |
34 |
Correct |
423 ms |
52732 KB |
Output is correct |
35 |
Correct |
329 ms |
50456 KB |
Output is correct |
36 |
Correct |
318 ms |
44228 KB |
Output is correct |
37 |
Correct |
386 ms |
55672 KB |
Output is correct |
38 |
Correct |
213 ms |
38172 KB |
Output is correct |
39 |
Correct |
225 ms |
33824 KB |
Output is correct |