#include <bits/stdc++.h>
using namespace std;
char matrice[3001][3001];
int main ()
{
ios :: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int linii , coloane;
cin >> linii >> coloane;
int aparitii[3000] = { };
for (int linie = 0 ; linie < linii ; linie++)
{
cin >> matrice[linie];
for (int coloana = 0 ; coloana < coloane ; coloana++) {
if (matrice[linie][coloana] == 'I')
{ aparitii[coloana]++; }
}
}
int64_t total = 0;
for (int linie = 0 ; linie < linii ; linie++) {
for (int coloana = 0 , termen = 0 ; coloana < coloane ; coloana++) {
if (matrice[linie][coloana] == 'O') { total += termen; }
else if (matrice[linie][coloana] == 'J') { termen += aparitii[coloana]; }
else { aparitii[coloana]--; }
}
}
cout << total;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
604 KB |
Output is correct |
11 |
Correct |
0 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
0 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
604 KB |
Output is correct |
11 |
Correct |
0 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
0 ms |
604 KB |
Output is correct |
14 |
Correct |
3 ms |
1884 KB |
Output is correct |
15 |
Correct |
1 ms |
1628 KB |
Output is correct |
16 |
Correct |
1 ms |
1116 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
3 ms |
2140 KB |
Output is correct |
19 |
Correct |
1 ms |
2140 KB |
Output is correct |
20 |
Correct |
2 ms |
1964 KB |
Output is correct |
21 |
Correct |
5 ms |
2140 KB |
Output is correct |
22 |
Correct |
2 ms |
2140 KB |
Output is correct |
23 |
Correct |
2 ms |
2136 KB |
Output is correct |
24 |
Correct |
3 ms |
2140 KB |
Output is correct |
25 |
Correct |
1 ms |
2140 KB |
Output is correct |
26 |
Correct |
2 ms |
2136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
604 KB |
Output is correct |
11 |
Correct |
0 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
0 ms |
604 KB |
Output is correct |
14 |
Correct |
3 ms |
1884 KB |
Output is correct |
15 |
Correct |
1 ms |
1628 KB |
Output is correct |
16 |
Correct |
1 ms |
1116 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
3 ms |
2140 KB |
Output is correct |
19 |
Correct |
1 ms |
2140 KB |
Output is correct |
20 |
Correct |
2 ms |
1964 KB |
Output is correct |
21 |
Correct |
5 ms |
2140 KB |
Output is correct |
22 |
Correct |
2 ms |
2140 KB |
Output is correct |
23 |
Correct |
2 ms |
2136 KB |
Output is correct |
24 |
Correct |
3 ms |
2140 KB |
Output is correct |
25 |
Correct |
1 ms |
2140 KB |
Output is correct |
26 |
Correct |
2 ms |
2136 KB |
Output is correct |
27 |
Correct |
91 ms |
17808 KB |
Output is correct |
28 |
Correct |
3 ms |
7260 KB |
Output is correct |
29 |
Correct |
3 ms |
1832 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
64 ms |
13668 KB |
Output is correct |
32 |
Correct |
33 ms |
17812 KB |
Output is correct |
33 |
Correct |
29 ms |
17836 KB |
Output is correct |
34 |
Correct |
77 ms |
15800 KB |
Output is correct |
35 |
Correct |
39 ms |
17748 KB |
Output is correct |
36 |
Correct |
28 ms |
17748 KB |
Output is correct |
37 |
Correct |
82 ms |
18048 KB |
Output is correct |
38 |
Correct |
23 ms |
13620 KB |
Output is correct |
39 |
Correct |
25 ms |
13688 KB |
Output is correct |