#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n,m; cin>>n>>m;
char matrica[n][m];
vector<int> O(n),I(m);
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
char c; cin>>c;
matrica[i][j]=c;
if(c=='O')
{
O[i]++;
}
else if(c=='I')
{
I[j]++;
}
}
}
long long rez=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(matrica[i][j]=='J')
{
rez+=(O[i]*I[j]);
}
else if(matrica[i][j]=='O')
{
O[i]--;
}
else
{
I[j]--;
}
}
}
cout<<rez;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
452 KB |
Output is correct |
6 |
Correct |
1 ms |
508 KB |
Output is correct |
7 |
Correct |
1 ms |
448 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
456 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
452 KB |
Output is correct |
6 |
Correct |
1 ms |
508 KB |
Output is correct |
7 |
Correct |
1 ms |
448 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
456 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
9 ms |
592 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
5 ms |
592 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
14 ms |
848 KB |
Output is correct |
19 |
Correct |
10 ms |
848 KB |
Output is correct |
20 |
Correct |
8 ms |
848 KB |
Output is correct |
21 |
Correct |
11 ms |
848 KB |
Output is correct |
22 |
Correct |
9 ms |
848 KB |
Output is correct |
23 |
Correct |
11 ms |
916 KB |
Output is correct |
24 |
Correct |
12 ms |
848 KB |
Output is correct |
25 |
Correct |
8 ms |
848 KB |
Output is correct |
26 |
Correct |
9 ms |
848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
452 KB |
Output is correct |
6 |
Correct |
1 ms |
508 KB |
Output is correct |
7 |
Correct |
1 ms |
448 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
456 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
9 ms |
592 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
5 ms |
592 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
14 ms |
848 KB |
Output is correct |
19 |
Correct |
10 ms |
848 KB |
Output is correct |
20 |
Correct |
8 ms |
848 KB |
Output is correct |
21 |
Correct |
11 ms |
848 KB |
Output is correct |
22 |
Correct |
9 ms |
848 KB |
Output is correct |
23 |
Correct |
11 ms |
916 KB |
Output is correct |
24 |
Correct |
12 ms |
848 KB |
Output is correct |
25 |
Correct |
8 ms |
848 KB |
Output is correct |
26 |
Correct |
9 ms |
848 KB |
Output is correct |
27 |
Correct |
418 ms |
12952 KB |
Output is correct |
28 |
Correct |
2 ms |
592 KB |
Output is correct |
29 |
Correct |
27 ms |
1592 KB |
Output is correct |
30 |
Correct |
2 ms |
504 KB |
Output is correct |
31 |
Correct |
282 ms |
11392 KB |
Output is correct |
32 |
Correct |
297 ms |
13640 KB |
Output is correct |
33 |
Correct |
288 ms |
13776 KB |
Output is correct |
34 |
Correct |
354 ms |
11372 KB |
Output is correct |
35 |
Correct |
327 ms |
13656 KB |
Output is correct |
36 |
Correct |
282 ms |
16124 KB |
Output is correct |
37 |
Correct |
391 ms |
14024 KB |
Output is correct |
38 |
Correct |
201 ms |
11152 KB |
Output is correct |
39 |
Correct |
214 ms |
9804 KB |
Output is correct |