# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
99660 | cki86201 | Bitaro the Brave (JOI19_ho_t1) | C++11 | 228 ms | 84936 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>
#include <time.h>
#include <limits.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;
int N, M;
char X[3030][3030];
ll ans;
int cnt[3030][3030][2];
int main() {
scanf("%d%d", &N, &M);
for(int i=1;i<=N;i++) scanf("%s", X[i] + 1);
for(int i=1;i<=N;i++) for(int j=1;j<=M;j++) {
if(X[i][j] == 'O') cnt[i][j][0]++;
if(X[i][j] == 'I') cnt[i][j][1]++;
}
for(int i=N;i;i--) for(int j=M;j;j--) {
cnt[i][j][0] += cnt[i][j+1][0];
cnt[i][j][1] += cnt[i+1][j][1];
}
for(int i=1;i<=N;i++) for(int j=1;j<=M;j++) if(X[i][j] == 'J') {
ans += (ll)cnt[i][j][0] * cnt[i][j][1];
}
printf("%lld\n", ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |