#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int res=0;
int n,m;
cin>>n>>m;
char a;
vector<char>g[n];
vector<int>r(n),k(m);
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin>>a;
g[i].push_back(a);
if(a=='O')
{
r[i]++;
}
else if(a=='I')
{
k[j]++;
}
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(g[i][j]=='J')
{
res+=(r[i]*k[j]);
}
else if(g[i][j]=='O')
{
r[i]--;
}
else
{
k[j]--;
}
}
}
cout<<res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
592 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
504 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
460 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
424 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
592 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
504 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
460 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
424 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
10 ms |
852 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
5 ms |
596 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
12 ms |
924 KB |
Output is correct |
19 |
Correct |
10 ms |
720 KB |
Output is correct |
20 |
Correct |
9 ms |
852 KB |
Output is correct |
21 |
Correct |
14 ms |
852 KB |
Output is correct |
22 |
Correct |
9 ms |
852 KB |
Output is correct |
23 |
Correct |
8 ms |
852 KB |
Output is correct |
24 |
Correct |
11 ms |
852 KB |
Output is correct |
25 |
Correct |
9 ms |
852 KB |
Output is correct |
26 |
Correct |
9 ms |
852 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
592 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
504 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
460 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
424 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
10 ms |
852 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
5 ms |
596 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
12 ms |
924 KB |
Output is correct |
19 |
Correct |
10 ms |
720 KB |
Output is correct |
20 |
Correct |
9 ms |
852 KB |
Output is correct |
21 |
Correct |
14 ms |
852 KB |
Output is correct |
22 |
Correct |
9 ms |
852 KB |
Output is correct |
23 |
Correct |
8 ms |
852 KB |
Output is correct |
24 |
Correct |
11 ms |
852 KB |
Output is correct |
25 |
Correct |
9 ms |
852 KB |
Output is correct |
26 |
Correct |
9 ms |
852 KB |
Output is correct |
27 |
Correct |
369 ms |
20812 KB |
Output is correct |
28 |
Correct |
2 ms |
596 KB |
Output is correct |
29 |
Correct |
24 ms |
2068 KB |
Output is correct |
30 |
Correct |
2 ms |
340 KB |
Output is correct |
31 |
Correct |
298 ms |
16548 KB |
Output is correct |
32 |
Correct |
309 ms |
21324 KB |
Output is correct |
33 |
Correct |
278 ms |
21164 KB |
Output is correct |
34 |
Correct |
341 ms |
19072 KB |
Output is correct |
35 |
Correct |
317 ms |
21160 KB |
Output is correct |
36 |
Correct |
318 ms |
21324 KB |
Output is correct |
37 |
Correct |
404 ms |
21288 KB |
Output is correct |
38 |
Correct |
211 ms |
16604 KB |
Output is correct |
39 |
Correct |
198 ms |
16460 KB |
Output is correct |