# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099327 | Zflop | Bitaro the Brave (JOI19_ho_t1) | C++14 | 271 ms | 161884 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 <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define sor(x) sort(all(x))
#define pi pair<int,int>
#define vi vector<int>
#define int ll
const int NMAX = 3010;
int N,M;
vector<string>A;
int O[NMAX][NMAX],I[NMAX][NMAX];
void solve() {
cin >> N >> M;
A = vector<string>(N);
for (int i = 0; i < N;++i)
cin >> A[i];
for (int i = 0; i < N;++i)
for (int j = 0; j < M;++j) {
if (j)
O[i][j] += O[i][j - 1];
if(i)
I[i][j] += I[i - 1][j];
if(A[i][j] == 'O') O[i][j]++;
if(A[i][j] == 'I') I[i][j]++;
}
int cnt = 0;
for (int i = 0; i < N;++i)
for (int j = 0; j < M;++j) {
if(A[i][j] == 'J')
cnt += (O[i][M - 1] - O[i][j]) * (I[N - 1][j] - I[i][j]);
}
cout << cnt;
}
main(){
solve();
}
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... |