이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
vector<pii> posJ;
vector<int> posO[3010], posI[3010];
int n, m;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n >> m;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
char c; cin >> c;
if(c == 'J') {
posJ.push_back({i, j});
}
else if(c == 'O') {
posO[i].push_back(j);
}
else {
posI[j].push_back(i);
}
}
}
ll res = 0;
for(auto [i, j] : posJ) {
ll cntO = 0, cntI = 0;
for(auto l : posO[i]) {
if(l > j) cntO++;
}
for(auto k : posI[j]) {
if(k > i) cntI++;
}
res += (cntO * cntI);
}
cout << res << '\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... |