#include<bits/stdc++.h>
/*
Chuppy no fat ######
𖠋 𖠋 𖠋 𖠋 𖠋 Trùm copy code :3
*/
#define int long long
#define bl bool
#define db double
#define fl float
#define st string
#define pb push_back
#define pf push_front
#define is insert
#define endl "\n"
#define pba pop_back
#define pfr pop_front
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define FOR(i, l, r, st) for(int i = l; i <= r; i += st)
#define FOS(i, l, r, sl) for(int i = l; i >= r; i -= sl)
#define mii map<int, int>
#define us unordered_set
#define pii pair<int, int>
#define vt vector
using namespace std;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
void suncuti() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
int H, W, pfsJ[3005][3005], pfsO[3005][3005], pfsI[3005][3005], stJ[3005][3005], edJ[3005][3005];
char A[3005][3005] , row[3005], low[3005];
main() {
suncuti();
cin >> H >> W;
FOR(i, 1, H, 1) {
FOR(j, 1, W, 1) {
cin >> A[i][j];
}
}
FOR(i, 1, H, 1) {
FOR(j, 1, W, 1) {
pfsI[i][j] = pfsI[i - 1][j] + (A[i][j] == 'I');
pfsO[i][j] = pfsO[i][j - 1] + (A[i][j] == 'O');
}
}
int cnt = 0;
FOS(i, H, 1, 1) {
FOS(j, W, 1, 1) {
row[i] += (A[i][j] == 'O');
low[j] += (A[i][j] == 'I');
}
}
FOR(i, 1, H, 1) {
FOR(j, 1, W, 1) {
if(A[i][j] == 'J') {
cnt += row[j] * low[i];
// cout << i << " " << j << endl;
}
}
}
cout << cnt;
}
Compilation message (stderr)
joi2019_ho_t1.cpp:46:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
46 | main() {
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |