#include <iostream>
using namespace std;
const int MAX_TAILLE = 4200;
int nbLigne, nbCol;
char grille[MAX_TAILLE][MAX_TAILLE];
int cumulO[MAX_TAILLE][MAX_TAILLE] = {0};
int cumulI[MAX_TAILLE][MAX_TAILLE] = {0};
void input() {
cin >> nbLigne >> nbCol;
for(int lig = 0; lig < nbLigne; lig++) {
for(int col = 0; col < nbCol; col++) {
cin >> grille[lig][col];
cumulO[lig][col+1] = cumulO[lig][col];
cumulI[lig+1][col] = cumulI[lig][col];
if(grille[lig][col] == 'O') {
cumulO[lig][col+1]++;
}
if(grille[lig][col] == 'I') {
cumulI[lig+1][col]++;
}
}
}
}
int total = 0;
int main() {
input();
for(int lig = 0; lig < nbLigne; lig++) {
for(int col = 0; col < nbCol; col++) {
if(grille[lig][col] != 'J') continue;
total += ((cumulO[lig][nbCol] - cumulO[lig][col]) * (cumulI[nbLigne][col] - cumulI[lig][col]));
}
}
cout << total << endl;
}
# |
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 |
1 ms |
312 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
1620 KB |
Output is correct |
6 |
Correct |
2 ms |
1492 KB |
Output is correct |
7 |
Correct |
2 ms |
1364 KB |
Output is correct |
8 |
Correct |
2 ms |
1620 KB |
Output is correct |
9 |
Correct |
2 ms |
1588 KB |
Output is correct |
10 |
Correct |
2 ms |
1364 KB |
Output is correct |
11 |
Correct |
2 ms |
1620 KB |
Output is correct |
12 |
Correct |
2 ms |
1492 KB |
Output is correct |
13 |
Correct |
2 ms |
1492 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 |
1 ms |
312 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
1620 KB |
Output is correct |
6 |
Correct |
2 ms |
1492 KB |
Output is correct |
7 |
Correct |
2 ms |
1364 KB |
Output is correct |
8 |
Correct |
2 ms |
1620 KB |
Output is correct |
9 |
Correct |
2 ms |
1588 KB |
Output is correct |
10 |
Correct |
2 ms |
1364 KB |
Output is correct |
11 |
Correct |
2 ms |
1620 KB |
Output is correct |
12 |
Correct |
2 ms |
1492 KB |
Output is correct |
13 |
Correct |
2 ms |
1492 KB |
Output is correct |
14 |
Correct |
16 ms |
8000 KB |
Output is correct |
15 |
Correct |
3 ms |
5428 KB |
Output is correct |
16 |
Correct |
10 ms |
4496 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
22 ms |
8560 KB |
Output is correct |
19 |
Correct |
18 ms |
8404 KB |
Output is correct |
20 |
Incorrect |
17 ms |
8404 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
1 ms |
312 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
1620 KB |
Output is correct |
6 |
Correct |
2 ms |
1492 KB |
Output is correct |
7 |
Correct |
2 ms |
1364 KB |
Output is correct |
8 |
Correct |
2 ms |
1620 KB |
Output is correct |
9 |
Correct |
2 ms |
1588 KB |
Output is correct |
10 |
Correct |
2 ms |
1364 KB |
Output is correct |
11 |
Correct |
2 ms |
1620 KB |
Output is correct |
12 |
Correct |
2 ms |
1492 KB |
Output is correct |
13 |
Correct |
2 ms |
1492 KB |
Output is correct |
14 |
Correct |
16 ms |
8000 KB |
Output is correct |
15 |
Correct |
3 ms |
5428 KB |
Output is correct |
16 |
Correct |
10 ms |
4496 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
22 ms |
8560 KB |
Output is correct |
19 |
Correct |
18 ms |
8404 KB |
Output is correct |
20 |
Incorrect |
17 ms |
8404 KB |
Output isn't correct |
21 |
Halted |
0 ms |
0 KB |
- |