이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,m,O[3003][3003],I[3003][3003],ans;
string s[3005];
int main(){
ios::sync_with_stdio(false);
cin >> n >> m;
for(int i=1; i<=n; i++){
cin >> s[i];
for(int j=m-1; j>=0; j--)
O[i][j] = O[i][j + 1] + (s[i][j] == 'O');
}
for(int i=0; i<m; i++)
for(int j=n; j>=1; j--)
I[j][i] = I[j + 1][i] + (s[j][i] == 'I');
for(int i=1; i<=n; i++)
for(int j=0; j<m; j++)
if(s[i][j] == 'J')
ans += O[i][j] * I[i][j];
cout << ans << endl;
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... |