이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3003;
long long orb[MAXN], ingot[MAXN];
string grid[MAXN];
int main() {
cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);
//freopen("input.txt", "r", stdin);
int n, m; cin >> n >> m;
for(int i = 0; i < n; ++i){
cin >> grid[i];
for(int j = 0; j < m; ++j){
if(grid[i][j] == 'I') ++ingot[j];
else if(grid[i][j] == 'O') ++orb[i];
}
}
long long tot = 0;
for(int i = 0; i < n; ++i){
for(int j = 0; j < m; ++j){
if(grid[i][j] == 'J')
tot += orb[i] * ingot[j];
else if(grid[i][j] == 'O')
--orb[i];
else if(grid[i][j] == 'I')
--ingot[j];
}
}
cout << tot << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |