#include <bits/stdc++.h>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
map<char, int> conversion = {{'I', 0}, {'J', 1}, {'O', 2}};
signed main(){
int nLigs, nCols; cin >> nLigs >> nCols;
int vals[nLigs][nCols];
int occsLig[nLigs][3], occsCol[nCols][3];
for (int icol = 0; icol < nCols; ++icol)
for (int color = 0; color < 3; ++color)
occsCol[icol][color] = 0;
for (int ilig = 0; ilig < nLigs; ++ilig){
occsLig[ilig][0] = occsLig[ilig][1] = occsLig[ilig][2] = 0;
for (int icol = 0; icol < nCols; ++icol){
char cara; cin >> cara;
vals[ilig][icol] = conversion[cara];
occsLig[ilig][conversion[cara]]++;
occsCol[icol][conversion[cara]]++;
}
}
int sum = 0;
for (int x = 0; x < nLigs; ++x)
for (int y = 0; y < nCols; ++y){
if (vals[x][y] == 1){
//cout << x << " " << y << " " << occsCol[y][0] << " " << occsLig[x][2] << endl;
sum += occsCol[y][0] * occsLig[x][2];
}
}
cout << sum << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |