이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
const int m=1e9+7;
int main(){
//ios::sync_with_stdio(0);
// cin.tie(0);
//freopen("test_input.txt", "r", stdin);
//freopen("test_output.txt", "w", stdout);
int a,b;cin>>a>>b;
vector<vector<char>> grid(a,vector<char>(b));
REP(i,0,a)REP(j,0,b)cin>>grid[i][j];
vi ic(b,0),oc(a,0);
REP(i,0,a)REP(j,0,b){
if(grid[i][j]=='I')ic[j]++;
else if(grid[i][j]=='O')oc[i]++;
}
ll ans=0;
REP(i,0,a)REP(j,0,b){
if(grid[i][j]=='I')ic[j]--;
else if(grid[i][j]=='O')oc[i]--;
else ans+=(ll)oc[i]*ic[j];
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |