제출 #1345072

#제출 시각아이디문제언어결과실행 시간메모리
1345072FaresSTHBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
126 ms9248 KiB
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
#define S second
#define F first
int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n,m;
	cin>>n>>m;
	int c[m]={};
	char g[n][m];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>g[i][j];
			if(g[i][j]=='I')c[j]++;
		}
	}
	ll res=0;
	for(int i=0;i<n;i++){
		ll cn=0;
		for(int j=m-1;j>=0;j--){
			if(g[i][j]=='I')c[j]--;
			else if(g[i][j]=='O')cn++;
			else res+=cn*c[j];
		}
	}
	cout<<res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...