This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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]++;
}
}
}
}
long long 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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |