제출 #1194211

#제출 시각아이디문제언어결과실행 시간메모리
1194211PlayVoltzBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
515 ms90684 KiB
#include <cstdio>
#include <stdio.h>
#include <stdbool.h>
#include <iostream>
#include <map>
#include <vector>
#include <climits>
#include <stack>
#include <string>
#include <queue>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <cctype>
#include <bitset>
#include <iomanip>
#include <cstring>
#include <numeric>
#include <cassert>
using namespace std;

#define int long long
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int32_t main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, m, ans=0;
	cin>>n>>m;
	vector<string> vect(n);
	vector<vector<int> > vert(m), hori(n);
	for (int i=0; i<n; ++i)cin>>vect[i];
	for (int i=0; i<n; ++i)for (int j=0; j<m; ++j)if (vect[i][j]=='O')hori[i].pb(j);
	for (int j=0; j<m; ++j)for (int i=0; i<n; ++i)if (vect[i][j]=='I')vert[j].pb(i);
	for (int i=0; i<n; ++i)for (int j=0; j<m; ++j)if (vect[i][j]=='J')
	ans+=(hori[i].end()-upper_bound(hori[i].begin(), hori[i].end(), j))*(vert[j].end()-upper_bound(vert[j].begin(), vert[j].end(), i));
	cout<<ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...